From 9b25000cb41b97c9c9f49a542c9b82cf25c032db Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 20 Oct 2017 16:11:37 +0200 Subject: Get rid of the implicit cast operator to a CallData Change-Id: I1c35fbf8f7355bc2393ae931f99e591b800f2f45 Reviewed-by: Erik Verbruggen --- src/qml/jsruntime/qv4functionobject.cpp | 4 ++-- src/qml/jsruntime/qv4globalobject.cpp | 2 +- src/qml/jsruntime/qv4jscall_p.h | 4 +++- src/qml/jsruntime/qv4runtime.cpp | 2 +- src/qml/jsruntime/qv4script.cpp | 4 ++-- src/qml/qml/qqmlboundsignal.cpp | 4 ++-- src/qml/qml/qqmljavascriptexpression.cpp | 2 +- 7 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp index e7bd4f7c06..208af838a7 100644 --- a/src/qml/jsruntime/qv4functionobject.cpp +++ b/src/qml/jsruntime/qv4functionobject.cpp @@ -74,13 +74,13 @@ static ReturnedValue jsCallWrapper(const QV4::FunctionObject *f, const Value *th { Scope scope(f->engine()); JSCallData callData(scope, f->asReturnedValue(), argv, argc, thisObject); - return f->vtable()->call(f, callData); + return f->vtable()->call(f, callData.callData(f)); } ReturnedValue jsConstructWrapper(const QV4::FunctionObject *f, const Value *argv, int argc) { Scope scope(f->engine()); JSCallData callData(scope, f->asReturnedValue(), argv, argc); - return f->vtable()->construct(f, callData); + return f->vtable()->construct(f, callData.callData(f)); } diff --git a/src/qml/jsruntime/qv4globalobject.cpp b/src/qml/jsruntime/qv4globalobject.cpp index b4c228f6b3..3c91417b0e 100644 --- a/src/qml/jsruntime/qv4globalobject.cpp +++ b/src/qml/jsruntime/qv4globalobject.cpp @@ -390,7 +390,7 @@ ReturnedValue EvalFunction::evalCall(CallData *callData, bool directCall) const JSCallData jsCall(scope, nullptr); jsCall->thisObject = scope.engine->currentStackFrame->thisObject(); jsCall->context = *ctx; - return function->call(jsCall); + return function->call(jsCall.callData()); } diff --git a/src/qml/jsruntime/qv4jscall_p.h b/src/qml/jsruntime/qv4jscall_p.h index ed75fb7475..0bb2d840da 100644 --- a/src/qml/jsruntime/qv4jscall_p.h +++ b/src/qml/jsruntime/qv4jscall_p.h @@ -103,7 +103,9 @@ struct JSCallData { return ptr; } - operator CallData *() const { + CallData *callData(const FunctionObject *f = nullptr) const { + if (f) + ptr->function = f->asReturnedValue(); return ptr; } diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp index d9c898a357..aecff0f629 100644 --- a/src/qml/jsruntime/qv4runtime.cpp +++ b/src/qml/jsruntime/qv4runtime.cpp @@ -1001,7 +1001,7 @@ ReturnedValue Runtime::method_callPossiblyDirectEval(ExecutionEngine *engine, Va FunctionObject &f = static_cast(callData->function); if (f.d() == engine->evalFunction()->d()) - return static_cast(f).evalCall(callData, true); + return static_cast(f).evalCall(callData.callData(&f), true); return f.call(&callData->thisObject, callData->args, callData->argc()); } diff --git a/src/qml/jsruntime/qv4script.cpp b/src/qml/jsruntime/qv4script.cpp index 917145c4d2..c0a00032dd 100644 --- a/src/qml/jsruntime/qv4script.cpp +++ b/src/qml/jsruntime/qv4script.cpp @@ -155,13 +155,13 @@ ReturnedValue Script::run() QV4::JSCallData jsCall(valueScope, nullptr); jsCall->thisObject = engine->globalObject; jsCall->context = *context; - return vmFunction->call(jsCall); + return vmFunction->call(jsCall.callData()); } else { Scoped qml(valueScope, qmlContext.value()); JSCallData jsCall(valueScope, nullptr); jsCall->thisObject = Primitive::undefinedValue(); jsCall->context = *qml; - return vmFunction->call(jsCall); + return vmFunction->call(jsCall.callData()); } } diff --git a/src/qml/qml/qqmlboundsignal.cpp b/src/qml/qml/qqmlboundsignal.cpp index d3b9f3886f..65af68621a 100644 --- a/src/qml/qml/qqmlboundsignal.cpp +++ b/src/qml/qml/qqmlboundsignal.cpp @@ -221,7 +221,7 @@ void QQmlBoundSignalExpression::evaluate(void **a) } } - QQmlJavaScriptExpression::evaluate(jsCall, 0); + QQmlJavaScriptExpression::evaluate(jsCall.callData(), 0); ep->dereferenceScarceResources(); // "release" scarce resources if top-level expression evaluation is complete. } @@ -243,7 +243,7 @@ void QQmlBoundSignalExpression::evaluate(const QList &args) jsCall->args[ii] = scope.engine->fromVariant(args[ii]); } - QQmlJavaScriptExpression::evaluate(jsCall, 0); + QQmlJavaScriptExpression::evaluate(jsCall.callData(), 0); ep->dereferenceScarceResources(); // "release" scarce resources if top-level expression evaluation is complete. } diff --git a/src/qml/qml/qqmljavascriptexpression.cpp b/src/qml/qml/qqmljavascriptexpression.cpp index 7081342af9..015471a13d 100644 --- a/src/qml/qml/qqmljavascriptexpression.cpp +++ b/src/qml/qml/qqmljavascriptexpression.cpp @@ -187,7 +187,7 @@ QV4::ReturnedValue QQmlJavaScriptExpression::evaluate(bool *isUndefined) QV4::Scope scope(v4); QV4::JSCallData jsCall(scope, nullptr); - return evaluate(jsCall, isUndefined); + return evaluate(jsCall.callData(), isUndefined); } QV4::ReturnedValue QQmlJavaScriptExpression::evaluate(QV4::CallData *callData, bool *isUndefined) -- cgit v1.2.3