qmllint: Don't leak the QQmlJSTypeInfo object
We want it to be mutable even where Codegen itself is const. Therefore, it needs to live outside Codegen. Change-Id: Ie4997118a1fdf8d60bd5670baa506ed0bfb98bad Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
This commit is contained in:
parent
43eca45b06
commit
6b33e7cff3
|
@ -34,14 +34,15 @@
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
|
|
||||||
Codegen::Codegen(QQmlJSImporter *importer, const QString &fileName,
|
Codegen::Codegen(QQmlJSImporter *importer, const QString &fileName,
|
||||||
const QStringList &qmltypesFiles, QQmlJSLogger *logger, const QString &code)
|
const QStringList &qmltypesFiles, QQmlJSLogger *logger, QQmlJSTypeInfo *typeInfo,
|
||||||
|
const QString &code)
|
||||||
: m_fileName(fileName),
|
: m_fileName(fileName),
|
||||||
m_qmltypesFiles(qmltypesFiles),
|
m_qmltypesFiles(qmltypesFiles),
|
||||||
m_importer(importer),
|
m_importer(importer),
|
||||||
m_logger(logger),
|
m_logger(logger),
|
||||||
|
m_typeInfo(typeInfo),
|
||||||
m_code(code)
|
m_code(code)
|
||||||
{
|
{
|
||||||
m_typeInfo = new QQmlJSTypeInfo;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Codegen::setDocument(QmlIR::JSCodeGen *codegen, QmlIR::Document *document)
|
void Codegen::setDocument(QmlIR::JSCodeGen *codegen, QmlIR::Document *document)
|
||||||
|
|
|
@ -57,7 +57,7 @@ class Codegen : public QQmlJSAotCompiler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Codegen(QQmlJSImporter *importer, const QString &fileName, const QStringList &qmltypesFiles,
|
Codegen(QQmlJSImporter *importer, const QString &fileName, const QStringList &qmltypesFiles,
|
||||||
QQmlJSLogger *logger, const QString &m_code);
|
QQmlJSLogger *logger, QQmlJSTypeInfo *typeInfo, const QString &m_code);
|
||||||
|
|
||||||
void setDocument(QmlIR::JSCodeGen *codegen, QmlIR::Document *document) override;
|
void setDocument(QmlIR::JSCodeGen *codegen, QmlIR::Document *document) override;
|
||||||
void setScope(const QmlIR::Object *object, const QmlIR::Object *scope) override;
|
void setScope(const QmlIR::Object *object, const QmlIR::Object *scope) override;
|
||||||
|
|
|
@ -185,7 +185,8 @@ static bool lint_file(const QString &filename, const bool silent, QJsonArray *js
|
||||||
parser.rootNode()->accept(&v);
|
parser.rootNode()->accept(&v);
|
||||||
success = v.check();
|
success = v.check();
|
||||||
|
|
||||||
Codegen codegen { &importer, filename, qmltypesFiles, &logger, code };
|
QQmlJSTypeInfo typeInfo;
|
||||||
|
Codegen codegen { &importer, filename, qmltypesFiles, &logger, &typeInfo, code };
|
||||||
QQmlJSSaveFunction saveFunction = [](const QV4::CompiledData::SaveableUnitPointer &,
|
QQmlJSSaveFunction saveFunction = [](const QV4::CompiledData::SaveableUnitPointer &,
|
||||||
const QQmlJSAotFunctionMap &,
|
const QQmlJSAotFunctionMap &,
|
||||||
QString *) { return true; };
|
QString *) { return true; };
|
||||||
|
|
Loading…
Reference in New Issue