diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-08-30 13:16:28 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2018-08-31 06:08:48 +0000 |
commit | ac3a9fd8f352b1d717334d16111d22d6c155e4e2 (patch) | |
tree | 17c12dbc09143103d060da062a5d9102d7c50f57 /src/qml/jsruntime/qv4generatorobject.cpp | |
parent | d457b919885fdbcc07f3414de64b0b50ebe8b263 (diff) |
Fix super property access
Super properties work in a rather special way by
accessing a 'home object' on the function object,
and reading from it's prototype.
Change-Id: I666334c9c27048c6c2ba6770dd8c9f56aecbee14
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4generatorobject.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4generatorobject.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/qml/jsruntime/qv4generatorobject.cpp b/src/qml/jsruntime/qv4generatorobject.cpp index bab0cfbfb1..82d8d88882 100644 --- a/src/qml/jsruntime/qv4generatorobject.cpp +++ b/src/qml/jsruntime/qv4generatorobject.cpp @@ -230,13 +230,19 @@ ReturnedValue GeneratorObject::resume(ExecutionEngine *engine, const Value &arg) DEFINE_OBJECT_VTABLE(MemberGeneratorFunction); -Heap::FunctionObject *MemberGeneratorFunction::create(ExecutionContext *context, Function *function, String *name) +Heap::FunctionObject *MemberGeneratorFunction::create(ExecutionContext *context, Function *function, Object *homeObject, String *name) { Scope scope(context); - Scoped<GeneratorFunction> g(scope, context->engine()->memoryManager->allocate<MemberGeneratorFunction>(context, function, name)); + Scoped<MemberGeneratorFunction> g(scope, context->engine()->memoryManager->allocate<MemberGeneratorFunction>(context, function, name)); + g->d()->homeObject.set(scope.engine, homeObject->d()); ScopedObject proto(scope, scope.engine->newObject()); proto->setPrototypeOf(scope.engine->generatorPrototype()); g->defineDefaultProperty(scope.engine->id_prototype(), proto, Attr_NotConfigurable|Attr_NotEnumerable); g->setPrototypeOf(ScopedObject(scope, scope.engine->generatorFunctionCtor()->get(scope.engine->id_prototype()))); return g->d(); } + +ReturnedValue MemberGeneratorFunction::virtualCall(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc) +{ + return GeneratorFunction::virtualCall(f, thisObject, argv, argc); +} |