qmllint: Don't dump imported enums into the current scope
This bit of code has never fulfilled any discernable function. Enum access is done elsewhere. Add a test case to prove that access to enums from QtQml's plugins.qmltypes still works. Change-Id: I62fd6c1ec748c88205aa20367ee06d7a33502fa1 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
parent
dbb0d83779
commit
229b24370b
|
@ -0,0 +1,6 @@
|
||||||
|
import QtQml
|
||||||
|
|
||||||
|
QtObject {
|
||||||
|
property int foo: Easing.Linear123
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
import QtQml
|
||||||
|
|
||||||
|
QtObject {
|
||||||
|
// Remarkably, Easing.Type.Linear is not allowed in QML
|
||||||
|
// This is in contrast to QML-declared enums. See EnumAccess2.qml
|
||||||
|
property int foo: Easing.Linear
|
||||||
|
}
|
||||||
|
|
|
@ -189,7 +189,12 @@ void TestQmllint::dirtyQmlCode_data()
|
||||||
<< QString();
|
<< QString();
|
||||||
QTest::newRow("javascriptMethodsInModule")
|
QTest::newRow("javascriptMethodsInModule")
|
||||||
<< QStringLiteral("javascriptMethodsInModuleBad.qml")
|
<< QStringLiteral("javascriptMethodsInModuleBad.qml")
|
||||||
<< QString("Warning: Property \"unknownFunc\" not found on type \"Foo\"") << QString();
|
<< QString("Warning: Property \"unknownFunc\" not found on type \"Foo\"")
|
||||||
|
<< QString();
|
||||||
|
QTest::newRow("badEnumFromQtQml")
|
||||||
|
<< QStringLiteral("badEnumFromQtQml.qml")
|
||||||
|
<< QString("Warning: Property \"Linear123\" not found on type \"QQmlEasingEnums\"")
|
||||||
|
<< QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestQmllint::dirtyQmlCode()
|
void TestQmllint::dirtyQmlCode()
|
||||||
|
@ -236,6 +241,7 @@ void TestQmllint::cleanQmlCode_data()
|
||||||
QTest::newRow("Signals") << QStringLiteral("Signal.qml");
|
QTest::newRow("Signals") << QStringLiteral("Signal.qml");
|
||||||
QTest::newRow("javascriptMethodsInModule")
|
QTest::newRow("javascriptMethodsInModule")
|
||||||
<< QStringLiteral("javascriptMethodsInModuleGood.qml");
|
<< QStringLiteral("javascriptMethodsInModuleGood.qml");
|
||||||
|
QTest::newRow("enumFromQtQml") << QStringLiteral("enumFromQtQml.qml");
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestQmllint::cleanQmlCode()
|
void TestQmllint::cleanQmlCode()
|
||||||
|
|
|
@ -164,10 +164,6 @@ void FindWarningVisitor::processImport(
|
||||||
const auto exports = val->exports();
|
const auto exports = val->exports();
|
||||||
for (const auto &valExport : exports)
|
for (const auto &valExport : exports)
|
||||||
m_exportedName2Scope.insert(prefixedName(prefix, valExport.type()), val);
|
m_exportedName2Scope.insert(prefixedName(prefix, valExport.type()), val);
|
||||||
|
|
||||||
const auto enums = val->enums();
|
|
||||||
for (const auto &valEnum : enums)
|
|
||||||
m_currentScope->addEnum(valEnum);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue