From 85fbf86d7b6517161004c4f7dbfd15df4c282e3e Mon Sep 17 00:00:00 2001 From: Anthony Van de Gejuchte Date: Mon, 20 Jun 2016 14:18:47 +0200 Subject: [PATCH] Keep master in sync with harmony * Do not mangle when no mangle is required * Improve use_asm reset while printing code --- lib/output.js | 6 +++--- test/mocha/directives.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/output.js b/lib/output.js index 10465e21..5db1356c 100644 --- a/lib/output.js +++ b/lib/output.js @@ -404,7 +404,7 @@ function OutputStream(options) { AST_Node.DEFMETHOD("print", function(stream, force_parens){ var self = this, generator = self._codegen, prev_use_asm = use_asm; - if (self instanceof AST_Directive && self.value == "use asm") { + if (self instanceof AST_Directive && self.value == "use asm" && stream.parent() instanceof AST_Scope) { use_asm = true; } function doit() { @@ -419,7 +419,7 @@ function OutputStream(options) { doit(); } stream.pop_node(); - if (self instanceof AST_Lambda) { + if (self instanceof AST_Scope) { use_asm = prev_use_asm; } }); @@ -1221,7 +1221,7 @@ function OutputStream(options) { output.print_string(self.getValue(), self.quote, in_directive); }); DEFPRINT(AST_Number, function(self, output){ - if (use_asm && self.start.raw != null) { + if (use_asm && self.start && self.start.raw != null) { output.print(self.start.raw); } else { output.print(make_num(self.getValue())); diff --git a/test/mocha/directives.js b/test/mocha/directives.js index 45f454bf..82594758 100644 --- a/test/mocha/directives.js +++ b/test/mocha/directives.js @@ -224,7 +224,7 @@ describe("Directives", function() { for (var i = 0; i < tests.length; i++) { assert.strictEqual( - uglify.minify(tests[i][0], {fromString: true, quote_style: 3, compress: false}).code, + uglify.minify(tests[i][0], {fromString: true, quote_style: 3, compress: false, mangle: false}).code, tests[i][1], tests[i][0] ); -- 2.34.1