Make distinction between * method and * operator
Also add quotes to properties when necessary, this might be the case if the name isn't a valid identifier
This commit is contained in:
@@ -888,7 +888,11 @@ function OutputStream(options) {
|
||||
}
|
||||
}
|
||||
if (self.name instanceof AST_Symbol) {
|
||||
self.name.print(output);
|
||||
if (typeof self.name.name === "string" && !is_identifier_string(self.name.name)) {
|
||||
output.print_string(self.name.name);
|
||||
} else {
|
||||
self.name.print(output);
|
||||
}
|
||||
} else if (nokeyword && self.name instanceof AST_Node) {
|
||||
output.with_square(function() {
|
||||
self.name.print(output); // Computed method name
|
||||
@@ -1450,15 +1454,19 @@ function OutputStream(options) {
|
||||
output.colon();
|
||||
self.value.print(output);
|
||||
});
|
||||
DEFPRINT(AST_ObjectSetter, function(self, output){
|
||||
AST_ObjectProperty.DEFMETHOD("_print_getter_setter", function(type, self, output) {
|
||||
if (self.static) {
|
||||
output.print("static");
|
||||
output.space();
|
||||
}
|
||||
output.print("set");
|
||||
output.print(type);
|
||||
output.space();
|
||||
if (self.key instanceof AST_SymbolMethod) {
|
||||
self.key.print(output);
|
||||
if (typeof self.key.name === "string" && !is_identifier_string(self.key.name)) {
|
||||
output.print_string(self.key.name);
|
||||
} else {
|
||||
self.key.print(output);
|
||||
}
|
||||
} else {
|
||||
output.with_square(function() {
|
||||
self.key.print(output);
|
||||
@@ -1466,21 +1474,11 @@ function OutputStream(options) {
|
||||
}
|
||||
self.value._do_print(output, true);
|
||||
});
|
||||
DEFPRINT(AST_ObjectSetter, function(self, output){
|
||||
self._print_getter_setter("set", self, output);
|
||||
});
|
||||
DEFPRINT(AST_ObjectGetter, function(self, output){
|
||||
if (self.static) {
|
||||
output.print("static");
|
||||
output.space();
|
||||
}
|
||||
output.print("get");
|
||||
output.space();
|
||||
if (self.key instanceof AST_SymbolMethod) {
|
||||
self.key.print(output);
|
||||
} else {
|
||||
output.with_square(function() {
|
||||
self.key.print(output);
|
||||
});
|
||||
}
|
||||
self.value._do_print(output, true);
|
||||
self._print_getter_setter("get", self, output);
|
||||
});
|
||||
DEFPRINT(AST_ObjectComputedKeyVal, function(self, output) {
|
||||
output.print("[");
|
||||
|
||||
Reference in New Issue
Block a user