diff options
author | Anthony Van de Gejuchte <anthonyvdgent@gmail.com> | 2016-06-20 14:18:47 +0200 |
---|---|---|
committer | Richard van Velzen <rvanvelzen1@gmail.com> | 2016-06-20 18:42:17 +0200 |
commit | 85fbf86d7b6517161004c4f7dbfd15df4c282e3e (patch) | |
tree | 666a173c96aad72225b4f0f3ef1c591d33f267e8 | |
parent | aa82027a1721ee7233e92ab1b9f9ced43a8f17cf (diff) | |
download | tracifyjs-85fbf86d7b6517161004c4f7dbfd15df4c282e3e.tar.gz tracifyjs-85fbf86d7b6517161004c4f7dbfd15df4c282e3e.zip |
Keep master in sync with harmony
* Do not mangle when no mangle is required
* Improve use_asm reset while printing code
-rw-r--r-- | lib/output.js | 6 | ||||
-rw-r--r-- | 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] ); |