diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-06-22 15:34:57 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2018-07-02 19:29:25 +0000 |
commit | 98263a01373f5b225d64da216537165ae27d7ff1 (patch) | |
tree | 60980c16c6cc6f6658355bcd428245819b4b732a /src/qml/jsruntime/qv4reflect.cpp | |
parent | d21ef386ece52490d428daacb8f7f4658e9f78e5 (diff) |
Unify put and putIndexed
Pass an Identifier through those virtual methods to unify
the string and integer based versions.
Also add the receiver that's required in ES7
Change-Id: I4e7f01b4c97cc80bcb3c485f6343f28213dc9e6b
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4reflect.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4reflect.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/qml/jsruntime/qv4reflect.cpp b/src/qml/jsruntime/qv4reflect.cpp index 2594f53b14..48920fd63c 100644 --- a/src/qml/jsruntime/qv4reflect.cpp +++ b/src/qml/jsruntime/qv4reflect.cpp @@ -248,17 +248,12 @@ ReturnedValue Reflect::method_set(const FunctionObject *f, const Value *, const Value undef = Primitive::undefinedValue(); const Value *index = argc > 1 ? &argv[1] : &undef; const Value &val = argc > 2 ? argv[2] : undef; + ScopedValue receiver(scope, argc >3 ? argv[3] : argv[0]); - uint n = index->asArrayIndex(); - if (n < UINT_MAX) { - bool result = o->putIndexed(n, val); - return Encode(result); - } - - ScopedStringOrSymbol name(scope, index->toPropertyKey(scope.engine)); + Scoped<StringOrSymbol> propertyKey(scope, index->toPropertyKey(scope.engine)); if (scope.engine->hasException) return false; - bool result = o->put(name, val); + bool result = o->put(propertyKey->toPropertyKey(), val, receiver); return Encode(result); } |