From f15cc9f1df8e17f049c111e3147d6c63c07eb756 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Sat, 18 Aug 2018 15:26:45 +0200 Subject: Implement IsConstructor for Function objects Use the jsConstruct member in the function object for this and set it to a nullptr for methods that are not a constructor. Change-Id: I63d2971b23b2596a8e3b6d2781f0d9ed3208693b Reviewed-by: Simon Hausmann --- src/qml/jsruntime/qv4jscall_p.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/qml/jsruntime/qv4jscall_p.h') diff --git a/src/qml/jsruntime/qv4jscall_p.h b/src/qml/jsruntime/qv4jscall_p.h index 307eec9111..55cedf50aa 100644 --- a/src/qml/jsruntime/qv4jscall_p.h +++ b/src/qml/jsruntime/qv4jscall_p.h @@ -102,15 +102,13 @@ struct JSCallData { inline ReturnedValue FunctionObject::callAsConstructor(const JSCallData &data) const { - if (!d()->jsConstruct) - return engine()->throwTypeError(QStringLiteral("Object is not a constructor.")); - return d()->jsConstruct(this, data.args, data.argc, this); + return callAsConstructor(data.args, data.argc, this); } inline ReturnedValue FunctionObject::call(const JSCallData &data) const { - return d()->jsCall(this, data.thisObject, data.args, data.argc); + return call(data.thisObject, data.args, data.argc); } -- cgit v1.2.3