[Pkg-javascript-commits] [uglifyjs] 103/228: fixup for #1585 (#1589)

Jonas Smedegaard dr at jones.dk
Sat Apr 15 14:25:21 UTC 2017


This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository uglifyjs.

commit cf45e2f79b543ebae60c5de54166b20da4522c25
Author: Alex Lam S.L <alexlamsl at gmail.com>
Date:   Fri Mar 10 10:49:41 2017 +0800

    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.
---
 lib/parse.js      | 6 +-----
 test/mocha/cli.js | 2 +-
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/lib/parse.js b/lib/parse.js
index 5e14086..25fe931 100644
--- a/lib/parse.js
+++ b/lib/parse.js
@@ -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;
@@ -930,11 +928,9 @@ function parse($TEXT, options) {
                     expression : parenthesised(),
                     body       : statement()
                 });
-
-              default:
-                unexpected();
             }
         }
+        unexpected();
     });
 
     function labeled_statement() {
diff --git a/test/mocha/cli.js b/test/mocha/cli.js
index 0b4fe00..fa952d9 100644
--- a/test/mocha/cli.js
+++ b/test/mocha/cli.js
@@ -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();
         });
     });

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/uglifyjs.git



More information about the Pkg-javascript-commits mailing list