Skip to content

Commit cf45e2f

Browse files
authored
fixup for #1585 (#1589)
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.
1 parent 8354758 commit cf45e2f

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

lib/parse.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -787,8 +787,6 @@ function parse($TEXT, options) {
787787
return function() {
788788
var start = S.token;
789789
var expr = parser();
790-
if (!expr) croak("Expected expression");
791-
792790
var end = prev();
793791
expr.start = start;
794792
expr.end = end;
@@ -930,11 +928,9 @@ function parse($TEXT, options) {
930928
expression : parenthesised(),
931929
body : statement()
932930
});
933-
934-
default:
935-
unexpected();
936931
}
937932
}
933+
unexpected();
938934
});
939935

940936
function labeled_statement() {

test/mocha/cli.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ describe("bin/uglifyjs", function () {
247247
assert.strictEqual(lines[0], "Parse error at test/input/invalid/loop-no-body.js:2,0");
248248
assert.strictEqual(lines[1], "for (var i = 0; i < 1; i++) ");
249249
assert.strictEqual(lines[2], " ^");
250-
assert.strictEqual(lines[3], "SyntaxError: Expected expression");
250+
assert.strictEqual(lines[3], "SyntaxError: Unexpected token: eof (undefined)");
251251
done();
252252
});
253253
});

0 commit comments

Comments
 (0)