Handle Var instructions in instruction dumper

They would show up as "XXX UNKNOWN INSTRUCTION" in instruction dumps.

Change-Id: I3bebfe7519ddfb75c413a067ef05867cc07cd71b
Reviewed-by: Chris Adams <christopher.adams@nokia.com>
This commit is contained in:
Kent Hansen 2012-05-10 09:26:35 +02:00 committed by Qt by Nokia
parent 91bac76439
commit d3ec26ea2e
2 changed files with 56 additions and 0 deletions

View 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;

View 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();