diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2020-03-30 17:42:48 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-04-01 10:29:29 +0200 |
commit | c38ea80c5dd71a20eade7b3a3b619c1996c6af0b (patch) | |
tree | bd7eafa6e0e19f0aca3911c74ab99c7b8062a14a /tools/qmllint/checkidentifiers.h | |
parent | 4cf0962dc4d8d48aa600c5b56b160c8553782140 (diff) |
Move qmllint's metatype support to tools/shared
We want to read qmltypes files and analyze scopes also from other tools.
Furthermore, restructure the shared directory, so that each tool only
includes what it needs.
Change-Id: I96a2dcc8b1c5fac613592fb1867bf51fa5ef3a6e
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tools/qmllint/checkidentifiers.h')
-rw-r--r-- | tools/qmllint/checkidentifiers.h | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/tools/qmllint/checkidentifiers.h b/tools/qmllint/checkidentifiers.h new file mode 100644 index 0000000000..ae924c491c --- /dev/null +++ b/tools/qmllint/checkidentifiers.h @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef CHECKIDENTIFIERS_H +#define CHECKIDENTIFIERS_H + +#include "scopetree.h" + +class ColorOutput; + +class CheckIdentifiers +{ +public: + CheckIdentifiers(ColorOutput *colorOut, const QString &code, const QHash<QString, + ScopeTree::ConstPtr> &types) : + m_colorOut(colorOut), m_code(code), m_types(types) + {} + + bool operator ()(const QHash<QString, const ScopeTree *> &qmlIDs, + const ScopeTree *root, const QString &rootId) const; + +private: + bool checkMemberAccess(const QVector<ScopeTree::FieldMember> &members, + const ScopeTree *scope) const; + void printContext(const QQmlJS::SourceLocation &location) const; + + ColorOutput *m_colorOut = nullptr; + QString m_code; + QHash<QString, ScopeTree::ConstPtr> m_types; +}; + +#endif // CHECKIDENTIFIERS_H |