diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-06-26 14:18:16 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2018-07-03 08:08:39 +0000 |
commit | 65e799a9dec58b4bde3a085149f8cbcf0f5f3fba (patch) | |
tree | 4a9473532f420d8f20fc34af60bf1f132d459b82 /src/qml/jsruntime/qv4functionobject_p.h | |
parent | 61440411a979c7c317bafccfbf5201d969819a06 (diff) |
Implement support for new.target
Support the new.target meta property in the codegen, and
add support for passing the newtarget into the constructor
vtable methods and the execution context.
Change-Id: I62ea58e5e92d894035a76e35776203e9837c383b
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4functionobject_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4functionobject_p.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/qml/jsruntime/qv4functionobject_p.h b/src/qml/jsruntime/qv4functionobject_p.h index 2cfc6fc764..d2af7fa432 100644 --- a/src/qml/jsruntime/qv4functionobject_p.h +++ b/src/qml/jsruntime/qv4functionobject_p.h @@ -169,14 +169,14 @@ struct Q_QML_EXPORT FunctionObject: Object { void createDefaultPrototypeProperty(uint protoSlot, uint protoConstructorSlot); inline ReturnedValue callAsConstructor(const JSCallData &data) const; - ReturnedValue callAsConstructor(const Value *argv, int argc) const { - return d()->jsConstruct(this, argv, argc); + ReturnedValue callAsConstructor(const Value *argv, int argc, const Value *newTarget = nullptr) const { + return d()->jsConstruct(this, argv, argc, newTarget ? newTarget : this); } inline ReturnedValue call(const JSCallData &data) const; ReturnedValue call(const Value *thisObject, const Value *argv, int argc) const { return d()->jsCall(this, thisObject, argv, argc); } - static ReturnedValue virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc); + static ReturnedValue virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc, const Value *); static ReturnedValue virtualCall(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc); static Heap::FunctionObject *createScriptFunction(ExecutionContext *scope, Function *function); @@ -201,7 +201,7 @@ struct FunctionCtor: FunctionObject { V4_OBJECT2(FunctionCtor, FunctionObject) - static ReturnedValue virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc); + static ReturnedValue virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc, const Value *); static ReturnedValue virtualCall(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc); protected: enum Type { @@ -243,7 +243,7 @@ struct ScriptFunction : FunctionObject { V4_INTERNALCLASS(ScriptFunction) enum { NInlineProperties = 3 }; - static ReturnedValue virtualCallAsConstructor(const FunctionObject *, const Value *argv, int argc); + 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); Heap::InternalClass *classForConstructor() const; @@ -258,13 +258,13 @@ struct ConstructorFunction : ScriptFunction { struct MemberFunction : ScriptFunction { V4_OBJECT2(MemberFunction, ScriptFunction) V4_INTERNALCLASS(MemberFunction) - static ReturnedValue virtualCallAsConstructor(const FunctionObject *, const Value *argv, int argc); + static ReturnedValue virtualCallAsConstructor(const FunctionObject *, const Value *argv, int argc, const Value *); }; struct DefaultClassConstructorFunction : FunctionObject { V4_OBJECT2(DefaultClassConstructorFunction, FunctionObject) - static ReturnedValue virtualCallAsConstructor(const FunctionObject *, const Value *argv, int argc); + 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); }; @@ -280,7 +280,7 @@ struct BoundFunction: FunctionObject { Value boundThis() const { return d()->boundThis; } Heap::MemberData *boundArgs() const { return d()->boundArgs; } - static ReturnedValue virtualCallAsConstructor(const FunctionObject *, const Value *argv, int argc); + 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); }; |