Add ecma5 flag for codegen
This commit is contained in:
committed by
Richard van Velzen
parent
63c432f4fa
commit
54a783ba84
@@ -67,7 +67,8 @@ function OutputStream(options) {
|
||||
screw_ie8 : false,
|
||||
preamble : null,
|
||||
quote_style : 0,
|
||||
keep_quoted_props: false
|
||||
keep_quoted_props: false,
|
||||
ecma : 5,
|
||||
}, true);
|
||||
|
||||
var indentation = 0;
|
||||
@@ -80,7 +81,11 @@ function OutputStream(options) {
|
||||
return str.replace(/[\ud800-\udbff][\udc00-\udfff]|[\u0000-\u001f\u007f-\uffff]/g, function(ch) {
|
||||
var code = get_full_char_code(ch, 0).toString(16);
|
||||
|
||||
if ((identifier && code.length === 1) || code.length > 4) {
|
||||
if ((identifier && code.length === 1 && !options.es5) || code.length > 4) {
|
||||
if (options.ecma < 6) {
|
||||
return "\\u" + ch.charCodeAt(0).toString(16) + "\\u"
|
||||
+ ch.charCodeAt(1).toString(16);
|
||||
}
|
||||
return "\\u{" + code + "}";
|
||||
} else if (code.length <= 2 && !identifier) {
|
||||
while (code.length < 2) code = "0" + code;
|
||||
|
||||
Reference in New Issue
Block a user