aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/v4/qv4irbuilder.cpp
diff options
context:
space:
mode:
authorMatthew Vogt <matthew.vogt@nokia.com>2012-03-30 09:09:51 +1000
committerQt by Nokia <qt-info@nokia.com>2012-04-16 01:26:12 +0200
commit82a3fef9104ef449ecae56a2b228f4e820d928fa (patch)
tree4c87df2570d47f652589f8e2d787ae67a861772b /src/qml/qml/v4/qv4irbuilder.cpp
parentf189b8934dc405cbd45258abc5aba2713428b1cc (diff)
Add support for variant properties in V4
Support initialization of variant properties in V4. Variants can be set to contain basic types in V4, but we can't extract data from them since they may contain data types that V4 does not comprehend. Task-number: QTBUG-25022 Change-Id: I1935d77b50c5a3481c4c8ddd86b9d3d970571217 Reviewed-by: Michael Brasser <michael.brasser@nokia.com> Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
Diffstat (limited to 'src/qml/qml/v4/qv4irbuilder.cpp')
-rw-r--r--src/qml/qml/v4/qv4irbuilder.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/qml/qml/v4/qv4irbuilder.cpp b/src/qml/qml/v4/qv4irbuilder.cpp
index 31ed9a5a6a..82da09f485 100644
--- a/src/qml/qml/v4/qv4irbuilder.cpp
+++ b/src/qml/qml/v4/qv4irbuilder.cpp
@@ -116,8 +116,16 @@ bool QV4IRBuilder::operator()(QQmlJS::IR::Function *function,
//_block->MOVE(_block->TEMP(IR::InvalidType), r.code);
if (r.code) {
- const QMetaObject *m = 0;
- const IR::Type targetType = irTypeFromVariantType(m_expression->property->type, m_engine, m);
+ IR::Type targetType = IR::InvalidType;
+
+ // This is the only operation where variant is supported:
+ QQmlPropertyData *data = &m_expression->property->core;
+ if (data->propType == QMetaType::QVariant) {
+ targetType = (data->isVMEProperty() ? IR::VarType : IR::VariantType);
+ } else {
+ targetType = irTypeFromVariantType(data->propType, m_engine, 0);
+ }
+
if (targetType != r.type()) {
IR::Expr *x = _block->TEMP(targetType);
_block->MOVE(x, r, true);