aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/parser
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2018-08-15 15:46:34 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2018-08-16 11:05:22 +0000
commit67c33f2230e899a230260879a5d90dfcd8e13d8d (patch)
tree2e3bdf61ca1942e3616539744e3dc6020fe1e6bd /src/qml/parser
parentc17caaf7a604e3110048c9fa2be23345dcc1ad66 (diff)
Fix the class name property of default exported classes
Change-Id: I171e571a336a15c27881999a10ffe3c52e92d816 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml/parser')
-rw-r--r--src/qml/parser/qqmljs.g8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/qml/parser/qqmljs.g b/src/qml/parser/qqmljs.g
index e4c103938b..b5e63fe7fe 100644
--- a/src/qml/parser/qqmljs.g
+++ b/src/qml/parser/qqmljs.g
@@ -4237,6 +4237,14 @@ ExportDeclaration: T_EXPORT T_DEFAULT ExportDeclarationLookahead T_FORCE_DECLARA
ExportDeclaration: T_EXPORT T_DEFAULT ExportDeclarationLookahead T_FORCE_DECLARATION ClassDeclaration_Default;
/.
case $rule_number: {
+ // Emulate 15.2.3.11
+ if (auto *cls = AST::cast<AST::ClassDeclaration*>(sym(5).Node)) {
+ if (cls->name.isEmpty()) {
+ cls->name = stringRef(2);
+ cls->identifierToken = loc(2);
+ }
+ }
+
auto exportDeclaration = new (pool) AST::ExportDeclaration(/*exportDefault=*/true, sym(5).Node);
exportDeclaration->exportToken = loc(1);
sym(1).ExportDeclaration = exportDeclaration;