fix #1003 by removing AST_ObjectSymbol and using AST_ObjectKeyVal for the same effect

This commit is contained in:
Fábio Santos
2016-03-12 15:53:57 +00:00
committed by Richard van Velzen
parent accca2445f
commit 6d2f77c180
6 changed files with 32 additions and 48 deletions

View File

@@ -1301,6 +1301,14 @@ function OutputStream(options) {
DEFPRINT(AST_ObjectKeyVal, function(self, output){
var key = self.key;
var quote = self.quote;
var print_as_shorthand = self.shorthand &&
self.value instanceof AST_Symbol &&
self.key == self.value.print_to_string();
if (print_as_shorthand) {
output.print_name(key);
return;
}
if (output.option("quote_keys")) {
output.print_string(key + "");
} else if ((typeof key == "number"
@@ -1359,23 +1367,6 @@ function OutputStream(options) {
self.default.print(output)
}
});
DEFPRINT(AST_ObjectSymbol, function(self, output){
var name = self.mangled_key || self.symbol.name;
var def = self.symbol.definition();
if (def && def.mangled_name) {
output.print(name);
output.print(':');
output.space();
output.print(def.mangled_name);
} else if (!(def && def.mangled_name) && self.mangled_key) {
output.print(name);
output.print(':');
output.space();
output.print(def.name);
} else {
output.print(name);
}
});
DEFPRINT(AST_Undefined, function(self, output){
output.print("void 0");
});