From: Alex Lam S.L Date: Tue, 9 Feb 2021 06:21:15 +0000 (+0000) Subject: fix corner case with template literals (#4631) X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=14fedbf123a5d8a86621ac6aa996042ee0011b47;p=UglifyJS.git fix corner case with template literals (#4631) fixes #4630 --- diff --git a/lib/parse.js b/lib/parse.js index c8f63d80..b926f188 100644 --- a/lib/parse.js +++ b/lib/parse.js @@ -249,6 +249,7 @@ function tokenizer($TEXT, filename, html5_comments, shebang) { if (peek() == "{") { next(); strings.push(s); + S.regex_allowed = true; return true; } } diff --git a/test/compress/templates.js b/test/compress/templates.js index 0be46df0..8ea4d396 100644 --- a/test/compress/templates.js +++ b/test/compress/templates.js @@ -283,3 +283,18 @@ issue_4606: { expect_stdout: "undefined \r \\ `" node_version: ">=4" } + +issue_4630: { + options = { + evaluate: true, + templates: true, + } + input: { + console.log(`${/PASS/}`); + } + expect: { + console.log("/PASS/"); + } + expect_stdout: "/PASS/" + node_version: ">=4" +}