diff options
| author | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2023-10-03 14:55:01 +0300 |
|---|---|---|
| committer | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2023-10-03 14:55:01 +0300 |
| commit | eca36baf3d8c6c52509f487f75dc7c46bd63e73c (patch) | |
| tree | 408acf2cc6d3227a82e2f2765bc6ad71e3bff5c7 /src/qmlcompiler/qqmljscompiler.cpp | |
| parent | 4a6dfcd838a62ed7b3500326af6099c00a5cbf49 (diff) | |
| parent | b65d9135ebd43d5bf3cc882a94230a305893fd6a (diff) | |
Merge remote-tracking branch 'origin/tqtc/lts-6.2.7' into tqtc/lts-6.2-opensource
Change-Id: Ib72ded968b7ac6b75b499392162e3cf3b761ec48
Diffstat (limited to 'src/qmlcompiler/qqmljscompiler.cpp')
| -rw-r--r-- | src/qmlcompiler/qqmljscompiler.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/qmlcompiler/qqmljscompiler.cpp b/src/qmlcompiler/qqmljscompiler.cpp index c9e513ded4..e8900a0d69 100644 --- a/src/qmlcompiler/qqmljscompiler.cpp +++ b/src/qmlcompiler/qqmljscompiler.cpp @@ -238,18 +238,13 @@ bool qCompileQmlFile(QmlIR::Document &irDocument, const QString &inputFileName, for (QmlIR::Object *object: qAsConst(irDocument.objects)) { if (object->functionsAndExpressions->count == 0 && object->bindingCount() == 0) continue; - QList<QmlIR::CompiledFunctionOrExpression> functionsToCompile; - for (QmlIR::CompiledFunctionOrExpression *foe = object->functionsAndExpressions->first; foe; foe = foe->next) - functionsToCompile << *foe; - const QVector<int> runtimeFunctionIndices = v4CodeGen.generateJSCodeForFunctionsAndBindings(functionsToCompile); - if (v4CodeGen.hasError()) { + + if (!v4CodeGen.generateRuntimeFunctions(object)) { + Q_ASSERT(v4CodeGen.hasError()); error->appendDiagnostic(inputFileName, v4CodeGen.error()); return false; } - QQmlJS::MemoryPool *pool = irDocument.jsParserEngine.pool(); - object->runtimeFunctionIndices.allocate(pool, runtimeFunctionIndices); - if (!aotCompiler) continue; @@ -270,6 +265,12 @@ bool qCompileQmlFile(QmlIR::Document &irDocument, const QString &inputFileName, std::copy(object->functionsBegin(), object->functionsEnd(), std::back_inserter(bindingsAndFunctions)); + QList<QmlIR::CompiledFunctionOrExpression> functionsToCompile; + for (QmlIR::CompiledFunctionOrExpression *foe = object->functionsAndExpressions->first; + foe; foe = foe->next) { + functionsToCompile << *foe; + } + // AOT-compile bindings and functions in the same order as above so that the runtime // class indices match std::sort(bindingsAndFunctions.begin(), bindingsAndFunctions.end()); @@ -326,7 +327,8 @@ bool qCompileQmlFile(QmlIR::Document &irDocument, const QString &inputFileName, << diagnosticErrorMessage(inputFileName, *error); } else if (auto *func = std::get_if<QQmlJSAotFunction>(&result)) { qCInfo(lcAotCompiler) << "Generated code:" << func->code; - aotFunctionsByIndex[runtimeFunctionIndices[bindingOrFunction.index()]] = *func; + aotFunctionsByIndex[object->runtimeFunctionIndices[bindingOrFunction.index()]] = + *func; } }); } |
