aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmlcompiler/qqmljscompiler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qmlcompiler/qqmljscompiler.cpp')
-rw-r--r--src/qmlcompiler/qqmljscompiler.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/qmlcompiler/qqmljscompiler.cpp b/src/qmlcompiler/qqmljscompiler.cpp
index bba2aeb310..a3c78f2fbc 100644
--- a/src/qmlcompiler/qqmljscompiler.cpp
+++ b/src/qmlcompiler/qqmljscompiler.cpp
@@ -230,19 +230,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;
@@ -263,6 +257,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
auto contextMap = v4CodeGen.module()->contextMap;
@@ -345,7 +345,8 @@ bool qCompileQmlFile(QmlIR::Document &irDocument, const QString &inputFileName,
<< diagnosticErrorMessage(inputFileName, *error);
} else if (auto *func = std::get_if<QQmlJSAotFunction>(&result)) {
qCDebug(lcAotCompiler) << "Generated code:" << func->code;
- aotFunctionsByIndex[runtimeFunctionIndices[bindingOrFunction.index()]] = *func;
+ aotFunctionsByIndex[object->runtimeFunctionIndices[bindingOrFunction.index()]] =
+ *func;
}
});
}