aboutsummaryrefslogtreecommitdiff
path: root/lib/output.js
diff options
context:
space:
mode:
authorkzc <zaxxon2011@gmail.com>2015-10-05 19:51:09 -0400
committerRichard van Velzen <rvanvelzen@experty.com>2015-10-07 10:00:28 +0200
commit593677d2ff04f61a2230c18722ec89b820ee0307 (patch)
tree1d50764328efcbc04d82ffbfb010c09b10cbc539 /lib/output.js
parentc69294c44929d728807bdeabac8a024f108f198b (diff)
downloadtracifyjs-593677d2ff04f61a2230c18722ec89b820ee0307.tar.gz
tracifyjs-593677d2ff04f61a2230c18722ec89b820ee0307.zip
Add proper support for "use asm"; blocks. Disable -c optimization within "use asm"; sections and preserve floating point literals in their original form. Non-asm.js sections are optimized as before. Asm.js sections can still be mangled and minified of whitespace. No special command line flags are required.
Diffstat (limited to 'lib/output.js')
-rw-r--r--lib/output.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/output.js b/lib/output.js
index 3b4c1469..06c1e429 100644
--- a/lib/output.js
+++ b/lib/output.js
@@ -1158,7 +1158,11 @@ function OutputStream(options) {
output.print_string(self.getValue(), self.quote);
});
DEFPRINT(AST_Number, function(self, output){
- output.print(make_num(self.getValue()));
+ if (self.value_string !== undefined && self.scope && self.scope.has_directive('use asm')) {
+ output.print(self.value_string);
+ } else {
+ output.print(make_num(self.getValue()));
+ }
});
function regexp_safe_literal(code) {