summaryrefslogtreecommitdiff
path: root/src/qml/jsruntime/qv4function.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2022-09-27 14:13:57 +0200
committerUlf Hermann <ulf.hermann@qt.io>2022-09-29 18:19:06 +0200
commit4bc3f64b0edc5f097ca7cad4a89a535db67aa266 (patch)
tree7aceecf29a4347167db3ce1572c7bf5e456f6272 /src/qml/jsruntime/qv4function.cpp
parent435d587e74ee7a726ccc29e137cd0032a16383b2 (diff)
downloadqtdeclarative-4bc3f64b0edc5f097ca7cad4a89a535db67aa266.tar.gz
V4: Use an enum to categorize functions and rename aotFunction
We want to use the aotFunction member also for typed JavaScript functions. Change-Id: Iad6d12ebed3ad3069832484137ed8e4d9e7a7cf4 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4function.cpp')
-rw-r--r--src/qml/jsruntime/qv4function.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/qml/jsruntime/qv4function.cpp b/src/qml/jsruntime/qv4function.cpp
index e9cececbdd..666bd3a0de 100644
--- a/src/qml/jsruntime/qv4function.cpp
+++ b/src/qml/jsruntime/qv4function.cpp
@@ -22,7 +22,7 @@ using namespace QV4;
bool Function::call(QObject *thisObject, void **a, const QMetaType *types, int argc,
ExecutionContext *context)
{
- if (!aotFunction) {
+ if (kind != AotCompiled) {
return QV4::convertAndCall(
context->engine(), thisObject, a, types, argc,
[this, context](const Value *thisObject, const Value *argv, int argc) {
@@ -41,9 +41,9 @@ bool Function::call(QObject *thisObject, void **a, const QMetaType *types, int a
ReturnedValue Function::call(
const Value *thisObject, const Value *argv, int argc, ExecutionContext *context) {
- if (aotFunction) {
+ if (kind == AotCompiled) {
return QV4::convertAndCall(
- context->engine(), aotFunction, thisObject, argv, argc,
+ context->engine(), typedFunction, thisObject, argv, argc,
[this, context](QObject *thisObject,
void **a, const QMetaType *types, int argc) {
call(thisObject, a, types, argc, context);
@@ -64,7 +64,7 @@ ReturnedValue Function::call(
Function *Function::create(ExecutionEngine *engine, ExecutableCompilationUnit *unit,
const CompiledData::Function *function,
- const QQmlPrivate::AOTCompiledFunction *aotFunction)
+ const QQmlPrivate::TypedFunction *aotFunction)
{
return new Function(engine, unit, function, aotFunction);
}
@@ -76,13 +76,14 @@ void Function::destroy()
Function::Function(ExecutionEngine *engine, ExecutableCompilationUnit *unit,
const CompiledData::Function *function,
- const QQmlPrivate::AOTCompiledFunction *aotFunction)
+ const QQmlPrivate::TypedFunction *aotFunction)
: FunctionData(unit)
, compiledFunction(function)
, codeData(function->code())
, jittedCode(nullptr)
, codeRef(nullptr)
- , aotFunction(aotFunction)
+ , typedFunction(aotFunction)
+ , kind(aotFunction ? AotCompiled : JsUntyped)
{
Scope scope(engine);
Scoped<InternalClass> ic(scope, engine->internalClasses(EngineBase::Class_CallContext));