@@ -9956,7 +9956,9 @@ merge(Compressor.prototype, {
|
||||
var node = exprs[i];
|
||||
var ev = node.evaluate(compressor);
|
||||
if (ev === node) continue;
|
||||
ev = "" + ev;
|
||||
ev = ("" + ev).replace(/\r|\\|`/g, function(s) {
|
||||
return "\\" + (s == "\r" ? "r" : s);
|
||||
});
|
||||
if (ev.length > node.print_to_string().length + 3) continue;
|
||||
exprs.splice(i, 1);
|
||||
strs.splice(i, 2, strs[i] + ev + strs[i + 1]);
|
||||
|
||||
@@ -222,3 +222,18 @@ issue_4604: {
|
||||
expect_stdout: "PASS"
|
||||
node_version: ">=4"
|
||||
}
|
||||
|
||||
issue_4606: {
|
||||
options = {
|
||||
evaluate: true,
|
||||
templates: true,
|
||||
}
|
||||
input: {
|
||||
console.log(`${typeof A} ${"\r"} ${"\\"} ${"`"}`);
|
||||
}
|
||||
expect: {
|
||||
console.log(`${typeof A} \r \\ \``);
|
||||
}
|
||||
expect_stdout: "undefined \r \\ `"
|
||||
node_version: ">=4"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user