aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2022-02-16 03:41:57 -0800
committerGravatar Jarred Sumner <jarred@jarredsumner.com> 2022-02-16 03:41:57 -0800
commit6f78decf4407709775666166b1467a48b95984a5 (patch)
tree45573c39242210e8ab286e2d3f2d81897132617c
parent68e5b0d842929347926433c7ca914555c40a9e79 (diff)
downloadbun-6f78decf4407709775666166b1467a48b95984a5.tar.gz
bun-6f78decf4407709775666166b1467a48b95984a5.tar.zst
bun-6f78decf4407709775666166b1467a48b95984a5.zip
Handle empty array when joining expr
-rw-r--r--src/js_ast.zig14
1 files changed, 1 insertions, 13 deletions
diff --git a/src/js_ast.zig b/src/js_ast.zig
index 2f7ea1fc2..749d46fdd 100644
--- a/src/js_ast.zig
+++ b/src/js_ast.zig
@@ -2323,8 +2323,8 @@ pub const Expr = struct {
}
pub fn joinAllWithCommaCallback(all: []Expr, comptime Context: type, ctx: Context, callback: (fn (ctx: anytype, expr: anytype) ?Expr), allocator: std.mem.Allocator) ?Expr {
- std.debug.assert(all.len > 0);
switch (all.len) {
+ 0 => return null,
1 => {
return callback(ctx, all[0]);
},
@@ -4108,17 +4108,6 @@ pub const ArrayBinding = struct {
default_value: ?ExprNodeIndex = null,
};
-pub const SymbolPool = ObjectPool(
- std.ArrayList(Symbol),
- struct {
- pub fn init(allocator: std.mem.Allocator) anyerror!std.ArrayList(Symbol) {
- return std.ArrayList(Symbol).init(allocator);
- }
- }.init,
- true,
- 4,
-);
-
pub const Ast = struct {
approximate_newline_count: usize = 0,
has_lazy_export: bool = false,
@@ -4153,7 +4142,6 @@ pub const Ast = struct {
url_for_css: ?string = null,
parts: []Part,
symbols: []Symbol = &([_]Symbol{}),
- symbol_pool: ?*SymbolPool.Node = null,
module_scope: ?Scope = null,
// char_freq: *CharFreq,
exports_ref: ?Ref = null,