aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-05-02 16:42:15 -0700
committerGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-05-02 16:42:15 -0700
commit26f53dbcd8859a433fcada62f3184ad2edc4a124 (patch)
tree8d94f34db6fd82624616557323f88c60fcda2aef /src
parent320e0460e096a15a58df154bdfa66c9c68ee0b00 (diff)
downloadbun-26f53dbcd8859a433fcada62f3184ad2edc4a124.tar.gz
bun-26f53dbcd8859a433fcada62f3184ad2edc4a124.tar.zst
bun-26f53dbcd8859a433fcada62f3184ad2edc4a124.zip
shorthand
Former-commit-id: 195c69606b8fd09f4276baafcee876201e393835
Diffstat (limited to 'src')
-rw-r--r--src/js_printer.zig15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/js_printer.zig b/src/js_printer.zig
index f0c1fee2e..a62246a56 100644
--- a/src/js_printer.zig
+++ b/src/js_printer.zig
@@ -354,14 +354,15 @@ pub fn NewPrinter(comptime ascii_only: bool) type {
p.print("(");
}
- var i: usize = 0;
- while (i < args.len) : (i += 1) {
- if (i != 0) {}
+ for (args) |arg, i| {
+ if (i != 0) {
+ p.print(",");
+ p.printSpace();
+ }
if (has_rest_arg and i + 1 == args.len) {
p.print("...");
}
- const arg = args[i];
p.printBinding(arg.binding);
if (arg.default) |default| {
@@ -1695,7 +1696,11 @@ pub fn NewPrinter(comptime ascii_only: bool) type {
if (item.value) |val| {
switch (val.data) {
.e_identifier => |e| {
- if (strings.utf16EqlString(key.value, p.renamer.nameForSymbol(e.ref))) {
+ // TODO: is needing to check item.flags.was_shorthand a bug?
+ // esbuild doesn't have to do that...
+ // maybe it's a symptom of some other underlying issue
+ // or maybe, it's because i'm not lowering the same way that esbuild does.
+ if (item.flags.was_shorthand or strings.utf16EqlString(key.value, p.renamer.nameForSymbol(e.ref))) {
if (item.initializer) |initial| {
p.printInitializer(initial);
}