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.

This commit is contained in:
kzc
2015-10-05 19:51:09 -04:00
committed by Richard van Velzen
parent c69294c449
commit 593677d2ff
5 changed files with 27 additions and 14 deletions

View File

@@ -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) {