diff --git a/lib/compress.js b/lib/compress.js index 1c052dd2..315a18c7 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -3148,7 +3148,6 @@ merge(Compressor.prototype, { } if (this.pure) { compressor.warn("Dropping __PURE__ call [{file}:{line},{col}]", this.start); - this.pure.value = this.pure.value.replace(/[@#]__PURE__/g, ' '); } var args = trim(this.args, compressor, first_in_statement); return args && make_sequence(this, args); diff --git a/lib/output.js b/lib/output.js index 98452e47..fc592d60 100644 --- a/lib/output.js +++ b/lib/output.js @@ -510,11 +510,11 @@ function OutputStream(options) { } } if (/comment[134]/.test(c.type)) { - print("//" + c.value + "\n"); + print("//" + c.value.replace(/[@#]__PURE__/g, ' ') + "\n"); indent(); last_nlb = true; } else if (c.type == "comment2") { - print("/*" + c.value + "*/"); + print("/*" + c.value.replace(/[@#]__PURE__/g, ' ') + "*/"); last_nlb = false; } }); @@ -550,10 +550,10 @@ function OutputStream(options) { space(); } if (/comment[134]/.test(c.type)) { - print("//" + c.value); + print("//" + c.value.replace(/[@#]__PURE__/g, ' ')); need_newline_indented = true; } else if (c.type == "comment2") { - print("/*" + c.value + "*/"); + print("/*" + c.value.replace(/[@#]__PURE__/g, ' ') + "*/"); need_space = true; } }); diff --git a/test/mocha/minify.js b/test/mocha/minify.js index 5d9512f3..5fa9254b 100644 --- a/test/mocha/minify.js +++ b/test/mocha/minify.js @@ -247,7 +247,7 @@ describe("minify", function() { var code = result.code; assert.strictEqual(code, "// comment1 comment2\nbar();"); }); - it("should not drop #__PURE__ hint if function is retained", function() { + it("should drop #__PURE__ hint if function is retained", function() { var result = Uglify.minify("var a = /*#__PURE__*/(function(){ foo(); })();", { output: { comments: "all", @@ -255,7 +255,7 @@ describe("minify", function() { } }); var code = result.code; - assert.strictEqual(code, "var a=/*#__PURE__*/function(){foo()}();"); + assert.strictEqual(code, "var a=/* */function(){foo()}();"); }) });