diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2021-12-01 19:05:51 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2021-12-06 19:35:50 +0100 |
commit | 1003626e6ac98bc2a1eb0d2ed5df8727612f37ae (patch) | |
tree | bdae1ee9ecf9396cd214cc0cb6f04dca9b6072be /src/qml/parser | |
parent | f8f50d12dcefa4d7d6a7fbc56d973f68c6b9b0ae (diff) |
QmlCompiler: Fix return type calculation
We can return void from a function, explicitly or implicitly, and we
need to be able to wrap that into a QVariant. In order to explicitly
return void, we need the void type to be exposed and understood.
Pick-to: 6.2
Change-Id: I513cabb25469b89a85b5d212a6825a037400729d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/parser')
-rw-r--r-- | src/qml/parser/qqmljs.g | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/qml/parser/qqmljs.g b/src/qml/parser/qqmljs.g index 9bff45faf3..e20e861f8b 100644 --- a/src/qml/parser/qqmljs.g +++ b/src/qml/parser/qqmljs.g @@ -1663,6 +1663,15 @@ Type: UiQualifiedId; } break; ./ +Type: T_VOID; +/. + case $rule_number: { + AST::UiQualifiedId *id = new (pool) AST::UiQualifiedId(stringRef(1)); + id->identifierToken = loc(1); + sym(1).Type = new (pool) AST::Type(id->finish()); + } break; +./ + TypeAnnotation: T_COLON Type; /. case $rule_number: { |