diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2021-11-19 15:04:49 +0100 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2021-11-26 15:57:01 +0100 |
commit | e743b6e5e93392584b0eb10215102952e6a78730 (patch) | |
tree | 23aadcf5cfb853ba12137496439d632b564d86fb /tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | |
parent | 83ed0e4cd90e384e6d735066e19c7f505189f98d (diff) |
qqmltypecompiler: Be conservative in enum optimization
QQmlEnumTypeResolver constains logic to find enumerations in bindings
and turn those bindings into simple integer bindings. However, that
logic got confused when we had a complex expression (as in, not only an
identifier but any compound expression).
Instead of trying to create a mini-expression parser, we opt to be more
conservative in the analysis and reject anything that does not look like
one or more identifiers separated by dots.
The use case of optimizing simple arithmetic operations involving enums
in bindings is left to qmlsc.
Pick-to: 6.2
Fixes: QTBUG-98311
Change-Id: I6f8c3fa2a2712dabdea035e2447d52c415ebfc3f
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp')
-rw-r--r-- | tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index cef3650c15..9b1329d15d 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -1488,6 +1488,7 @@ void tst_qqmlecmascript::enums() QCOMPARE(object->property("j").toInt(), 19); QCOMPARE(object->property("k").toInt(), 42); QCOMPARE(object->property("l").toInt(), 333); + QCOMPARE(object->property("m").toInt(), 3); } // Non-existent enums { |