aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/v8/qjsvalue_p.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-05-13 18:07:44 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2013-05-17 23:47:49 +0200
commit6b8160e323bd366ac383101955c8a7ba67a8a14d (patch)
treec4758c6a316655afe7bb86a3c5a9dc2e426c9574 /src/qml/qml/v8/qjsvalue_p.h
parentf55d88fec958ec88a1b0912380a9bc44280be227 (diff)
Give the QJSValuePrivate the pointer to the engine back
Unfortunately the value needs a pointer back to the engine, to keep compatibility with the old code and have our tests pass unmodified. Change-Id: Ibe26e6c770bd8d26dad4a26d42b40e3e1af4996c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/qml/v8/qjsvalue_p.h')
-rw-r--r--src/qml/qml/v8/qjsvalue_p.h16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/qml/qml/v8/qjsvalue_p.h b/src/qml/qml/v8/qjsvalue_p.h
index db30ad8c92..cf1148f54e 100644
--- a/src/qml/qml/v8/qjsvalue_p.h
+++ b/src/qml/qml/v8/qjsvalue_p.h
@@ -57,6 +57,7 @@
#include <private/qv4value_p.h>
#include <private/qv4string_p.h>
#include <private/qv4engine_p.h>
+#include <private/qv4object_p.h>
QT_BEGIN_NAMESPACE
@@ -67,38 +68,45 @@ QT_BEGIN_NAMESPACE
class QJSValuePrivate : public QV4::PersistentValuePrivate
{
public:
- QJSValuePrivate(const QV4::Value &v)
+ QJSValuePrivate(QV4::ExecutionEngine *engine, const QV4::Value &v)
: PersistentValuePrivate(v)
+ , e(engine)
{
if (value.isEmpty())
value = QV4::Value::undefinedValue();
}
QJSValuePrivate(QV4::Object *o)
: PersistentValuePrivate(QV4::Value::fromObject(o))
- {}
+ { e = o->engine(); }
QJSValuePrivate(QV4::String *s)
: PersistentValuePrivate(QV4::Value::fromString(s))
- {}
+ { e = s->engine(); }
QJSValuePrivate(const QString &s)
: PersistentValuePrivate(QV4::Value::undefinedValue())
, string(0, s)
+ , e(0)
{
value = QV4::Value::fromString(&string);
}
QV4::Value getValue(QV4::ExecutionEngine *e) {
+ if (!this->e)
+ this->e = e;
if (value.asString() == &string)
value = QV4::Value::fromString(e->newString(string.toQString()));
return value;
}
QV4::ExecutionEngine *engine() const {
- return value.engine();
+ if (!e)
+ e = value.engine();
+ return e;
}
static QJSValuePrivate *get(const QJSValue &v) { return v.d; }
QV4::String string;
+ mutable QV4::ExecutionEngine *e;
};
QT_END_NAMESPACE