diff options
author | Lars Knoll <lars.knoll@theqtcompany.com> | 2015-01-09 12:11:09 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2015-01-12 11:04:15 +0100 |
commit | 5e8008dcbff056eecdca779153804bf3cd5acf85 (patch) | |
tree | 0934992b226961a3a91858cdd389c96f07db7870 /src/qml/jsruntime | |
parent | 4f28d07b8efbe9dfe12a08c8198d99225faa1331 (diff) |
Get rid of the bindingKeyFlag
Instead use the vtable to identify that we have a
binding function.
Change-Id: I794aebb6fb83f648ba36f2f15cad94d2af3cae91
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.cpp | 6 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4functionobject_p.h | 2 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4qobjectwrapper.cpp | 2 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4value_p.h | 2 |
4 files changed, 9 insertions, 3 deletions
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp index 0cdf6b5d7c..f70ddb04d4 100644 --- a/src/qml/jsruntime/qv4functionobject.cpp +++ b/src/qml/jsruntime/qv4functionobject.cpp @@ -50,6 +50,7 @@ #include <private/qqmlengine_p.h> #include <qv4codegen_p.h> #include "private/qlocale_tools_p.h" +#include "private/qqmlbuiltinfunctions_p.h" #include <QtCore/qmath.h> #include <QtCore/QDebug> @@ -202,6 +203,11 @@ Heap::FunctionObject *FunctionObject::createScriptFunction(ExecutionContext *sco return scope->d()->engine->memoryManager->alloc<SimpleScriptFunction>(scope, function, createProto); } +bool FunctionObject::isBinding() const +{ + return d()->internalClass->vtable == QQmlBindingFunction::staticVTable(); +} + DEFINE_OBJECT_VTABLE(FunctionCtor); Heap::FunctionCtor::FunctionCtor(QV4::ExecutionContext *scope) diff --git a/src/qml/jsruntime/qv4functionobject_p.h b/src/qml/jsruntime/qv4functionobject_p.h index 7406e9b0ff..d3053ce283 100644 --- a/src/qml/jsruntime/qv4functionobject_p.h +++ b/src/qml/jsruntime/qv4functionobject_p.h @@ -143,7 +143,7 @@ struct Q_QML_EXPORT FunctionObject: Object { bool needsActivation() const { return d()->needsActivation; } bool strictMode() const { return d()->function ? d()->function->isStrict() : false; } - bool bindingKeyFlag() const { return d()->bindingKeyFlag; } + bool isBinding() const; static void markObjects(Heap::Base *that, ExecutionEngine *e); }; diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp index 46a458b1f5..149bf2434c 100644 --- a/src/qml/jsruntime/qv4qobjectwrapper.cpp +++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp @@ -458,7 +458,7 @@ void QObjectWrapper::setProperty(QObject *object, ExecutionContext *ctx, QQmlPro QV4::Scope scope(ctx); QV4::ScopedFunctionObject f(scope, value); if (f) { - if (!f->bindingKeyFlag()) { + if (!f->isBinding()) { if (!property->isVarProperty() && property->propType != qMetaTypeId<QJSValue>()) { // assigning a JS function to a non var or QJSValue property or is not allowed. QString error = QLatin1String("Cannot assign JavaScript function to "); diff --git a/src/qml/jsruntime/qv4value_p.h b/src/qml/jsruntime/qv4value_p.h index 01a1542b07..6a67719464 100644 --- a/src/qml/jsruntime/qv4value_p.h +++ b/src/qml/jsruntime/qv4value_p.h @@ -63,7 +63,7 @@ struct Q_QML_EXPORT Base { uchar extensible : 1; // used by Object uchar needsActivation : 1; // used by FunctionObject uchar _strictMode : 1; // used by FunctionObject - uchar bindingKeyFlag : 1; + uchar _bindingKeyFlag : 1; uchar hasAccessorProperty : 1; uchar _unused : 1; mutable uchar subtype; |