writeNameCache("props", cache);
})();
- var SCOPE_IS_NEEDED = COMPRESS || MANGLE || BEAUTIFY || ARGS.lint;
+ var SCOPE_IS_NEEDED = true;
var TL_CACHE = readNameCache("vars");
if (SCOPE_IS_NEEDED) {
}
}, AST_Constant);
-var AST_Number = DEFNODE("Number", "value", {
+var AST_Number = DEFNODE("Number", "value literal", {
$documentation: "A number literal",
$propdoc: {
- value: "[number] the numeric value"
+ value: "[number] the numeric value",
+ literal: "[string] numeric value as string (optional)"
}
}, AST_Constant);
output.print_string(self.getValue(), self.quote);
});
DEFPRINT(AST_Number, function(self, output){
- if (self.value_string !== undefined && self.scope && self.scope.has_directive('use asm')) {
- output.print(self.value_string);
+ if (self.literal !== undefined
+ && +self.literal === self.value /* paranoid check */
+ && self.scope && self.scope.has_directive('use asm')) {
+ output.print(self.literal);
} else {
output.print(make_num(self.getValue()));
}
if (prefix) num = prefix + num;
var valid = parse_js_number(num);
if (!isNaN(valid)) {
- return token("num", valid);
+ var tok = token("num", valid);
+ if (num.indexOf('.') >= 0) {
+ tok.literal = num;
+ }
+ return tok;
} else {
parse_error("Invalid syntax: " + num);
}
ret = _make_symbol(AST_SymbolRef);
break;
case "num":
- ret = new AST_Number({ start: tok, end: tok, value: tok.value });
- var value_string = $TEXT.substring(tok.pos, tok.endpos);
- if (value_string.indexOf('.') >= 0)
- ret.value_string = value_string;
+ ret = new AST_Number({ start: tok, end: tok, value: tok.value, literal: tok.literal });
break;
case "string":
ret = new AST_String({