support default values (#4442)
This commit is contained in:
@@ -702,6 +702,8 @@ function OutputStream(options) {
|
||||
// (false, true) ? (a = 10, b = 20) : (c = 30)
|
||||
// ==> 20 (side effect, set a := 10 and b := 20)
|
||||
|| p instanceof AST_Conditional
|
||||
// [ a = (1, 2) ] = [] ==> a == 2
|
||||
|| p instanceof AST_DefaultValue
|
||||
// { [(1, 2)]: 3 }[2] ==> 3
|
||||
// { foo: (1, 2) }.foo ==> 2
|
||||
|| p instanceof AST_DestructuredKeyVal
|
||||
@@ -1218,6 +1220,15 @@ function OutputStream(options) {
|
||||
}
|
||||
});
|
||||
|
||||
DEFPRINT(AST_DefaultValue, function(output) {
|
||||
var self = this;
|
||||
self.name.print(output);
|
||||
output.space();
|
||||
output.print("=");
|
||||
output.space();
|
||||
self.value.print(output);
|
||||
});
|
||||
|
||||
/* -----[ other expressions ]----- */
|
||||
function print_call_args(self, output) {
|
||||
if (self.expression instanceof AST_Call || self.expression instanceof AST_Lambda) {
|
||||
|
||||
Reference in New Issue
Block a user