diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-04-26 11:48:04 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2018-05-02 14:20:21 +0000 |
commit | c7fe748850383c5afcc18acf5568be0badd95c93 (patch) | |
tree | 99d5fc744b154b879496822a655859d491327224 /src/qml/jsruntime/qv4object_p.h | |
parent | 440a25388b55d465873647b3dc9f470ed68e917e (diff) |
Cleanup creation code for builtin functions
Centralize the code in FunctionObject::createBuiltinFunction and setup
function names and length properties there.
Change-Id: I21f1d42b475070ee091d96d97387149af1dc47f2
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4object_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4object_p.h | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/qml/jsruntime/qv4object_p.h b/src/qml/jsruntime/qv4object_p.h index 15d42e8098..44ad35b44b 100644 --- a/src/qml/jsruntime/qv4object_p.h +++ b/src/qml/jsruntime/qv4object_p.h @@ -64,6 +64,9 @@ QT_BEGIN_NAMESPACE namespace QV4 { +typedef ReturnedValue (*jsCallFunction)(const FunctionObject *, const Value *thisObject, const Value *argv, int argc); +typedef ReturnedValue (*jsConstructFunction)(const FunctionObject *, const Value *argv, int argc); + namespace Heap { #define ObjectMembers(class, Member) \ @@ -275,14 +278,12 @@ struct Q_QML_EXPORT Object: Managed { insertMember(name, value, attributes); } void defineDefaultProperty(const QString &name, const Value &value); - void defineDefaultProperty(const QString &name, ReturnedValue (*code)(const FunctionObject *, const Value *thisObject, const Value *argv, int argc), + void defineDefaultProperty(const QString &name, jsCallFunction code, int argumentCount = 0, PropertyAttributes attributes = Attr_Data|Attr_NotEnumerable); - void defineDefaultProperty(StringOrSymbol *name, ReturnedValue (*code)(const FunctionObject *, const Value *thisObject, const Value *argv, int argc), + void defineDefaultProperty(StringOrSymbol *name, jsCallFunction code, int argumentCount = 0, PropertyAttributes attributes = Attr_Data|Attr_NotEnumerable); - void defineAccessorProperty(const QString &name, ReturnedValue (*getter)(const FunctionObject *, const Value *, const Value *, int), - ReturnedValue (*setter)(const FunctionObject *, const Value *, const Value *, int)); - void defineAccessorProperty(String *name, ReturnedValue (*getter)(const FunctionObject *, const Value *, const Value *, int), - ReturnedValue (*setter)(const FunctionObject *, const Value *, const Value *, int)); + void defineAccessorProperty(const QString &name, jsCallFunction getter, jsCallFunction setter); + void defineAccessorProperty(StringOrSymbol *name, jsCallFunction getter, jsCallFunction setter); /* Fixed: Writable: false, Enumerable: false, Configurable: false */ void defineReadonlyProperty(const QString &name, const Value &value); void defineReadonlyProperty(String *name, const Value &value); |