From 751ceb0f8ff517e83c96d39a5d0b74132adb78aa Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Sat, 1 Dec 2012 19:57:26 +0100 Subject: [PATCH] Fix qmljs_call_property Change-Id: Ic32fc8815704ed201a3b50eae05ff2705372210d Reviewed-by: Simon Hausmann --- qmljs_runtime.cpp | 20 ++++++-------------- qmljs_runtime.h | 2 +- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/qmljs_runtime.cpp b/qmljs_runtime.cpp index 774676a..dcfb62d 100644 --- a/qmljs_runtime.cpp +++ b/qmljs_runtime.cpp @@ -719,23 +719,15 @@ Value __qmljs_call_activation_property(ExecutionContext *context, String *name, } } -Value __qmljs_call_property(ExecutionContext *context, Value base, String *name, Value *args, int argc) +Value __qmljs_call_property(ExecutionContext *context, Value thisObject, String *name, Value *args, int argc) { - Object *baseObject; - Value thisObject; + if (!thisObject.isObject()) + thisObject = __qmljs_to_object(thisObject, context); - if (base.isUndefined()) { - baseObject = context->activation; - thisObject = Value::nullValue(); - } else { - if (!base.isObject()) - base = __qmljs_to_object(base, context); - assert(base.isObject()); - baseObject = base.objectValue(); - thisObject = base; - } + assert(thisObject.isObject()); + Object *baseObject = base.objectValue(); - Value func = baseObject ? baseObject->__get__(context, name) : Value::undefinedValue(); + Value func = baseObject->__get__(context, name); return callFunction(context, thisObject, func.asFunctionObject(), args, argc); } diff --git a/qmljs_runtime.h b/qmljs_runtime.h index 2df8dd1..d6a7839 100644 --- a/qmljs_runtime.h +++ b/qmljs_runtime.h @@ -92,7 +92,7 @@ extern "C" { // context Value __qmljs_call_activation_property(ExecutionContext *, String *name, Value *args, int argc); -Value __qmljs_call_property(ExecutionContext *context, Value base, String *name, Value *args, int argc); +Value __qmljs_call_property(ExecutionContext *context, Value thisObject, String *name, Value *args, int argc); Value __qmljs_call_value(ExecutionContext *context, Value thisObject, Value func, Value *args, int argc); Value __qmljs_construct_activation_property(ExecutionContext *, String *name, Value *args, int argc); -- 2.7.4