summaryrefslogtreecommitdiff
path: root/src/qml/compiler/qv4codegen.cpp
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/compiler/qv4codegen.cpp
parent0de2ac924a3dbbd59b9e726f470113e4c87b0ae7 (diff)
downloadqtdeclarative-c3ad706c6ff19a132bf78501430c850040e967fc.tar.gz
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/compiler/qv4codegen.cpp')
-rw-r--r--src/qml/compiler/qv4codegen.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp
index 0033383189..d72162eeb1 100644
--- a/src/qml/compiler/qv4codegen.cpp
+++ b/src/qml/compiler/qv4codegen.cpp
@@ -2260,6 +2260,12 @@ bool Codegen::visit(FunctionDeclaration * ast)
return false;
}
+bool Codegen::visit(YieldExpression *ast)
+{
+ throwSyntaxError(ast->firstSourceLocation(), QLatin1String("Support for 'yield' unimplemented."));
+ return false;
+}
+
static bool endsWithReturn(Node *node)
{
if (!node)
@@ -2288,6 +2294,10 @@ int Codegen::defineFunction(const QString &name, AST::Node *ast,
{
enterContext(ast);
+ if (_context->isGenerator) {
+ throwSyntaxError(ast->firstSourceLocation(), QLatin1String("Support for generator functions unimplemented."));
+ }
+
if (_context->functionIndex >= 0)
// already defined
return leaveContext();