summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qmlcompiler.cpp
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-05-15 13:26:07 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-05-15 13:26:07 (GMT)
commitdeed3896f48d52475bf1585534bca500666d9744 (patch)
tree23a7b3d1fd18c8367148b6c4774b5ec4968d70ab /src/declarative/qml/qmlcompiler.cpp
parent6648bab32355a1f64b21e6f5394825a9fbef21ea (diff)
downloadQt-deed3896f48d52475bf1585534bca500666d9744.zip
Qt-deed3896f48d52475bf1585534bca500666d9744.tar.gz
Qt-deed3896f48d52475bf1585534bca500666d9744.tar.bz2
Remove Assign*Binding VME instructions
Diffstat (limited to 'src/declarative/qml/qmlcompiler.cpp')
-rw-r--r--src/declarative/qml/qmlcompiler.cpp40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp
index 7abd2aa..8990732 100644
--- a/src/declarative/qml/qmlcompiler.cpp
+++ b/src/declarative/qml/qmlcompiler.cpp
@@ -1050,8 +1050,9 @@ bool QmlCompiler::compileListProperty(QmlParser::Property *prop,
COMPILE_EXCEPTION("Can only assign one binding to lists");
assignedBinding = true;
- compileBinding(v->value.asScript(), prop, ctxt,
- obj->metaObject(), v->location.start.line);
+ COMPILE_CHECK(compileBinding(v->value.asScript(), prop, ctxt,
+ obj->metaObject(),
+ v->location.start.line));
v->type = Value::PropertyBinding;
} else {
COMPILE_EXCEPTION("Cannot assign primitives to lists");
@@ -1204,8 +1205,9 @@ bool QmlCompiler::compilePropertyLiteralAssignment(QmlParser::Property *prop,
{
if (v->value.isScript()) {
- compileBinding(v->value.asScript(), prop, ctxt, obj->metaObject(),
- v->location.start.line);
+ COMPILE_CHECK(compileBinding(v->value.asScript(), prop, ctxt,
+ obj->metaObject(),
+ v->location.start.line));
v->type = Value::PropertyBinding;
@@ -1329,7 +1331,7 @@ bool QmlCompiler::compileDynamicMeta(QmlParser::Object *obj)
return true;
}
-void QmlCompiler::compileBinding(const QString &bind, QmlParser::Property *prop,
+bool QmlCompiler::compileBinding(const QString &bind, QmlParser::Property *prop,
int ctxt, const QMetaObject *mo, qint64 line)
{
QmlBasicScript bs;
@@ -1342,10 +1344,12 @@ void QmlCompiler::compileBinding(const QString &bind, QmlParser::Property *prop,
bref = output->indexForString(bind);
}
- QmlInstruction assign;
- assign.assignBinding.context = ctxt;
- assign.line = line;
if (prop->index != -1) {
+
+ QmlInstruction assign;
+ assign.assignBinding.context = ctxt;
+ assign.line = line;
+
if (bs.isValid())
assign.type = QmlInstruction::StoreCompiledBinding;
else
@@ -1355,20 +1359,18 @@ void QmlCompiler::compileBinding(const QString &bind, QmlParser::Property *prop,
assign.assignBinding.value = bref;
assign.assignBinding.category = QmlMetaProperty::Unknown;
if (mo) {
- //XXX we should generate an exception if the property is read-only
+ // ### we should generate an exception if the property is read-only
QMetaProperty mp = mo->property(assign.assignBinding.property);
assign.assignBinding.category = QmlMetaProperty::propertyCategory(mp);
}
+
+ output->bytecode << assign;
+
} else {
- if (bs.isValid())
- assign.type = QmlInstruction::AssignCompiledBinding;
- else
- assign.type = QmlInstruction::AssignBinding;
- assign.assignBinding.property = output->indexForByteArray(prop->name);
- assign.assignBinding.value = bref;
- assign.assignBinding.category = QmlMetaProperty::Unknown;
+ COMPILE_EXCEPTION2(prop, "Cannot assign binding to non-existant property" << prop->name);
}
- output->bytecode << assign;
+
+ return true;
}
int QmlCompiler::optimizeExpressions(int start, int end, int patch)
@@ -1401,9 +1403,7 @@ int QmlCompiler::optimizeExpressions(int start, int end, int patch)
continue;
}
- if (instr.type == QmlInstruction::AssignBinding ||
- instr.type == QmlInstruction::AssignCompiledBinding ||
- instr.type == QmlInstruction::StoreBinding ||
+ if (instr.type == QmlInstruction::StoreBinding ||
instr.type == QmlInstruction::StoreCompiledBinding) {
++bindingsCount;
} else if (instr.type == QmlInstruction::TryBeginObject ||