aboutsummaryrefslogtreecommitdiff
path: root/src/js_parser/js_parser.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/js_parser/js_parser.zig')
-rw-r--r--src/js_parser/js_parser.zig15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/js_parser/js_parser.zig b/src/js_parser/js_parser.zig
index cb3e0ff0c..63ca64b01 100644
--- a/src/js_parser/js_parser.zig
+++ b/src/js_parser/js_parser.zig
@@ -1030,7 +1030,9 @@ pub const SideEffects = enum(u2) {
// A call that has been marked "__PURE__" can be removed if all arguments
// can be removed. The annotation causes us to ignore the target.
if (call.can_be_unwrapped_if_unused) {
- return Expr.joinAllWithCommaCallback(call.args, @TypeOf(p), p, simpifyUnusedExpr, p.allocator);
+ if (call.args.len > 0) {
+ return Expr.joinAllWithCommaCallback(call.args, @TypeOf(p), p, simpifyUnusedExpr, p.allocator);
+ }
}
},
@@ -1077,7 +1079,9 @@ pub const SideEffects = enum(u2) {
// A constructor call that has been marked "__PURE__" can be removed if all arguments
// can be removed. The annotation causes us to ignore the target.
if (call.can_be_unwrapped_if_unused) {
- return Expr.joinAllWithComma(call.args, p.allocator);
+ if (call.args.len > 0) {
+ return Expr.joinAllWithComma(call.args, p.allocator);
+ }
}
},
else => {},
@@ -12548,9 +12552,8 @@ pub fn NewParser(
return false;
}
}
+ return true;
}
-
- return true;
},
.e_new => |ex| {
@@ -12562,9 +12565,9 @@ pub fn NewParser(
return false;
}
}
- }
- return true;
+ return true;
+ }
},
.e_unary => |ex| {
switch (ex.op) {