From 420703a10d5990151ba5608eda74086eda351dce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20De=20Canni=C3=A8re?= Date: Sat, 26 Sep 2026 12:04:44 +0200 Subject: Parser: Cleanup AST token kinds Rename Expression to CommaExpression and Module to ESModule to better express their purpose. Remove unused kinds. Task-number: QTBUG-151040 Co-Authored-By: Claude Opus 5 Change-Id: Icebd15cc791a4b39ceb3de62d53583a769fda4a7 Reviewed-by: Sami Shalayel --- src/qml/parser/qqmljsast_p.h | 14 ++++---------- src/qmldom/qqmldomcomments.cpp | 3 --- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/src/qml/parser/qqmljsast_p.h b/src/qml/parser/qqmljsast_p.h index b3fed17246..5acea17b2a 100644 --- a/src/qml/parser/qqmljsast_p.h +++ b/src/qml/parser/qqmljsast_p.h @@ -132,10 +132,9 @@ public: Kind_DefaultClause, Kind_DeleteExpression, Kind_DoWhileStatement, - Kind_ElementList, Kind_Elision, Kind_EmptyStatement, - Kind_Expression, + Kind_CommaExpression, Kind_ExpressionStatement, Kind_FalseLiteral, Kind_SuperLiteral, @@ -144,7 +143,6 @@ public: Kind_ForEachStatement, Kind_ForStatement, Kind_FormalParameterList, - Kind_FunctionBody, Kind_FunctionDeclaration, Kind_FunctionExpression, Kind_ClassExpression, @@ -162,7 +160,7 @@ public: Kind_ImportClause, Kind_FromClause, Kind_ImportDeclaration, - Kind_Module, + Kind_ESModule, Kind_ExportSpecifier, Kind_ExportsList, Kind_ExportClause, @@ -180,10 +178,7 @@ public: Kind_PreDecrementExpression, Kind_PreIncrementExpression, Kind_Program, - Kind_PropertyDefinitionList, - Kind_PropertyGetterSetter, Kind_PropertyName, - Kind_PropertyNameAndValue, Kind_RegExpLiteral, Kind_ReturnStatement, Kind_StatementList, @@ -214,7 +209,6 @@ public: Kind_PatternProperty, Kind_PatternPropertyList, Kind_Type, - Kind_TypeArgument, Kind_TypeAnnotation, Kind_UiArrayBinding, @@ -1675,7 +1669,7 @@ public: class QML_PARSER_EXPORT CommaExpression: public ExpressionNode { public: - QQMLJS_DECLARE_AST_NODE(Expression) + QQMLJS_DECLARE_AST_NODE(CommaExpression) CommaExpression(ExpressionNode *l, ExpressionNode *r): left (l), right (r) { kind = K; } @@ -3036,7 +3030,7 @@ public: class QML_PARSER_EXPORT ESModule: public Node { public: - QQMLJS_DECLARE_AST_NODE(Module) + QQMLJS_DECLARE_AST_NODE(ESModule) ESModule(StatementList *body) : body(body) diff --git a/src/qmldom/qqmldomcomments.cpp b/src/qmldom/qqmldomcomments.cpp index c450333a97..eeef08153c 100644 --- a/src/qmldom/qqmldomcomments.cpp +++ b/src/qmldom/qqmldomcomments.cpp @@ -596,17 +596,14 @@ const QSet AstRangesVisitor::kindsToSkip() { static QSet res = QSet({ AST::Node::Kind_ArgumentList, - AST::Node::Kind_ElementList, AST::Node::Kind_FormalParameterList, AST::Node::Kind_ImportsList, AST::Node::Kind_ExportsList, - AST::Node::Kind_PropertyDefinitionList, AST::Node::Kind_StatementList, AST::Node::Kind_VariableDeclarationList, AST::Node::Kind_ClassElementList, AST::Node::Kind_PatternElementList, AST::Node::Kind_PatternPropertyList, - AST::Node::Kind_TypeArgument, }) .unite(VisitAll::uiKinds()); return res; -- cgit v1.2.3