diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2019-05-07 12:47:33 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2019-05-16 12:09:23 +0000 |
commit | 7f7d87c68da4cb29b2b2b9c324c6863228da0c26 (patch) | |
tree | 727a7b7483fe5322984e3068b9cd8696a98efe4b /src/qml/compiler/qv4codegen.cpp | |
parent | cf2bf011ae0f33bed963d088f8267746a3369c4c (diff) |
Split CompiledData::CompilationUnit in two
We need a CompilationUnit that only holds the data needed for
compilation and another one that is executable by the runtime.
Change-Id: I704d859ba028576a18460f5e3a59f210f64535d3
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4codegen.cpp')
-rw-r--r-- | src/qml/compiler/qv4codegen.cpp | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp index edd479a0bd..d17d58588c 100644 --- a/src/qml/compiler/qv4codegen.cpp +++ b/src/qml/compiler/qv4codegen.cpp @@ -3783,26 +3783,14 @@ QList<QQmlJS::DiagnosticMessage> Codegen::errors() const return _errors; } -QQmlRefPointer<CompiledData::CompilationUnit> Codegen::generateCompilationUnit(bool generateUnitData) +QV4::CompiledData::CompilationUnit Codegen::generateCompilationUnit( + bool generateUnitData) { - CompiledData::Unit *unitData = nullptr; - if (generateUnitData) - unitData = jsUnitGenerator->generateUnit(); - CompiledData::CompilationUnit *compilationUnit = new CompiledData::CompilationUnit(unitData); - - QQmlRefPointer<CompiledData::CompilationUnit> unit; - unit.adopt(compilationUnit); - return unit; -} - -QQmlRefPointer<CompiledData::CompilationUnit> Codegen::createUnitForLoading() -{ - QQmlRefPointer<CompiledData::CompilationUnit> result; - result.adopt(new CompiledData::CompilationUnit); - return result; + return QV4::CompiledData::CompilationUnit( + generateUnitData ? jsUnitGenerator->generateUnit() : nullptr); } -QQmlRefPointer<CompiledData::CompilationUnit> Codegen::compileModule( +CompiledData::CompilationUnit Codegen::compileModule( bool debugMode, const QString &url, const QString &sourceCode, const QDateTime &sourceTimeStamp, QList<QQmlJS::DiagnosticMessage> *diagnostics) { @@ -3817,7 +3805,7 @@ QQmlRefPointer<CompiledData::CompilationUnit> Codegen::compileModule( *diagnostics = parser.diagnosticMessages(); if (!parsed) - return nullptr; + return CompiledData::CompilationUnit(); QQmlJS::AST::ESModule *moduleNode = QQmlJS::AST::cast<QQmlJS::AST::ESModule*>(parser.rootNode()); if (!moduleNode) { @@ -3840,7 +3828,7 @@ QQmlRefPointer<CompiledData::CompilationUnit> Codegen::compileModule( *diagnostics << errors; if (!errors.isEmpty()) - return nullptr; + return CompiledData::CompilationUnit(); return cg.generateCompilationUnit(); } |