diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2020-11-11 12:30:33 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-11-11 12:42:22 +0100 |
commit | 2940a57decc2433d2c0549c80d94801df6af686b (patch) | |
tree | ae88df4524fe8e700e662aac9f62b03b29a39409 /src/qmlcompiler/qqmljscompiler.cpp | |
parent | df175003e9a77c62c6e0bb45db3274a23ec854d4 (diff) | |
download | qtdeclarative-2940a57decc2433d2c0549c80d94801df6af686b.tar.gz |
QmlCompiler: Allow AOT compilation of JS functions
Previously, only bindings were compiled.
Change-Id: I6e76c3f5e628e60538a0ed754fdd915978b88c1d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qmlcompiler/qqmljscompiler.cpp')
-rw-r--r-- | src/qmlcompiler/qqmljscompiler.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/qmlcompiler/qqmljscompiler.cpp b/src/qmlcompiler/qqmljscompiler.cpp index 938d1d68d6..6412f47d38 100644 --- a/src/qmlcompiler/qqmljscompiler.cpp +++ b/src/qmlcompiler/qqmljscompiler.cpp @@ -243,6 +243,21 @@ bool qCompileQmlFile(const QString &inputFileName, QQmlJSSaveFunction saveFuncti aotFunctionsByIndex[runtimeFunctionIndices[binding.value.compiledScriptIndex]] = *func; } }); + + std::for_each(object->functionsBegin(), object->functionsEnd(), + [&](const QmlIR::Function &function) { + + qCDebug(lcAotCompiler) << "Compiling function" + << irDocument.stringAt(function.nameIndex); + auto result = aotCompiler->compileFunction(function); + if (auto *error = std::get_if<QQmlJS::DiagnosticMessage>(&result)) { + qCDebug(lcAotCompiler) << "Could not compile function:" + << diagnosticErrorMessage(inputFileName, *error); + } else if (auto *func = std::get_if<QQmlJSAotFunction>(&result)) { + qCInfo(lcAotCompiler) << "Generated code:" << func->code; + aotFunctionsByIndex[runtimeFunctionIndices[function.index]] = *func; + } + }); } if (!checkArgumentsObjectUseInSignalHandlers(irDocument, error)) { |