From d29f3d7a62780d74f62330b0e3a0703a72155852 Mon Sep 17 00:00:00 2001 From: Maximilian Goldstein Date: Wed, 6 May 2020 12:22:50 +0200 Subject: Allow using lowercase enum names Fixes: QTBUG-83395 Change-Id: I98dd953497c6e28a1cfb5228095f05547e49b11d Reviewed-by: Ulf Hermann --- src/qml/qml/qqmltypewrapper.cpp | 23 ----------------------- 1 file changed, 23 deletions(-) (limited to 'src/qml/qml/qqmltypewrapper.cpp') diff --git a/src/qml/qml/qqmltypewrapper.cpp b/src/qml/qml/qqmltypewrapper.cpp index da76659ef4..6258403f33 100644 --- a/src/qml/qml/qqmltypewrapper.cpp +++ b/src/qml/qml/qqmltypewrapper.cpp @@ -158,14 +158,6 @@ static int enumForSingleton(QV4::ExecutionEngine *v4, String *name, QObject *qob return -1; } -static ReturnedValue throwLowercaseEnumError(QV4::ExecutionEngine *v4, String *name, const QQmlType &type) -{ - const QString message = - QStringLiteral("Cannot access enum value '%1' of '%2', enum values need to start with an uppercase letter.") - .arg(name->toQString()).arg(QLatin1String(type.typeName())); - return v4->throwTypeError(message); -} - ReturnedValue QQmlTypeWrapper::virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty) { // Keep this code in sync with ::virtualResolveLookupGetter @@ -220,13 +212,6 @@ ReturnedValue QQmlTypeWrapper::virtualGet(const Managed *m, PropertyKey id, cons if (hasProperty) *hasProperty = ok; - // Warn when attempting to access a lowercased enum value, singleton case - if (!ok && includeEnums && !name->startsWithUpper()) { - enumForSingleton(v4, name, qobjectSingleton, type, &ok); - if (ok) - return throwLowercaseEnumError(v4, name, type); - } - return result; } } else if (type.isQJSValueSingleton()) { @@ -304,14 +289,6 @@ ReturnedValue QQmlTypeWrapper::virtualGet(const Managed *m, PropertyKey id, cons if (hasProperty) *hasProperty = ok; - // Warn when attempting to access a lowercased enum value, non-singleton case - if (!ok && type.isValid() && !type.isSingleton() && !name->startsWithUpper()) { - bool enumOk = false; - type.enumValue(QQmlEnginePrivate::get(v4->qmlEngine()), name, &enumOk); - if (enumOk) - return throwLowercaseEnumError(v4, name, type); - } - return result; } -- cgit v1.2.3