aboutsummaryrefslogtreecommitdiffstats
path: root/qmljs_objects.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2012-11-30 09:48:46 +0100
committerErik Verbruggen <erik.verbruggen@digia.com>2012-11-30 12:30:14 +0100
commitd63043df6fa8e8624b4ab9c7a70f320df8156a4a (patch)
tree46b6e51027635c08d253f29af128122e00bd8ebc /qmljs_objects.cpp
parentf26d5c36cff33cc8a968c87a69e9dddbb4278855 (diff)
Clean up the DeclarativeEnvironment
Add a pointer to the FunctionObject in there, and remove the duplication of the formal and local variable names. Change-Id: Id8017b3e167228292b5d351e02b8927f0bfb41eb Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Diffstat (limited to 'qmljs_objects.cpp')
-rw-r--r--qmljs_objects.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/qmljs_objects.cpp b/qmljs_objects.cpp
index 9fa63faa8d..09e937dbab 100644
--- a/qmljs_objects.cpp
+++ b/qmljs_objects.cpp
@@ -434,6 +434,10 @@ ScriptFunction::ScriptFunction(ExecutionContext *scope, IR::Function *function)
: FunctionObject(scope)
, function(function)
{
+ // global function
+ if (!scope)
+ return;
+
if (function->name)
name = scope->engine->identifier(*function->name);
needsActivation = function->needsActivation();
@@ -671,8 +675,8 @@ Value ScriptFunction::construct(VM::ExecutionContext *ctx)
PropertyDescriptor *ActivationObject::__getPropertyDescriptor__(ExecutionContext *ctx, String *name, PropertyDescriptor *to_fill)
{
if (context) {
- for (unsigned int i = 0; i < context->varCount; ++i) {
- String *var = context->vars[i];
+ for (unsigned int i = 0; i < context->variableCount(); ++i) {
+ String *var = context->variables()[i];
if (__qmljs_string_equal(var, name)) {
*to_fill = PropertyDescriptor::fromValue(context->locals[i]);
to_fill->writable = PropertyDescriptor::Set;
@@ -680,8 +684,8 @@ PropertyDescriptor *ActivationObject::__getPropertyDescriptor__(ExecutionContext
return to_fill;
}
}
- for (unsigned int i = 0; i < context->formalCount; ++i) {
- String *formal = context->formals[i];
+ for (unsigned int i = 0; i < context->formalCount(); ++i) {
+ String *formal = context->formals()[i];
if (__qmljs_string_equal(formal, name)) {
*to_fill = PropertyDescriptor::fromValue(context->arguments[i]);
to_fill->writable = PropertyDescriptor::Set;