aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/parser
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-03-21 10:21:53 +0100
committerLars Knoll <lars.knoll@qt.io>2018-04-27 08:10:44 +0000
commit228d7458bae704fdb8fc0fce987d5d57eced9b5d (patch)
treeb394333439e170fa40ce03b97c218fc4d5218218 /src/qml/parser
parenteee070ea3baf8d078ef6dfacce21f1102741775d (diff)
Add support for ... in ArrayLiterals to the AST
The codegen still throws a syntax error for now. Change-Id: I8134b27d6153f6d6df81a9bafc7ae9d573085b73 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/parser')
-rw-r--r--src/qml/parser/qqmljs.g21
-rw-r--r--src/qml/parser/qqmljsast_p.h1
2 files changed, 21 insertions, 1 deletions
diff --git a/src/qml/parser/qqmljs.g b/src/qml/parser/qqmljs.g
index 695998e4ee..acd0bdb0cc 100644
--- a/src/qml/parser/qqmljs.g
+++ b/src/qml/parser/qqmljs.g
@@ -1648,6 +1648,13 @@ ElementList: Elision AssignmentExpression_In;
./
ElementList: ElisionOpt SpreadElement;
+/.
+ case $rule_number: {
+ AST::ElementList *node = new (pool) AST::ElementList(sym(1).Elision, sym(2).Expression);
+ node->isSpreadElement = true;
+ sym(1).Node = node;
+ } break;
+./
ElementList: ElementList T_COMMA ElisionOpt AssignmentExpression_In;
/.
@@ -1659,6 +1666,14 @@ ElementList: ElementList T_COMMA ElisionOpt AssignmentExpression_In;
./
ElementList: ElementList T_COMMA ElisionOpt SpreadElement;
+/.
+ case $rule_number: {
+ AST::ElementList *node = new (pool) AST::ElementList(sym(1).ElementList, sym(3).Elision, sym(4).Expression);
+ node->commaToken = loc(2);
+ node->isSpreadElement = true;
+ sym(1).Node = node;
+ } break;
+./
Elision: T_COMMA;
/.
@@ -1693,7 +1708,11 @@ ElisionOpt: Elision;
./
SpreadElement: T_ELLIPSIS AssignmentExpression;
-/. case $rule_number: { UNIMPLEMENTED; } ./
+/.
+ case $rule_number: {
+ sym(1).Node = sym(2).Node;
+ } break;
+./
ObjectLiteral: T_LBRACE T_RBRACE;
/.
diff --git a/src/qml/parser/qqmljsast_p.h b/src/qml/parser/qqmljsast_p.h
index 6992985097..f07d4f88bc 100644
--- a/src/qml/parser/qqmljsast_p.h
+++ b/src/qml/parser/qqmljsast_p.h
@@ -639,6 +639,7 @@ public:
ExpressionNode *expression;
ElementList *next;
SourceLocation commaToken;
+ bool isSpreadElement = false;
};
class QML_PARSER_EXPORT PropertyName: public Node