Fix a bug in Object::__put__()
authorLars Knoll <lars.knoll@digia.com>
Tue, 27 Nov 2012 23:12:33 +0000 (00:12 +0100)
committerErik Verbruggen <erik.verbruggen@digia.com>
Wed, 28 Nov 2012 09:00:02 +0000 (10:00 +0100)
The method was always throwing in strict mode, due to
a missing return statement.

Change-Id: I85e44f8067d1f2aea76d03e42abf31a0d5a2d180
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
qmljs_objects.cpp
qmljs_objects.h

index 35bea07..a7d5d20 100644 (file)
@@ -165,7 +165,7 @@ bool Object::__canPut__(ExecutionContext *ctx, String *name)
 }
 
 // Section 8.12.5
-void Object::__put__(ExecutionContext *ctx, String *name, const Value &value)
+void Object::__put__(ExecutionContext *ctx, String *name, Value value)
 {
     // clause 1
     if (!__canPut__(ctx, name))
@@ -207,6 +207,7 @@ void Object::__put__(ExecutionContext *ctx, String *name, const Value &value)
         p->configurable = PropertyDescriptor::Set;
         p->enumberable = PropertyDescriptor::Set;
         p->writable = PropertyDescriptor::Set;
+        return;
     }
 
   reject:
index 45e301c..25790f4 100644 (file)
@@ -408,7 +408,7 @@ struct Object {
     virtual Value __get__(ExecutionContext *ctx, String *name);
     virtual PropertyDescriptor *__getOwnProperty__(ExecutionContext *ctx, String *name);
     virtual PropertyDescriptor *__getPropertyDescriptor__(ExecutionContext *ctx, String *name, PropertyDescriptor *to_fill);
-    virtual void __put__(ExecutionContext *ctx, String *name, const Value &value);
+    virtual void __put__(ExecutionContext *ctx, String *name, Value value);
     virtual bool __canPut__(ExecutionContext *ctx, String *name);
     virtual bool __hasProperty__(ExecutionContext *ctx, String *name) const;
     virtual bool __delete__(ExecutionContext *ctx, String *name);