summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-05-15 13:16:24 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-05-15 13:16:24 (GMT)
commit6648bab32355a1f64b21e6f5394825a9fbef21ea (patch)
tree1fc8d4e2f8a02d3ea4dfa31e9538b1ec0581e84c /src
parent5be67ef5ad9b2f6020ffe47eecc9fd3338957bb7 (diff)
downloadQt-6648bab32355a1f64b21e6f5394825a9fbef21ea.zip
Qt-6648bab32355a1f64b21e6f5394825a9fbef21ea.tar.gz
Qt-6648bab32355a1f64b21e6f5394825a9fbef21ea.tar.bz2
Remove AssignConstant VME instruction
Diffstat (limited to 'src')
-rw-r--r--src/declarative/qml/qmlcompiler.cpp19
-rw-r--r--src/declarative/qml/qmlinstruction.cpp3
-rw-r--r--src/declarative/qml/qmlinstruction_p.h7
-rw-r--r--src/declarative/qml/qmlvme.cpp58
4 files changed, 3 insertions, 84 deletions
diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp
index b205efb..7abd2aa 100644
--- a/src/declarative/qml/qmlcompiler.cpp
+++ b/src/declarative/qml/qmlcompiler.cpp
@@ -1214,37 +1214,24 @@ bool QmlCompiler::compilePropertyLiteralAssignment(QmlParser::Property *prop,
QmlInstruction assign;
assign.line = v->location.start.line;
- bool doassign = true;
if (prop->index != -1) {
QString value = v->primitive();
StoreInstructionResult r =
generateStoreInstruction(*output, assign, obj->metaObject()->property(prop->index), prop->index, -1, &value);
if (r == Ok) {
- doassign = false;
} else if (r == InvalidData) {
//### we are restricted to a rather generic message here. If we can find a way to move
// the exception into generateStoreInstruction we could potentially have better messages.
// (the problem is that both compile and run exceptions can be generated, though)
COMPILE_EXCEPTION2(v, "Cannot assign value" << v->primitive() << "to property" << obj->metaObject()->property(prop->index).name());
- doassign = false;
} else if (r == ReadOnly) {
COMPILE_EXCEPTION2(v, "Cannot assign value" << v->primitive() << "to the read-only property" << obj->metaObject()->property(prop->index).name());
} else {
- doassign = true;
+ COMPILE_EXCEPTION2(prop, "Cannot assign value to property" << obj->metaObject()->property(prop->index).name() << "of unknown type");
}
- }
-
- if (doassign) {
- assign.type = QmlInstruction::AssignConstant;
- if (prop->isDefault) {
- assign.assignConstant.property = -1;
- } else {
- assign.assignConstant.property =
- output->indexForByteArray(prop->name);
- }
- assign.assignConstant.constant =
- output->indexForString(v->primitive());
+ } else {
+ COMPILE_EXCEPTION2(prop, "Cannot assign value to non-existant property" << prop->name);
}
output->bytecode << assign;
diff --git a/src/declarative/qml/qmlinstruction.cpp b/src/declarative/qml/qmlinstruction.cpp
index 6b49359..ef333b1 100644
--- a/src/declarative/qml/qmlinstruction.cpp
+++ b/src/declarative/qml/qmlinstruction.cpp
@@ -124,9 +124,6 @@ void QmlCompiledComponent::dump(QmlInstruction *instr, int idx)
case QmlInstruction::StoreSignal:
qWarning() << idx << "\t" << line << "\t" << "STORE_SIGNAL\t\t" << instr->storeSignal.signalIndex << "\t" << instr->storeSignal.value << "\t\t" << primitives.at(instr->storeSignal.value);
break;
- case QmlInstruction::AssignConstant:
- qWarning() << idx << "\t" << line << "\t" << "ASSIGN_CONSTANT\t" << instr->assignConstant.property << "\t" << instr->assignConstant.constant << "\t\t" << datas.at(instr->assignConstant.property) << primitives.at(instr->assignConstant.constant);
- break;
case QmlInstruction::AssignSignalObject:
qWarning() << idx << "\t" << line << "\t" << "ASSIGN_SIGNAL_OBJECT\t" << instr->assignSignalObject.signal << "\t\t\t" << datas.at(instr->assignSignalObject.signal);
break;
diff --git a/src/declarative/qml/qmlinstruction_p.h b/src/declarative/qml/qmlinstruction_p.h
index f06f0e6..cca99d3 100644
--- a/src/declarative/qml/qmlinstruction_p.h
+++ b/src/declarative/qml/qmlinstruction_p.h
@@ -110,9 +110,6 @@ public:
//
// Unresolved single assignment
//
- // AssignConstant - Store a value in a property. Will resolve into
- // a Store* instruction.
- AssignConstant, /* assignConstant */
AssignSignalObject, /* assignSignalObject */
AssignCustomType, /* assignCustomType */
@@ -187,10 +184,6 @@ public:
} setId;
struct {
int property;
- int constant;
- } assignConstant;
- struct {
- int property;
int castValue;
} assignObject;
struct {
diff --git a/src/declarative/qml/qmlvme.cpp b/src/declarative/qml/qmlvme.cpp
index 51534e7..faee545 100644
--- a/src/declarative/qml/qmlvme.cpp
+++ b/src/declarative/qml/qmlvme.cpp
@@ -409,64 +409,6 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
}
break;
- case QmlInstruction::AssignConstant:
- {
-#ifdef Q_ENABLE_PERFORMANCE_LOG
- QFxCompilerTimer<QFxCompiler::InstrAssignConstant> cc;
-#endif
- // Fixup instruction
- QObject *target = stack.top();
- int propIdx = instr.assignConstant.property;
- int idx = instr.assignConstant.constant;
- QByteArray pr;
- if (propIdx == -1) {
- pr = QmlMetaType::defaultProperty(target).name();
- if (pr.isEmpty())
- VME_EXCEPTION("Cannot resolve defalt property on type" << target->metaObject()->className());
- } else {
- pr = datas.at(propIdx);
- }
-
- int coreIdx = qIndexOfProperty(target, pr);
-
- if (coreIdx != -1) {
- QMetaProperty prop =
- target->metaObject()->property(coreIdx);
- bool replace = !prop.isDynamic();
-
- QmlInstruction *writeInstr = 0;
- QmlInstruction dummy;
- if (replace) {
- writeInstr = &instr;
- } else {
- writeInstr = &dummy;
- dummy = instr;
- }
-
- QmlCompiler::StoreInstructionResult r = QmlCompiler::generateStoreInstruction(*comp, *writeInstr, prop,
- coreIdx, idx, &primitives.at(idx));
- if (r != QmlCompiler::Ok) {
- if (prop.isEnumType()){
- VME_EXCEPTION(primitives.at(idx) << "is not a valid enumeration value");
- } else if (r == QmlCompiler::UnknownType) {
- VME_EXCEPTION("Property" << prop.name() << "is of an unknown type");
- } else if (r == QmlCompiler::InvalidData) {
- VME_EXCEPTION("Cannot assign value" << primitives.at(idx) << "to property" << prop.name());
- } else if (r == QmlCompiler::ReadOnly) {
- VME_EXCEPTION("Cannot assign value" << primitives.at(idx) << "to read-only property" << prop.name());
- } else {
- VME_EXCEPTION("Invalid property assignment for property" << prop.name());
- }
- } else {
- runStoreInstruction(stack, *writeInstr, comp);
- }
-
- } else {
- VME_EXCEPTION("Unknown property" << pr);
- }
- }
- break;
-
case QmlInstruction::TryBeginObject:
{
#ifdef Q_ENABLE_PERFORMANCE_LOG