diff options
author | 2022-02-16 20:34:00 -0800 | |
---|---|---|
committer | 2022-02-16 20:34:00 -0800 | |
commit | 6db46c6d0019932f5bfa87657a8443c40081fb4c (patch) | |
tree | 86c9a656f39529a59bd29fa480ecdf24178f6f63 | |
parent | 4ba0e7b7d88ed84b13dcdcb8f14d523fd34b070f (diff) | |
download | bun-6db46c6d0019932f5bfa87657a8443c40081fb4c.tar.gz bun-6db46c6d0019932f5bfa87657a8443c40081fb4c.tar.zst bun-6db46c6d0019932f5bfa87657a8443c40081fb4c.zip |
Update js_printer.zig
-rw-r--r-- | src/js_printer.zig | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/src/js_printer.zig b/src/js_printer.zig index ec165a355..fc29fa6e2 100644 --- a/src/js_printer.zig +++ b/src/js_printer.zig @@ -1520,14 +1520,9 @@ pub fn NewPrinter( } p.printExpr(item, .comma, ExprFlag.None()); - if (i == items.len - 1) { + if (i == items.len - 1 and item.data == .e_missing) { // Make sure there's a comma after trailing missing items - switch (item.data) { - .e_missing => { - p.print(","); - }, - else => {}, - } + p.print(","); } } @@ -1558,12 +1553,11 @@ pub fn NewPrinter( for (props) |property, i| { if (i != 0) { p.print(","); - if (e.is_single_line) { - p.printSpace(); - } } - if (!e.is_single_line) { + if (e.is_single_line) { + p.printSpace(); + } else { p.printNewline(); p.printIndent(); } @@ -1574,7 +1568,7 @@ pub fn NewPrinter( p.options.unindent(); p.printNewline(); p.printIndent(); - } else if (props.len > 0) { + } else { p.printSpace(); } } @@ -2314,8 +2308,6 @@ pub fn NewPrinter( p.options.unindent(); p.printNewline(); p.printIndent(); - } else { - p.printSpace(); } } |