32class LinterVisitor
final :
public QQmlJSImportVisitor
36 const QString &implicitImportDirectory,
37 const QStringList &qmldirFiles = QStringList(), QQmlJS::Engine *engine =
nullptr);
40 using QQmlJSImportVisitor::endVisit;
41 using QQmlJSImportVisitor::visit;
43 bool preVisit(QQmlJS::AST::Node *)
override;
44 void postVisit(QQmlJS::AST::Node *)
override;
49 bool visit(QQmlJS::AST::StringLiteral *)
override;
50 bool visit(AST::CommaExpression *)
override;
51 bool visit(QQmlJS::AST::NewMemberExpression *)
override;
52 bool visit(QQmlJS::AST::VoidExpression *ast)
override;
53 bool visit(QQmlJS::AST::BinaryExpression *)
override;
54 bool visit(QQmlJS::AST::UiImport *import)
override;
55 bool visit(QQmlJS::AST::UiEnumDeclaration *uied)
override;
56 bool visit(QQmlJS::AST::CaseBlock *)
override;
57 bool visit(QQmlJS::AST::ExpressionStatement *ast)
override;
64 QTypeRevision version;
66 QQmlJS::AST::UiImport *uiImport;
68 SeenImport(QQmlJS::AST::UiImport *i) : filename(i->fileName), id(i->importId), uiImport(i)
71 uri = i->importUri->toString();
73 version = i->version->version;
75 friend bool comparesEqual(
const SeenImport &lhs,
const SeenImport &rhs)
noexcept
77 return lhs.filename == rhs.filename && lhs.uri == rhs.uri
78 && lhs.version == rhs.version && lhs.id == rhs.id;
80 Q_DECLARE_EQUALITY_COMPARABLE(SeenImport)
82 friend size_t qHash(
const SeenImport &i, size_t seed = 0)
84 return qHashMulti(seed, i.filename, i.uri, i.version, i.id);
87 QQmlJS::Engine *m_engine =
nullptr;
88 QSet<SeenImport> m_seenImports;
89 std::vector<QQmlJS::AST::Node *> m_ancestryIncludingCurrentNode;
91 void handleDuplicateEnums(QQmlJS::AST::UiEnumMemberList *members, QStringView key,
92 const QQmlJS::SourceLocation &location);
93 void warnCaseNoFlowControl(QQmlJS::SourceLocation caseToken)
const;
94 void checkCaseFallthrough(QQmlJS::AST::StatementList *statements, SourceLocation errorLoc,
95 SourceLocation nextLoc);
97 const QString &name,
const QQmlJS::AST::Statement *statement,
98 const QQmlJS::AST::UiPublicMember *associatedPropertyDefinition =
nullptr)
override;
100 const AST::UiPublicMember *associatedPropertyDefinition)
override;