Make Context a POD value.
authorRoberto Raggi <roberto.raggi@nokia.com>
Tue, 8 May 2012 08:34:57 +0000 (10:34 +0200)
committerRoberto Raggi <roberto.raggi@nokia.com>
Tue, 8 May 2012 08:35:09 +0000 (10:35 +0200)
qmljs_objects.cpp
qmljs_objects.h
qmljs_runtime.cpp

index 37e3537..61533b8 100644 (file)
@@ -126,11 +126,11 @@ void ScriptFunction::call(VM::Context *ctx)
     function->code(ctx);
 }
 
-Property *ArgumentsObject::getOwnProperty(String *name)
+Property *ArgumentsObject::getProperty(String *name)
 {
-    if (Property *prop = Object::getOwnProperty(name))
+    if (Property *prop = Object::getProperty(name))
         return prop;
     else if (context && context->scope)
-        return context->scope->getOwnProperty(name);
+        return context->scope->getProperty(name);
     return 0;
 }
index 17c85b0..b0109ec 100644 (file)
@@ -258,7 +258,7 @@ struct ErrorObject: Object {
 struct ArgumentsObject: Object {
     Context *context;
     ArgumentsObject(Context *context): context(context) {}
-    virtual Property *getOwnProperty(String *name);
+    virtual Property *getProperty(String *name);
 };
 
 struct Context {
@@ -270,12 +270,12 @@ struct Context {
     size_t argumentCount;
     Value result;
 
-    Context()
-        : parent(0)
-        , scope(0)
-        , arguments(0)
-        , argumentCount(0)
+    void init()
     {
+        parent = 0;
+        scope = 0;
+        arguments = 0;
+        argumentCount = 0;
         activation.type = NULL_TYPE;
         thisObject.type = NULL_TYPE;
         result.type = UNDEFINED_TYPE;
index 4870c0b..a85ef9d 100644 (file)
@@ -330,6 +330,7 @@ bool __qmljs_equal(Context *ctx, const Value *x, const Value *y)
 Context *__qmljs_new_context(Context *current, Value *thisObject, size_t argc)
 {
     Context *ctx = new Context;
+    ctx->init();
     ctx->parent = current;
     ctx->scope = current->activation.objectValue;
     __qmljs_init_object(ctx, &ctx->activation, new ArgumentsObject(ctx));