From 2b16365d6fa9a22786ec12d2d6387f3eb19a193b Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Wed, 9 May 2012 17:04:25 +0200 Subject: [PATCH] Fix function calls --- qmljs_runtime.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/qmljs_runtime.cpp b/qmljs_runtime.cpp index 305362c..49380d0 100644 --- a/qmljs_runtime.cpp +++ b/qmljs_runtime.cpp @@ -378,16 +378,22 @@ void __qmljs_call_activation_property(Context *context, Value *result, String *n void __qmljs_call_property(Context *context, Value *result, Value *base, String *name) { + Value baseObject; + Value thisObject; + if (base) { + if (baseObject.type != OBJECT_TYPE) + __qmljs_to_object(context, &baseObject, base); + thisObject = baseObject; + } else { + baseObject = context->activation; + __qmljs_init_null(context, &thisObject); + } + assert(baseObject.type == OBJECT_TYPE); Value func; - Value thisObject = *base; - if (thisObject.type != OBJECT_TYPE) - __qmljs_to_object(context, &thisObject, base); - - assert(thisObject.type == OBJECT_TYPE); - thisObject.objectValue->get(name, &func); + baseObject.objectValue->get(name, &func); if (func.type == OBJECT_TYPE) { if (FunctionObject *f = func.objectValue->asFunctionObject()) { - __qmljs_init_null(context, &context->thisObject); + context->thisObject = thisObject; context->formals = f->formalParameterList; context->formalCount = f->formalParameterCount; f->call(context); -- 2.7.4