diff options
author | Lars Knoll <[email protected]> | 2018-08-30 13:16:28 +0200 |
---|---|---|
committer | Lars Knoll <[email protected]> | 2018-08-31 06:08:48 +0000 |
commit | ac3a9fd8f352b1d717334d16111d22d6c155e4e2 (patch) | |
tree | 17c12dbc09143103d060da062a5d9102d7c50f57 /src/qml/jsruntime/qv4functionobject_p.h | |
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 <[email protected]>
Diffstat (limited to 'src/qml/jsruntime/qv4functionobject_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4functionobject_p.h | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/src/qml/jsruntime/qv4functionobject_p.h b/src/qml/jsruntime/qv4functionobject_p.h index 54964b9bbd..766960d2ac 100644 --- a/src/qml/jsruntime/qv4functionobject_p.h +++ b/src/qml/jsruntime/qv4functionobject_p.h @@ -122,13 +122,16 @@ DECLARE_HEAP_OBJECT(ScriptFunction, FunctionObject) { void init(QV4::ExecutionContext *scope, Function *function, QV4::String *name = nullptr); }; -struct ConstructorFunction : ScriptFunction -{ - bool isDerivedConstructor; +#define MemberFunctionMembers(class, Member) \ + Member(class, Pointer, Object *, homeObject) + +DECLARE_HEAP_OBJECT(MemberFunction, ScriptFunction) { + DECLARE_MARKOBJECTS(MemberFunction) }; -struct MemberFunction : ScriptFunction +struct ConstructorFunction : MemberFunction { + bool isDerivedConstructor; }; struct DefaultClassConstructorFunction : FunctionObject @@ -187,8 +190,8 @@ struct Q_QML_EXPORT FunctionObject: Object { static ReturnedValue virtualCall(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc); static Heap::FunctionObject *createScriptFunction(ExecutionContext *scope, Function *function); - static Heap::FunctionObject *createConstructorFunction(ExecutionContext *scope, Function *function, bool isDerivedConstructor); - static Heap::FunctionObject *createMemberFunction(ExecutionContext *scope, Function *function, String *name); + static Heap::FunctionObject *createConstructorFunction(ExecutionContext *scope, Function *function, Object *homeObject, bool isDerivedConstructor); + static Heap::FunctionObject *createMemberFunction(ExecutionContext *scope, Function *function, Object *homeObject, String *name); static Heap::FunctionObject *createBuiltinFunction(ExecutionEngine *engine, StringOrSymbol *nameOrSymbol, VTable::Call code, int argumentCount); bool strictMode() const { return d()->function ? d()->function->isStrict() : false; } @@ -261,18 +264,17 @@ struct ScriptFunction : FunctionObject { Heap::InternalClass *classForConstructor() const; }; -struct ConstructorFunction : ScriptFunction { - V4_OBJECT2(ConstructorFunction, ScriptFunction) - V4_INTERNALCLASS(ConstructorFunction) - static ReturnedValue virtualCallAsConstructor(const FunctionObject *, const Value *argv, int argc, const Value *); - static ReturnedValue virtualCall(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc); -}; - struct MemberFunction : ScriptFunction { V4_OBJECT2(MemberFunction, ScriptFunction) V4_INTERNALCLASS(MemberFunction) }; +struct ConstructorFunction : MemberFunction { + V4_OBJECT2(ConstructorFunction, MemberFunction) + V4_INTERNALCLASS(ConstructorFunction) + static ReturnedValue virtualCallAsConstructor(const FunctionObject *, const Value *argv, int argc, const Value *); + static ReturnedValue virtualCall(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc); +}; struct DefaultClassConstructorFunction : FunctionObject { V4_OBJECT2(DefaultClassConstructorFunction, FunctionObject) |