Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qqmljslintercodegen_p.h
Go to the documentation of this file.
1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3// Qt-Security score:significant
4
5#ifndef QQMLJSLINTERCODEGEN_P_H
6#define QQMLJSLINTERCODEGEN_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17
18#include <QString>
19#include <QFile>
20#include <QList>
21
22#include <variant>
23#include <private/qqmljsdiagnosticmessage_p.h>
24#include <private/qqmlirbuilder_p.h>
25#include <private/qqmljsscope_p.h>
26#include <private/qqmljscompiler_p.h>
27
28#include <QtQmlCompiler/private/qqmljstyperesolver_p.h>
29#include <QtQmlCompiler/private/qqmljstypepropagator_p.h>
30#include <QtQmlCompiler/private/qqmljslogger_p.h>
31#include <QtQmlCompiler/private/qqmljscompilepass_p.h>
32#include <QtQmlCompiler/private/qqmljscontextproperties_p.h>
33#include <QtQmlCompiler/private/qqmljsusercontextproperties_p.h>
34
35QT_BEGIN_NAMESPACE
36
37namespace QQmlSA {
38class PassManager;
39};
40
42{
43public:
44 QQmlJSLinterCodegen(QQmlJSImporter *importer, const QString &fileName,
45 const QStringList &qmldirFiles, QQmlJSLogger *logger,
46 const ContextPropertyInfo &contextPropertyInfo);
47
48 void setDocument(const QmlIR::JSCodeGen *codegen, const QmlIR::Document *document) override;
55
56 void setTypeResolver(QQmlJSTypeResolver typeResolver)
57 {
58 m_typeResolver = std::move(typeResolver);
59 }
60
61 QQmlJSTypeResolver *typeResolver() { return &m_typeResolver; }
62
63 void setPassManager(QQmlSA::PassManager *passManager);
64
65 QQmlSA::PassManager *passManager() { return m_passManager; }
66
67private:
68 QQmlSA::PassManager *m_passManager = nullptr;
69
70 void analyzeFunction(const QV4::Compiler::Context *context,
71 QQmlJSCompilePass::Function *function);
72 ContextPropertyInfo m_contextPropertyInfo;
73};
74
75QT_END_NAMESPACE
76
77#endif
void reportVarUsedBeforeDeclaration(const QString &name, const QString &fileName, QQmlJS::SourceLocation declarationLocation, QQmlJS::SourceLocation accessLocation) override
void reportFunctionUsedBeforeDeclaration(const QString &name, const QString &fileName, QQmlJS::SourceLocation declarationLocation, QQmlJS::SourceLocation accessLocation) override
UnreachableVisitor * unreachableVisitor() override
CodegenWarningInterface(QQmlJSLogger *logger)
bool visit(QQmlJS::AST::FunctionDeclaration *functionDeclaration) override
void throwRecursionDepthError() override
virtual QString location() const
void setTypeResolver(QQmlJSTypeResolver typeResolver)
QQmlSA::PassManager * passManager()
QQmlJSLinterCodegen(QQmlJSImporter *importer, const QString &fileName, const QStringList &qmldirFiles, QQmlJSLogger *logger, const ContextPropertyInfo &contextPropertyInfo)
QQmlJSTypeResolver * typeResolver()
void setDocument(const QmlIR::JSCodeGen *codegen, const QmlIR::Document *document) override
void setPassManager(QQmlSA::PassManager *passManager)
UnreachableVisitor(QQmlJSLogger *logger)
void throwRecursionDepthError() override
bool containsFunctionDeclaration(QQmlJS::AST::Node *node)
bool visit(QQmlJS::AST::StatementList *unreachable) override
\inmodule QtQmlCompiler
static void addJsonWarning(QJsonArray &warnings, const QQmlJS::DiagnosticMessage &message, QAnyStringView id, const std::optional< QQmlJSFixSuggestion > &suggestion={})
#define QmlLintPluginInterface_iid
Definition qqmlsa.h:440