aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@theqtcompany.com>2015-01-09 13:28:40 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2015-01-12 11:04:22 +0100
commit455d967025c0485c1dc0d817008de70cdbcd60dd (patch)
tree6f090aa5ed0a2c352ecc3a85786caa7c29742b0c /src/qml/jsruntime
parent3840beb6c61023542a689c7f125a7b521d3b2551 (diff)
Get rid of subtype usage in Function objects
Change-Id: Ic84ddab292cb69e79dac0f2b8a87b96b096360d8 Reviewed-by: Robin Burchell <robin.burchell@viroteck.net> Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime')
-rw-r--r--src/qml/jsruntime/qv4functionobject.cpp6
-rw-r--r--src/qml/jsruntime/qv4functionobject_p.h8
-rw-r--r--src/qml/jsruntime/qv4qobjectwrapper.cpp1
-rw-r--r--src/qml/jsruntime/qv4runtime.cpp2
4 files changed, 7 insertions, 10 deletions
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp
index 3b0d723988..e74acf78d4 100644
--- a/src/qml/jsruntime/qv4functionobject.cpp
+++ b/src/qml/jsruntime/qv4functionobject.cpp
@@ -206,6 +206,11 @@ bool FunctionObject::isBinding() const
return d()->internalClass->vtable == QQmlBindingFunction::staticVTable();
}
+bool FunctionObject::isBoundFunction() const
+{
+ return d()->internalClass->vtable == BoundFunction::staticVTable();
+}
+
DEFINE_OBJECT_VTABLE(FunctionCtor);
Heap::FunctionCtor::FunctionCtor(QV4::ExecutionContext *scope)
@@ -623,7 +628,6 @@ Heap::BoundFunction::BoundFunction(QV4::ExecutionContext *scope, QV4::FunctionOb
{
this->boundThis = boundThis;
setVTable(QV4::BoundFunction::staticVTable());
- subtype = FunctionObject::BoundFunction;
Scope s(scope);
ScopedObject f(s, this);
diff --git a/src/qml/jsruntime/qv4functionobject_p.h b/src/qml/jsruntime/qv4functionobject_p.h
index 2ccec8efd1..e806888243 100644
--- a/src/qml/jsruntime/qv4functionobject_p.h
+++ b/src/qml/jsruntime/qv4functionobject_p.h
@@ -45,13 +45,6 @@ namespace QV4 {
namespace Heap {
struct Q_QML_PRIVATE_EXPORT FunctionObject : Object {
- // Used with Managed::subType
- enum FunctionType {
- RegularFunction = 0,
- WrappedQtMethod = 1,
- BoundFunction
- };
-
enum {
Index_Prototype = 0,
Index_ProtoConstructor = 0
@@ -145,6 +138,7 @@ struct Q_QML_EXPORT FunctionObject: Object {
bool needsActivation() const { return d()->needsActivation(); }
bool strictMode() const { return d()->function ? d()->function->isStrict() : false; }
bool isBinding() const;
+ bool isBoundFunction() const;
static void markObjects(Heap::Base *that, ExecutionEngine *e);
};
diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp
index 149bf2434c..3f3e49918d 100644
--- a/src/qml/jsruntime/qv4qobjectwrapper.cpp
+++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp
@@ -1758,7 +1758,6 @@ Heap::QObjectMethod::QObjectMethod(QV4::ExecutionContext *scope)
: Heap::FunctionObject(scope)
{
setVTable(QV4::QObjectMethod::staticVTable());
- subtype = WrappedQtMethod;
}
const QMetaObject *Heap::QObjectMethod::metaObject()
diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp
index 7338b8abbe..61a2fc5fd3 100644
--- a/src/qml/jsruntime/qv4runtime.cpp
+++ b/src/qml/jsruntime/qv4runtime.cpp
@@ -318,7 +318,7 @@ QV4::ReturnedValue Runtime::instanceof(ExecutionEngine *engine, const ValueRef l
if (!f)
return engine->throwTypeError();
- if (f->subtype() == Heap::FunctionObject::BoundFunction)
+ if (f->isBoundFunction())
f = static_cast<BoundFunction *>(f.getPointer())->target();
ScopedObject v(scope, left->asObject());