aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4jscall_p.h
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2021-05-17 15:15:41 +0200
committerUlf Hermann <ulf.hermann@qt.io>2021-05-20 15:46:21 +0200
commit3a4e013f0058952c94ed3414aafbf96216efff8d (patch)
treeaef9c33c9fda191b7c4ac1a4f56181a4a702990d /src/qml/jsruntime/qv4jscall_p.h
parent5bb746520db70b09de463f0ce27ecfbe3e5dfb4f (diff)
Do QMetaType-style call in QQmlPropertyBinding::evaluate
We already have a void* and metatype available. There is no need to convert, unless we have bound arguments. The call() itself will convert as necessary anyway. However, we do need to figure out whether the returned value was undefined. Pass this information up from the actual call. Change-Id: Icfa69e946adf80d18110a158f5bab906674b7381 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'src/qml/jsruntime/qv4jscall_p.h')
-rw-r--r--src/qml/jsruntime/qv4jscall_p.h12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/qml/jsruntime/qv4jscall_p.h b/src/qml/jsruntime/qv4jscall_p.h
index 3f0c8ee06d..c6d320ac20 100644
--- a/src/qml/jsruntime/qv4jscall_p.h
+++ b/src/qml/jsruntime/qv4jscall_p.h
@@ -206,7 +206,7 @@ ReturnedValue convertAndCall(
}
template<typename Callable>
-void convertAndCall(ExecutionEngine *engine, const Value *thisObject,
+bool convertAndCall(ExecutionEngine *engine, const Value *thisObject,
void **a, const QMetaType *types, int argc, Callable call)
{
Scope scope(engine);
@@ -215,13 +215,10 @@ void convertAndCall(ExecutionEngine *engine, const Value *thisObject,
for (int ii = 0; ii < argc; ++ii)
jsCallData.args[ii] = engine->metaTypeToJS(types[ii + 1], a[ii + 1]);
- void *result = a[0];
- if (!result) {
- call(thisObject, jsCallData.args, argc);
- return;
- }
-
ScopedValue jsResult(scope, call(thisObject, jsCallData.args, argc));
+ void *result = a[0];
+ if (!result)
+ return !jsResult->isUndefined();
const QMetaType resultType = types[0];
if (scope.hasException()) {
@@ -237,6 +234,7 @@ void convertAndCall(ExecutionEngine *engine, const Value *thisObject,
scope.engine->metaTypeFromJS(jsResult, resultType, result);
}
}
+ return !jsResult->isUndefined();
}
}