support spread syntax (#4328)

This commit is contained in:
Alex Lam S.L
2020-12-05 21:19:31 +00:00
committed by GitHub
parent d2d56e301e
commit 1e4985ed9e
8 changed files with 635 additions and 56 deletions

View File

@@ -702,6 +702,8 @@ function OutputStream(options) {
|| p instanceof AST_ObjectProperty
// (1, {foo:2}).foo or (1, {foo:2})["foo"] ==> 2
|| p instanceof AST_PropAccess && p.expression === this
// ...(foo, bar, baz)
|| p instanceof AST_Spread
// !(foo, bar, baz)
|| p instanceof AST_Unary
// var a = (1, 2), b = a + a; ==> b == 4
@@ -1231,6 +1233,10 @@ function OutputStream(options) {
this.property.print(output);
output.print("]");
});
DEFPRINT(AST_Spread, function(output) {
output.print("...");
this.expression.print(output);
});
DEFPRINT(AST_UnaryPrefix, function(output) {
var op = this.operator;
var exp = this.expression;