From a8029a0ba41cf4dcede78f6611fc9184f8d1b488 Mon Sep 17 00:00:00 2001 From: Anthony Van de Gejuchte Date: Mon, 4 Jul 2016 14:33:16 +0200 Subject: [PATCH] Fix regression in multiline comments with nlb --- lib/parse.js | 1 + test/compress/html_comments.js | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/lib/parse.js b/lib/parse.js index bfbd14d5..3d37152d 100644 --- a/lib/parse.js +++ b/lib/parse.js @@ -444,6 +444,7 @@ function tokenizer($TEXT, filename, html5_comments, shebang) { // update stream position forward(text.length /* doesn't count \r\n as 2 char while S.pos - i does */ + 2); S.comments_before.push(token("comment2", text, true)); + S.newline_before = S.newline_before || text.indexOf("\n") >= 0; S.regex_allowed = regex_allowed; return next_token; }); diff --git a/test/compress/html_comments.js b/test/compress/html_comments.js index 8495b433..39973c3d 100644 --- a/test/compress/html_comments.js +++ b/test/compress/html_comments.js @@ -69,3 +69,12 @@ html_comment_in_string_literal: { } expect_exact: 'function f(){return"\\x3c!--HTML--\\x3ecomment in\\x3c!--string literal--\\x3e"}'; } + +html_comment_after_multiline_comment: { + input: { + var foo; /* +*/--> var bar; + var foobar; + } + expect_exact: "var foo;var foobar;" +}