Skip to content

Commit

Permalink
ES6 generator: do not allow yield* without argument.
Browse files Browse the repository at this point in the history
  • Loading branch information
ariya committed Jun 16, 2015
1 parent a339e8c commit a7379ac
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
7 changes: 4 additions & 3 deletions esprima.js
Original file line number Diff line number Diff line change
Expand Up @@ -3683,10 +3683,11 @@
delegate = match('*');
if (delegate) {
lex();
}

if (!match(';') && !match('}') && lookahead.type !== Token.EOF) {
argument = parseExpression();
} else {
if (!match(';') && !match('}') && lookahead.type !== Token.EOF) {
argument = parseExpression();
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"index":22,"lineNumber":1,"column":23,"message":"Error: Line 1: Unexpected token }","description":"Unexpected token }"}
1 change: 1 addition & 0 deletions test/fixtures/ES6/generator/invalid-yield-delegate.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(function*() { yield* })

0 comments on commit a7379ac

Please sign in to comment.