diff options
Diffstat (limited to 'src/qml/jsruntime/qv4functionobject_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4functionobject_p.h | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/qml/jsruntime/qv4functionobject_p.h b/src/qml/jsruntime/qv4functionobject_p.h index 8a2c84a8f6..b08b333411 100644 --- a/src/qml/jsruntime/qv4functionobject_p.h +++ b/src/qml/jsruntime/qv4functionobject_p.h @@ -77,7 +77,8 @@ DECLARE_HEAP_OBJECT(FunctionObject, Object) { DECLARE_MARKOBJECTS(FunctionObject); enum { Index_ProtoConstructor = 0, - Index_Prototype = 0 + Index_Prototype = 0, + Index_HasInstance = 1, }; bool isConstructor() const { @@ -112,7 +113,7 @@ struct IndexedBuiltinFunction : FunctionObject { struct ArrowFunction : FunctionObject { enum { - Index_Name = Index_Prototype + 1, + Index_Name = Index_HasInstance + 1, Index_Length }; void init(QV4::ExecutionContext *scope, Function *function, QV4::String *name = nullptr); @@ -214,8 +215,12 @@ struct Q_QML_EXPORT FunctionObject: Object { ReturnedValue getHomeObject() const; - ReturnedValue protoProperty() const { return get(engine()->id_prototype()); } - + ReturnedValue protoProperty() const { + return getValueByIndex(Heap::FunctionObject::Index_Prototype); + } + bool hasHasInstanceProperty() const { + return !internalClass()->propertyData.at(Heap::FunctionObject::Index_HasInstance).isEmpty(); + } QQmlSourceLocation sourceLocation() const; }; @@ -316,6 +321,12 @@ struct BoundFunction: FunctionObject { static ReturnedValue virtualCall(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc); }; +inline bool FunctionObject::isBoundFunction() const +{ + return d()->vtable() == BoundFunction::staticVTable(); +} + + } QT_END_NAMESPACE |