diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2020-03-31 15:46:20 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-04-01 10:29:29 +0200 |
commit | eb5aa8d9c18535ecd0aacc42fe3af954faf01c04 (patch) | |
tree | ee76e6358c9ae18fcdce6a6ae4fead3173ea6780 /tools/qmllint/findunqualified.h | |
parent | a88e5c1711bbef1af00ca9a9e0db71b8a24223aa (diff) |
qmllint: Consistently use shared pointers for ScopeTree
ScopeTree keeps a weak pointer to its parent scope and strong shared
pointers to its children. Avoid passing bare pointers around, so that we
cannot create multiple shared pointers independently from the same bare
pointer.
Change-Id: Id0faece550b1878363004d843a8fa5c1164794ae
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tools/qmllint/findunqualified.h')
-rw-r--r-- | tools/qmllint/findunqualified.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/tools/qmllint/findunqualified.h b/tools/qmllint/findunqualified.h index d2ebc947bf..1c1751fafb 100644 --- a/tools/qmllint/findunqualified.h +++ b/tools/qmllint/findunqualified.h @@ -63,14 +63,14 @@ private: QStringList dependencies; }; - QScopedPointer<ScopeTree> m_rootScope; - ScopeTree *m_currentScope; + ScopeTree::Ptr m_rootScope; + ScopeTree::Ptr m_currentScope; QQmlJS::AST::ExpressionNode *m_fieldMemberBase = nullptr; QHash<QString, ScopeTree::ConstPtr> m_types; QHash<QString, ScopeTree::ConstPtr> m_exportedName2Scope; QStringList m_qmltypeDirs; QString m_code; - QHash<QString, const ScopeTree *> m_qmlid2scope; + QHash<QString, ScopeTree::ConstPtr> m_qmlid2scope; QString m_rootId; QString m_filePath; QSet<QPair<QString, QString>> m_alreadySeenImports; @@ -81,7 +81,7 @@ private: struct OutstandingConnection { QString targetName; - ScopeTree *scope; + ScopeTree::Ptr scope; QQmlJS::AST::UiObjectDefinition *uiod; }; @@ -96,13 +96,13 @@ private: Import readQmldir(const QString &dirname); void processImport(const QString &prefix, const Import &import); - ScopeTree *localFile2ScopeTree(const QString &filePath); + ScopeTree::Ptr localFile2ScopeTree(const QString &filePath); void importFileOrDirectory(const QString &directory, const QString &prefix); void importExportedNames(const QStringRef &prefix, QString name); void parseHeaders(QQmlJS::AST::UiHeaderItemList *headers); - ScopeTree *parseProgram(QQmlJS::AST::Program *program, const QString &name); + ScopeTree::Ptr parseProgram(QQmlJS::AST::Program *program, const QString &name); void throwRecursionDepthError() override; |