aboutsummaryrefslogtreecommitdiff
path: root/lib/output.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-12-07 20:29:54 +0000
committerGitHub <noreply@github.com>2020-12-08 04:29:54 +0800
commit336336f53f7f1ba161abc7834da190504afeb27b (patch)
tree610d966c6909345e6904920fad4019ef8fa12e21 /lib/output.js
parent4bde50ce851b9f3c06be99e45e87185cee00ea55 (diff)
downloadtracifyjs-336336f53f7f1ba161abc7834da190504afeb27b.tar.gz
tracifyjs-336336f53f7f1ba161abc7834da190504afeb27b.zip
fix corner case with parentheses around `await` (#4344)
Diffstat (limited to 'lib/output.js')
-rw-r--r--lib/output.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/output.js b/lib/output.js
index bf243862..a6d0d0da 100644
--- a/lib/output.js
+++ b/lib/output.js
@@ -810,6 +810,16 @@ function OutputStream(options) {
return needs_parens_assign_cond(this, output);
});
+ PARENS(AST_Await, function(output) {
+ var p = output.parent();
+ // new (await foo)
+ // (await foo)(bar)
+ if (p instanceof AST_Call) return p.expression === this;
+ // (await foo).prop
+ // (await foo)["prop"]
+ if (p instanceof AST_PropAccess) return p.expression === this;
+ });
+
/* -----[ PRINTERS ]----- */
DEFPRINT(AST_Directive, function(output) {