aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/parser/qqmljsast_p.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-03-21 12:25:51 +0100
committerLars Knoll <lars.knoll@qt.io>2018-04-27 08:11:00 +0000
commitc3ad706c6ff19a132bf78501430c850040e967fc (patch)
tree9d16716001c3cd25bf6c778fe9b5f4dc117c17c4 /src/qml/parser/qqmljsast_p.h
parent0de2ac924a3dbbd59b9e726f470113e4c87b0ae7 (diff)
Added support for generator functions and yield expressions to the AST
Some smaller changes to the codegen are included as well to ensure that we catch all uses of generators and properly throw an unimplemented error on them for now. Change-Id: Ib915a0e862e128644ff00dfe989507783c912c66 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/parser/qqmljsast_p.h')
-rw-r--r--src/qml/parser/qqmljsast_p.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/qml/parser/qqmljsast_p.h b/src/qml/parser/qqmljsast_p.h
index 21e27de5ac..e88eee4a37 100644
--- a/src/qml/parser/qqmljsast_p.h
+++ b/src/qml/parser/qqmljsast_p.h
@@ -170,6 +170,7 @@ public:
Kind_NewMemberExpression,
Kind_NotExpression,
Kind_NullExpression,
+ Kind_YieldExpression,
Kind_NumericLiteral,
Kind_NumericLiteralPropertyName,
Kind_ObjectLiteral,
@@ -1801,6 +1802,28 @@ public:
SourceLocation semicolonToken;
};
+class QML_PARSER_EXPORT YieldExpression: public ExpressionNode
+{
+public:
+ QQMLJS_DECLARE_AST_NODE(YieldExpression)
+
+ YieldExpression(ExpressionNode *e = nullptr):
+ expression (e) { kind = K; }
+
+ void accept0(Visitor *visitor) override;
+
+ SourceLocation firstSourceLocation() const override
+ { return yieldToken; }
+
+ SourceLocation lastSourceLocation() const override
+ { return expression ? expression->lastSourceLocation() : yieldToken; }
+
+// attributes
+ ExpressionNode *expression;
+ bool isYieldStar = false;
+ SourceLocation yieldToken;
+};
+
class QML_PARSER_EXPORT WithStatement: public Statement
{
public:
@@ -2113,6 +2136,7 @@ public:
// attributes
QStringRef name;
bool isArrowFunction = false;
+ bool isGenerator = false;
FormalParameterList *formals;
StatementList *body;
SourceLocation functionToken;