aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/parser/qqmljs.g
diff options
context:
space:
mode:
authorMaximilian Goldstein <max.goldstein@qt.io>2020-05-13 15:31:51 +0200
committerMaximilian Goldstein <max.goldstein@qt.io>2020-05-20 13:46:36 +0200
commit1c0c8509da2a27858f7b25ffa71d1b19690c708c (patch)
treef574288f0275755a5691697267e58044322753bf /src/qml/parser/qqmljs.g
parentdcc65ddf83fc4ccf1127dfc002c7951d6288e0d5 (diff)
Fix 'as' binary operation using invalid types
Fixes: QTBUG-81392 Change-Id: Ic83091c547a7854b7fa86b44d93c575bd7426bae Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/parser/qqmljs.g')
-rw-r--r--src/qml/parser/qqmljs.g12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/qml/parser/qqmljs.g b/src/qml/parser/qqmljs.g
index 67f9cc7581..8d79e48287 100644
--- a/src/qml/parser/qqmljs.g
+++ b/src/qml/parser/qqmljs.g
@@ -1694,6 +1694,14 @@ TypeAnnotation: T_COLON Type;
} break;
./
+
+TypeExpression: Type;
+/.
+ case $rule_number: {
+ sym(1).Expression = new (pool) AST::TypeExpression(sym(1).Type);
+ } break;
+./
+
TypeAnnotationOpt: TypeAnnotation;
TypeAnnotationOpt: ;
/.
@@ -2664,9 +2672,9 @@ RelationalExpression_In: RelationalExpression_In T_IN ShiftExpression;
} break;
./
-TypeAssertExpression_In: RelationalExpression_In T_AS Type;
+TypeAssertExpression_In: RelationalExpression_In T_AS TypeExpression;
/. case $rule_number: Q_FALLTHROUGH(); ./
-TypeAssertExpression: RelationalExpression T_AS Type;
+TypeAssertExpression: RelationalExpression T_AS TypeExpression;
/.
case $rule_number: {
AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::As, sym(3).Expression);