aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsapi/qjsvalue_p.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-11-26 10:46:44 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-12-04 09:45:38 +0100
commit8831e02402fa0b2a3cdfdc017bcbb10bf000995e (patch)
treebc926f06d9df570f02b401ea95ea1a0dd33b1d48 /src/qml/jsapi/qjsvalue_p.h
parent9f4597dd7ae333f209c862e40c68a8f84255a63a (diff)
Fixup the implementation mess for QJSValue(QString)
Until now we were using a QV4::String without engine to represent this case. But this leads to lots of quirks, where we ended up trying to access the engine (or the internalclass/vtable) of this string anyway. Now just represent it by using an QString in QJSValuePrivate, and use an empty value to represent it. This adds a little bit of code to QJSValue and QJSEngine, but is more stable and maintainable in the longer term. Change-Id: I3358165ee64e788274225743a95dfb13346225cc Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsapi/qjsvalue_p.h')
-rw-r--r--src/qml/jsapi/qjsvalue_p.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/qml/jsapi/qjsvalue_p.h b/src/qml/jsapi/qjsvalue_p.h
index bf839a6f1f..d8da664cc6 100644
--- a/src/qml/jsapi/qjsvalue_p.h
+++ b/src/qml/jsapi/qjsvalue_p.h
@@ -80,17 +80,16 @@ public:
Q_ASSERT(!value.isEmpty());
}
QJSValuePrivate(const QString &s)
- : PersistentValuePrivate(QV4::Encode::undefined())
- , string(0, s)
+ : PersistentValuePrivate(QV4::Primitive::emptyValue().asReturnedValue())
+ , string(s)
{
- value.val = QV4::Encode(string.asReturned<QV4::String>());
}
QV4::ReturnedValue getValue(QV4::ExecutionEngine *e);
static QJSValuePrivate *get(const QJSValue &v) { return v.d; }
- QV4::String string;
+ QString string;
};
QT_END_NAMESPACE