aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4functionobject_p.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2017-08-04 20:28:23 +0200
committerLars Knoll <lars.knoll@qt.io>2017-08-08 18:58:29 +0000
commit8f6a865929da5dc130594dbcd5ace97468f51e59 (patch)
treed905f5f6ba6b7a1ab10dc0a6189f2c2a61308efe /src/qml/jsruntime/qv4functionobject_p.h
parent50e7badd5f261bd69db9d8f03d5651e346087218 (diff)
Unify IndexedBuiltinFunction with BuiltinFunction
Now that we pass the function object to the runtime method, we can retrieve the index from there, and don't need a different calling convention for the indexed version anymore. Change-Id: I6c7d747ddb0c217b23fe9ba06435afb4ec0ee24a 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.h21
1 files changed, 7 insertions, 14 deletions
diff --git a/src/qml/jsruntime/qv4functionobject_p.h b/src/qml/jsruntime/qv4functionobject_p.h
index 5eea262e2e..d76655179d 100644
--- a/src/qml/jsruntime/qv4functionobject_p.h
+++ b/src/qml/jsruntime/qv4functionobject_p.h
@@ -62,6 +62,7 @@ struct QQmlSourceLocation;
namespace QV4 {
struct BuiltinFunction;
+struct IndexedBuiltinFunction;
namespace Heap {
@@ -101,9 +102,8 @@ struct Q_QML_EXPORT BuiltinFunction : FunctionObject {
ReturnedValue (*code)(const QV4::BuiltinFunction *, CallData *);
};
-struct IndexedBuiltinFunction : FunctionObject {
- inline void init(QV4::ExecutionContext *scope, uint index, ReturnedValue (*code)(QV4::CallContext *ctx, uint index));
- ReturnedValue (*code)(QV4::CallContext *, uint index);
+struct IndexedBuiltinFunction : BuiltinFunction {
+ inline void init(QV4::ExecutionContext *scope, uint index, ReturnedValue (*code)(const QV4::BuiltinFunction *, CallData *));
uint index;
};
@@ -202,24 +202,17 @@ struct Q_QML_EXPORT BuiltinFunction : FunctionObject {
static ReturnedValue call(const Managed *that, CallData *callData);
};
-struct IndexedBuiltinFunction: FunctionObject
+struct IndexedBuiltinFunction: BuiltinFunction
{
- V4_OBJECT2(IndexedBuiltinFunction, FunctionObject)
-
- static ReturnedValue construct(const Managed *m, CallData *)
- {
- return m->engine()->throwTypeError();
- }
-
- static ReturnedValue call(const Managed *that, CallData *callData);
+ V4_OBJECT2(IndexedBuiltinFunction, BuiltinFunction)
};
void Heap::IndexedBuiltinFunction::init(QV4::ExecutionContext *scope, uint index,
- ReturnedValue (*code)(QV4::CallContext *ctx, uint index))
+ ReturnedValue (*code)(const QV4::BuiltinFunction *, CallData *))
{
Heap::FunctionObject::init(scope);
- this->index = index;
this->code = code;
+ this->index = index;
}