Implement another method in the v8 API
authorLars Knoll <lars.knoll@digia.com>
Wed, 13 Mar 2013 21:50:00 +0000 (17:50 -0400)
committerSimon Hausmann <simon.hausmann@digia.com>
Wed, 13 Mar 2013 21:51:05 +0000 (22:51 +0100)
Change-Id: I54918914a8c9b395211ccbff891a90ab069be4a5
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
src/v4/qv4v8.cpp

index fa98efe..7290c46 100644 (file)
@@ -799,8 +799,19 @@ bool Object::Set(Handle<Value> key, Handle<Value> value, PropertyAttribute attri
 
 bool Object::Set(uint32_t index, Handle<Value> value)
 {
-    Q_UNIMPLEMENTED();
-    Q_UNREACHABLE();
+    QQmlJS::VM::Object *o = ConstValuePtr(this)->asObject();
+    assert(o);
+    QQmlJS::VM::ExecutionContext *ctx = currentEngine()->current;
+    bool result = true;
+    try {
+        o->putIndexed(ctx, index, *ValuePtr(&value));
+        // ### attribs
+    } catch (VM::Exception &e) {
+        Isolate::GetCurrent()->setException(e.value());
+        e.accept(ctx);
+        result = false;
+    }
+    return result;
 }
 
 Local<Value> Object::Get(Handle<Value> key)