From: Anthony Van de Gejuchte Date: Thu, 17 Dec 2015 22:02:35 +0000 (+0100) Subject: Semicolon after do...while statement is optional X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=bd99b004137961b3b604fcd55602835bf6ffc522;p=UglifyJS.git Semicolon after do...while statement is optional --- diff --git a/lib/parse.js b/lib/parse.js index de27d987..4d06ae05 100644 --- a/lib/parse.js +++ b/lib/parse.js @@ -724,9 +724,9 @@ function parse($TEXT, options) { ); }; - function semicolon() { + function semicolon(optional) { if (is("punc", ";")) next(); - else if (!can_insert_semicolon()) unexpected(); + else if (!optional && !can_insert_semicolon()) unexpected(); }; function parenthesised() { @@ -814,7 +814,7 @@ function parse($TEXT, options) { case "do": return new AST_Do({ body : in_loop(statement), - condition : (expect_token("keyword", "while"), tmp = parenthesised(), semicolon(), tmp) + condition : (expect_token("keyword", "while"), tmp = parenthesised(), semicolon(true), tmp) }); case "while":