aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4codegen.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2023-12-21 13:25:11 +0100
committerUlf Hermann <ulf.hermann@qt.io>2024-01-10 11:22:29 +0100
commitcfdc612c3022b3f35545fd5e4e0bcd2661f657f1 (patch)
tree9630e15a9e8ea709cb8e1a9a0f004f1f7c785e7e /src/qml/compiler/qv4codegen.cpp
parentd85de8da6011731e3ff31ae1361e71fecaedb0be (diff)
QtQml: Make base CU a member of ExecutableCompilationUnit
We want to re-use the base compilation unit across engines. For that to work it cannot be a slice of the engine-specific ExecutableCompilationUnit. Since CompiledData::CompilationUnit is refcounted on its own now, make it unmovable. Change-Id: I8418c9754d7a07e5210c1e7a7fc69355e1d57807 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4codegen.cpp')
-rw-r--r--src/qml/compiler/qv4codegen.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp
index 580406db86..7c312d9a3e 100644
--- a/src/qml/compiler/qv4codegen.cpp
+++ b/src/qml/compiler/qv4codegen.cpp
@@ -4129,14 +4129,16 @@ QQmlJS::DiagnosticMessage Codegen::error() const
return _error;
}
-QV4::CompiledData::CompilationUnit Codegen::generateCompilationUnit(
+QQmlRefPointer<QV4::CompiledData::CompilationUnit> Codegen::generateCompilationUnit(
bool generateUnitData)
{
- return QV4::CompiledData::CompilationUnit(
- generateUnitData ? jsUnitGenerator->generateUnit() : nullptr);
+ return QQmlRefPointer<QV4::CompiledData::CompilationUnit>(
+ new QV4::CompiledData::CompilationUnit(
+ generateUnitData ? jsUnitGenerator->generateUnit() : nullptr),
+ QQmlRefPointer<QV4::CompiledData::CompilationUnit>::Adopt);
}
-CompiledData::CompilationUnit Codegen::compileModule(
+QQmlRefPointer<QV4::CompiledData::CompilationUnit> Codegen::compileModule(
bool debugMode, const QString &url, const QString &sourceCode,
const QDateTime &sourceTimeStamp, QList<QQmlJS::DiagnosticMessage> *diagnostics)
{
@@ -4151,7 +4153,7 @@ CompiledData::CompilationUnit Codegen::compileModule(
*diagnostics = parser.diagnosticMessages();
if (!parsed)
- return CompiledData::CompilationUnit();
+ return QQmlRefPointer<CompiledData::CompilationUnit>();
QQmlJS::AST::ESModule *moduleNode = QQmlJS::AST::cast<QQmlJS::AST::ESModule*>(parser.rootNode());
if (!moduleNode) {
@@ -4172,7 +4174,7 @@ CompiledData::CompilationUnit Codegen::compileModule(
if (cg.hasError()) {
if (diagnostics)
*diagnostics << cg.error();
- return CompiledData::CompilationUnit();
+ return QQmlRefPointer<CompiledData::CompilationUnit>();
}
return cg.generateCompilationUnit();