From 9337b1c339c34cd4fe10d236be2ee61ca76e17ba Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 23 Jul 2018 09:42:16 +0200 Subject: Clean up compilation unit string resolution Replace use of CompiledData::Unit::stringAt with CompilationUnit::stringAt as central place, in preparation for allowing derived compilation units to retrieve strings from base units. Change-Id: Ifafe6c18a9fd8d1e2259a60c17200124869b4c2d Reviewed-by: Lars Knoll --- tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp | 14 +++++++------- tests/auto/qml/qqmltranslation/tst_qqmltranslation.cpp | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'tests') diff --git a/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp b/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp index fa50997ae7..5c70aed256 100644 --- a/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp +++ b/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp @@ -282,7 +282,7 @@ void tst_qmldiskcache::regenerateAfterChange() QCOMPARE(quint32(testUnit->functionTableSize), quint32(1)); const QV4::CompiledData::Function *bindingFunction = testUnit->functionAt(0); - QCOMPARE(testUnit->stringAt(bindingFunction->nameIndex), QString("expression for blah")); // check if we have the correct function + QCOMPARE(testUnit->stringAtInternal(bindingFunction->nameIndex), QString("expression for blah")); // check if we have the correct function QVERIFY(bindingFunction->codeSize > 0); QVERIFY(bindingFunction->codeOffset < testUnit->unitSize); } @@ -308,7 +308,7 @@ void tst_qmldiskcache::regenerateAfterChange() QCOMPARE(quint32(testUnit->functionTableSize), quint32(1)); const QV4::CompiledData::Function *bindingFunction = testUnit->functionAt(0); - QCOMPARE(testUnit->stringAt(bindingFunction->nameIndex), QString("expression for blah")); // check if we have the correct function + QCOMPARE(testUnit->stringAtInternal(bindingFunction->nameIndex), QString("expression for blah")); // check if we have the correct function QVERIFY(bindingFunction->codeSize > 0); QVERIFY(bindingFunction->codeOffset < testUnit->unitSize); } @@ -332,12 +332,12 @@ void tst_qmldiskcache::registerImportForImplicitComponent() QVERIFY2(testUnit, qPrintable(testCompiler.lastErrorString)); QCOMPARE(quint32(testUnit->nImports), quint32(2)); - QCOMPARE(testUnit->stringAt(testUnit->importAt(0)->uriIndex), QStringLiteral("QtQuick")); + QCOMPARE(testUnit->stringAtInternal(testUnit->importAt(0)->uriIndex), QStringLiteral("QtQuick")); QQmlType componentType = QQmlMetaType::qmlType(&QQmlComponent::staticMetaObject); - QCOMPARE(testUnit->stringAt(testUnit->importAt(1)->uriIndex), QString(componentType.module())); - QCOMPARE(testUnit->stringAt(testUnit->importAt(1)->qualifierIndex), QStringLiteral("QmlInternals")); + QCOMPARE(testUnit->stringAtInternal(testUnit->importAt(1)->uriIndex), QString(componentType.module())); + QCOMPARE(testUnit->stringAtInternal(testUnit->importAt(1)->qualifierIndex), QStringLiteral("QmlInternals")); QCOMPARE(quint32(testUnit->nObjects), quint32(3)); @@ -346,7 +346,7 @@ void tst_qmldiskcache::registerImportForImplicitComponent() QCOMPARE(quint32(obj->bindingTable()->type), quint32(QV4::CompiledData::Binding::Type_Object)); const QV4::CompiledData::Object *implicitComponent = testUnit->objectAt(obj->bindingTable()->value.objectIndex); - QCOMPARE(testUnit->stringAt(implicitComponent->inheritedTypeNameIndex), QStringLiteral("QmlInternals.") + componentType.elementName()); + QCOMPARE(testUnit->stringAtInternal(implicitComponent->inheritedTypeNameIndex), QStringLiteral("QmlInternals.") + componentType.elementName()); } } @@ -498,7 +498,7 @@ void tst_qmldiskcache::recompileAfterDirectoryChange() const QV4::CompiledData::Unit *unit = testCompiler.mapUnit(); QVERIFY(unit->sourceFileIndex != 0); const QString expectedPath = QUrl::fromLocalFile(testCompiler.testFilePath).toString(); - QCOMPARE(unit->stringAt(unit->sourceFileIndex), expectedPath); + QCOMPARE(unit->stringAtInternal(unit->sourceFileIndex), expectedPath); testCompiler.closeMapping(); } diff --git a/tests/auto/qml/qqmltranslation/tst_qqmltranslation.cpp b/tests/auto/qml/qqmltranslation/tst_qqmltranslation.cpp index ace60d6c1f..e7fbf4a6f0 100644 --- a/tests/auto/qml/qqmltranslation/tst_qqmltranslation.cpp +++ b/tests/auto/qml/qqmltranslation/tst_qqmltranslation.cpp @@ -89,7 +89,7 @@ void tst_qqmltranslation::translation() const QV4::CompiledData::Object *rootObject = unit->objectAt(/*root object*/0); const QV4::CompiledData::Binding *binding = rootObject->bindingTable(); for (quint32 i = 0; i < rootObject->nBindings; ++i, ++binding) { - const QString propertyName = unit->stringAt(binding->propertyNameIndex); + const QString propertyName = compilationUnit->stringAt(binding->propertyNameIndex); const bool expectCompiledTranslation = compiledTranslations.contains(propertyName); @@ -144,7 +144,7 @@ void tst_qqmltranslation::idTranslation() const QV4::CompiledData::Object *rootObject = unit->objectAt(/*root object*/0); const QV4::CompiledData::Binding *binding = rootObject->bindingTable(); for (quint32 i = 0; i < rootObject->nBindings; ++i, ++binding) { - const QString propertyName = unit->stringAt(binding->propertyNameIndex); + const QString propertyName = compilationUnit->stringAt(binding->propertyNameIndex); if (propertyName == "idTranslation") { if (binding->type != QV4::CompiledData::Binding::Type_TranslationById) qDebug() << "binding for property" << propertyName << "is not a compiled translation"; -- cgit v1.2.3