Skip to content

Commit

Permalink
fixup for #1585 (#1589)
Browse files Browse the repository at this point in the history
As patched on `harmony`, `statement()` is the only user of `embed_tokens()` with a missing error branch.

Updated test case and match up with `harmony` to facilitate future merging.
  • Loading branch information
alexlamsl authored Mar 10, 2017
1 parent 8354758 commit cf45e2f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
6 changes: 1 addition & 5 deletions lib/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -787,8 +787,6 @@ function parse($TEXT, options) {
return function() {
var start = S.token;
var expr = parser();
if (!expr) croak("Expected expression");

var end = prev();
expr.start = start;
expr.end = end;
Expand Down Expand Up @@ -930,11 +928,9 @@ function parse($TEXT, options) {
expression : parenthesised(),
body : statement()
});

default:
unexpected();
}
}
unexpected();
});

function labeled_statement() {
Expand Down
2 changes: 1 addition & 1 deletion test/mocha/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ describe("bin/uglifyjs", function () {
assert.strictEqual(lines[0], "Parse error at test/input/invalid/loop-no-body.js:2,0");
assert.strictEqual(lines[1], "for (var i = 0; i < 1; i++) ");
assert.strictEqual(lines[2], " ^");
assert.strictEqual(lines[3], "SyntaxError: Expected expression");
assert.strictEqual(lines[3], "SyntaxError: Unexpected token: eof (undefined)");
done();
});
});
Expand Down

0 comments on commit cf45e2f

Please sign in to comment.