aboutsummaryrefslogtreecommitdiff
path: root/lib/output.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-12-05 21:19:31 +0000
committerGitHub <noreply@github.com>2020-12-06 05:19:31 +0800
commit1e4985ed9e0822118ad01313af09008af1e9f036 (patch)
treea30030887031071c32dce0a37841732fe8c66cf5 /lib/output.js
parentd2d56e301ecd8f6af056ccd355f940e11c851bd5 (diff)
downloadtracifyjs-1e4985ed9e0822118ad01313af09008af1e9f036.tar.gz
tracifyjs-1e4985ed9e0822118ad01313af09008af1e9f036.zip
support spread syntax (#4328)
Diffstat (limited to 'lib/output.js')
-rw-r--r--lib/output.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/output.js b/lib/output.js
index 218372a8..5830f2e7 100644
--- a/lib/output.js
+++ b/lib/output.js
@@ -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;