simplify traversal logic (#4063)
This commit is contained in:
@@ -1174,10 +1174,7 @@ function OutputStream(options) {
|
||||
});
|
||||
|
||||
/* -----[ other expressions ]----- */
|
||||
DEFPRINT(AST_Call, function(self, output) {
|
||||
self.expression.print(output);
|
||||
if (self instanceof AST_New && !need_constructor_parens(self, output))
|
||||
return;
|
||||
function print_call_args(self, output) {
|
||||
if (self.expression instanceof AST_Call || self.expression instanceof AST_Lambda) {
|
||||
output.add_mapping(self.start);
|
||||
}
|
||||
@@ -1187,11 +1184,16 @@ function OutputStream(options) {
|
||||
expr.print(output);
|
||||
});
|
||||
});
|
||||
}
|
||||
DEFPRINT(AST_Call, function(self, output) {
|
||||
self.expression.print(output);
|
||||
print_call_args(self, output);
|
||||
});
|
||||
DEFPRINT(AST_New, function(self, output) {
|
||||
output.print("new");
|
||||
output.space();
|
||||
AST_Call.prototype._codegen(self, output);
|
||||
self.expression.print(output);
|
||||
if (need_constructor_parens(self, output)) print_call_args(self, output);
|
||||
});
|
||||
DEFPRINT(AST_Sequence, function(self, output) {
|
||||
self.expressions.forEach(function(node, index) {
|
||||
|
||||
Reference in New Issue
Block a user