Merge branch 'master' into harmony

This commit is contained in:
Richard van Velzen
2015-12-26 17:55:38 +01:00
16 changed files with 609 additions and 124 deletions

View File

@@ -95,7 +95,7 @@ function OutputStream(options) {
case "\f": return "\\f";
case "\n": return "\\n";
case "\r": return "\\r";
case "\x0B": return output.option("screw_ie8") ? "\\v" : "\\x0B";
case "\x0B": return options.screw_ie8 ? "\\v" : "\\x0B";
case "\u2028": return "\\u2028";
case "\u2029": return "\\u2029";
case '"': ++dq; return '"';
@@ -382,8 +382,13 @@ function OutputStream(options) {
nodetype.DEFMETHOD("_codegen", generator);
};
var use_asm = false;
AST_Node.DEFMETHOD("print", function(stream, force_parens){
var self = this, generator = self._codegen;
var self = this, generator = self._codegen, prev_use_asm = use_asm;
if (self instanceof AST_Directive && self.value == "use asm") {
use_asm = true;
}
function doit() {
self.add_comments(stream);
self.add_source_map(stream);
@@ -396,6 +401,9 @@ function OutputStream(options) {
doit();
}
stream.pop_node();
if (self instanceof AST_Lambda) {
use_asm = prev_use_asm;
}
});
AST_Node.DEFMETHOD("print_to_string", function(options){
@@ -1311,10 +1319,8 @@ function OutputStream(options) {
output.print_string(self.getValue(), self.quote);
});
DEFPRINT(AST_Number, function(self, output){
if (self.literal !== undefined
&& +self.literal === self.value /* paranoid check */
&& self.scope && self.scope.has_directive('use asm')) {
output.print(self.literal);
if (use_asm && self.start.raw != null) {
output.print(self.start.raw);
} else {
output.print(make_num(self.getValue()));
}