Handle Var instructions in instruction dumper
authorKent Hansen <kent.hansen@nokia.com>
Thu, 10 May 2012 07:26:35 +0000 (09:26 +0200)
committerQt by Nokia <qt-info@nokia.com>
Mon, 14 May 2012 01:03:45 +0000 (03:03 +0200)
They would show up as "XXX UNKNOWN INSTRUCTION" in instruction dumps.

Change-Id: I3bebfe7519ddfb75c413a067ef05867cc07cd71b
Reviewed-by: Chris Adams <christopher.adams@nokia.com>
src/qml/qml/qqmlinstruction.cpp
tests/auto/qml/qqmlinstruction/tst_qqmlinstruction.cpp

index 96136ff..5715d7a 100644 (file)
@@ -180,12 +180,27 @@ void QQmlCompiledData::dump(QQmlInstruction *instr, int idx)
     case QQmlInstruction::StoreVariantBool:
         qWarning().nospace() << idx << "\t\t" << "STORE_VARIANT_BOOL\t\t" << instr->storeBool.propertyIndex << "\t" << instr->storeBool.value;
         break;
+    case QQmlInstruction::StoreVar:
+        qWarning().nospace() << idx << "\t\t" << "STORE_VAR\t\t" << instr->storeString.propertyIndex << "\t" << instr->storeString.value << "\t\t" << primitives.at(instr->storeString.value);
+        break;
+    case QQmlInstruction::StoreVarInteger:
+        qWarning().nospace() << idx << "\t\t" << "STORE_VAR_INTEGER\t" << instr->storeInteger.propertyIndex << "\t" << instr->storeInteger.value;
+        break;
+    case QQmlInstruction::StoreVarDouble:
+        qWarning().nospace() << idx << "\t\t" << "STORE_VAR_DOUBLE\t" << instr->storeDouble.propertyIndex << "\t" << instr->storeDouble.value;
+        break;
+    case QQmlInstruction::StoreVarBool:
+        qWarning().nospace() << idx << "\t\t" << "STORE_VAR_BOOL\t\t" << instr->storeBool.propertyIndex << "\t" << instr->storeBool.value;
+        break;
     case QQmlInstruction::StoreObject:
         qWarning().nospace() << idx << "\t\t" << "STORE_OBJECT\t\t" << instr->storeObject.propertyIndex;
         break;
     case QQmlInstruction::StoreVariantObject:
         qWarning().nospace() << idx << "\t\t" << "STORE_VARIANT_OBJECT\t" << instr->storeObject.propertyIndex;
         break;
+    case QQmlInstruction::StoreVarObject:
+        qWarning().nospace() << idx << "\t\t" << "STORE_VAR_OBJECT\t" << instr->storeObject.propertyIndex;
+        break;
     case QQmlInstruction::StoreInterface:
         qWarning().nospace() << idx << "\t\t" << "STORE_INTERFACE\t\t" << instr->storeObject.propertyIndex;
         break;
index 18b3653..5fe15a6 100644 (file)
@@ -467,6 +467,42 @@ void tst_qqmlinstruction::dump()
         data->addInstruction(i);
     }
 
+    {
+        data->primitives << "color(1, 1, 1, 1)";
+        QQmlCompiledData::Instruction::StoreVar i;
+        i.propertyIndex = 79;
+        i.value = data->primitives.count() - 1;
+
+        data->addInstruction(i);
+    }
+
+    {
+        QQmlCompiledData::Instruction::StoreVarObject i;
+        i.propertyIndex = 80;
+        data->addInstruction(i);
+    }
+
+    {
+        QQmlCompiledData::Instruction::StoreVarInteger i;
+        i.value = 23;
+        i.propertyIndex = 81;
+        data->addInstruction(i);
+    }
+
+    {
+        QQmlCompiledData::Instruction::StoreVarDouble i;
+        i.value = 66.3;
+        i.propertyIndex = 82;
+        data->addInstruction(i);
+    }
+
+    {
+        QQmlCompiledData::Instruction::StoreVarBool i;
+        i.value = true;
+        i.propertyIndex = 83;
+        data->addInstruction(i);
+    }
+
     QStringList expect;
     expect 
         << "Index\tOperation\t\tData1\tData2\tData3\tComments"
@@ -524,6 +560,11 @@ void tst_qqmlinstruction::dump()
         << "50\t\tDONE"
         << "51\t\tSTORE_TR_STRING\t99\t3\t14\t14\t2"
         << "52\t\tSTORE_TRID_STRING\t78\t7\t-1"
+        << "53\t\tSTORE_VAR\t\t79\t5\t\t\"color(1, 1, 1, 1)\""
+        << "54\t\tSTORE_VAR_OBJECT\t80"
+        << "55\t\tSTORE_VAR_INTEGER\t81\t23"
+        << "56\t\tSTORE_VAR_DOUBLE\t82\t66.3"
+        << "57\t\tSTORE_VAR_BOOL\t\t83\ttrue"
         << "-------------------------------------------------------------------------------";
 
     messages = QStringList();