diff options
author | Maximilian Goldstein <max.goldstein@qt.io> | 2021-08-02 16:50:27 +0200 |
---|---|---|
committer | Maximilian Goldstein <max.goldstein@qt.io> | 2021-08-04 17:15:22 +0200 |
commit | ef075016527c48f6ec64c088edb400ab52211d75 (patch) | |
tree | 7f33ce9b18ae1ef22cc00c2b8d7c43f45885e277 /src/qml/compiler/qv4codegen_p.h | |
parent | 283816d07dee9afaa9fa183b9102076f32568449 (diff) |
qmllint: Move use-before-declaration warning out of checkidentifiers
Another step to making checkidentifiers obsolete.
Change-Id: I14be7491387200101b66e0930faf16e9b61d4159
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4codegen_p.h')
-rw-r--r-- | src/qml/compiler/qv4codegen_p.h | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/qml/compiler/qv4codegen_p.h b/src/qml/compiler/qv4codegen_p.h index 58f46f9313..ef48c7a552 100644 --- a/src/qml/compiler/qv4codegen_p.h +++ b/src/qml/compiler/qv4codegen_p.h @@ -80,14 +80,28 @@ struct ControlFlow; struct ControlFlowCatch; struct ControlFlowFinally; +class Q_QMLCOMPILER_PRIVATE_EXPORT CodegenWarningInterface +{ +public: + virtual void reportVarUsedBeforeDeclaration(const QString &name, const QString &fileName, + QQmlJS::SourceLocation declarationLocation, + QQmlJS::SourceLocation accessLocation); +}; + +static CodegenWarningInterface *defaultCodegenWarningInterface() +{ + static CodegenWarningInterface interface; + return &interface; +} + class Q_QMLCOMPILER_PRIVATE_EXPORT Codegen: protected QQmlJS::AST::Visitor { protected: using BytecodeGenerator = QV4::Moth::BytecodeGenerator; using Instruction = QV4::Moth::Instruction; public: - Codegen(QV4::Compiler::JSUnitGenerator *jsUnitGenerator, bool strict); - + Codegen(QV4::Compiler::JSUnitGenerator *jsUnitGenerator, bool strict, + CodegenWarningInterface *interface = defaultCodegenWarningInterface()); void generateFromProgram(const QString &fileName, const QString &finalUrl, @@ -802,6 +816,7 @@ protected: bool _fileNameIsUrl; ErrorType _errorType = NoError; QQmlJS::DiagnosticMessage _error; + CodegenWarningInterface *_interface; class TailCallBlocker { |