aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/parser/qqmljsast_p.h
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2018-08-14 13:39:01 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2018-08-14 17:45:56 +0000
commit24a098793481c5e173e4271f775c96a37f0e6e1c (patch)
tree2688ff8d3c46076b3cb87e883f734df9d3bf87c7 /src/qml/parser/qqmljsast_p.h
parent929ef25efd402368a9f154b61aa96b4b01a02ce2 (diff)
Simplify ES module body handling
Now that ImportDeclaration and ExportDeclaration are also statements in the AST, we can get rid of the ModuleItemList in the AST. We keep it in the grammar, but map it to a statement list. Change-Id: I4cab29fe9b075e88454fe3b194126f728000856a Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml/parser/qqmljsast_p.h')
-rw-r--r--src/qml/parser/qqmljsast_p.h54
1 files changed, 2 insertions, 52 deletions
diff --git a/src/qml/parser/qqmljsast_p.h b/src/qml/parser/qqmljsast_p.h
index 1429d784c6..c74bf60a99 100644
--- a/src/qml/parser/qqmljsast_p.h
+++ b/src/qml/parser/qqmljsast_p.h
@@ -188,7 +188,6 @@ public:
Kind_ExportsList,
Kind_ExportClause,
Kind_ExportDeclaration,
- Kind_ModuleItemList,
Kind_NewExpression,
Kind_NewMemberExpression,
Kind_NotExpression,
@@ -2722,63 +2721,15 @@ public:
bool exportDefault = false;
};
-class QML_PARSER_EXPORT ModuleItemList: public Node
-{
-public:
- QQMLJS_DECLARE_AST_NODE(ModuleItemList)
-
- ModuleItemList(Node *item)
- : item(item)
- {
- kind = K;
- next = this;
- }
-
- ModuleItemList(ModuleItemList *previous, Node *item)
- : item(item)
- {
- kind = K;
- if (previous) {
- next = previous->next;
- previous->next = this;
- } else {
- next = this;
- }
- }
-
- ModuleItemList *finish()
- {
- ModuleItemList *head = next;
- next = nullptr;
- return head;
- }
-
- StatementList *buildStatementList(MemoryPool *pool) const;
-
- void accept0(Visitor *) override;
-
- SourceLocation firstSourceLocation() const override
- { return item->firstSourceLocation(); }
-
- SourceLocation lastSourceLocation() const override
- { return next ? next->lastSourceLocation() : item->lastSourceLocation(); }
-
-// attributes
- Node *item; // ImportDeclaration, ExportDeclaration or StatementList
- ModuleItemList *next;
-};
-
class QML_PARSER_EXPORT ESModule: public Node
{
public:
QQMLJS_DECLARE_AST_NODE(Module)
- ESModule(ModuleItemList *body, MemoryPool *pool)
+ ESModule(StatementList *body)
: body(body)
{
kind = K;
- if (body)
- statements = body->buildStatementList(pool);
}
void accept0(Visitor *visitor) override;
@@ -2790,8 +2741,7 @@ public:
{ return body ? body->lastSourceLocation() : SourceLocation(); }
// attributes
- ModuleItemList *body;
- StatementList *statements = nullptr;
+ StatementList *body;
};
class QML_PARSER_EXPORT DebuggerStatement: public Statement