diff --git a/src/baby_list.zig b/src/baby_list.zig index 7537582546..bb6e9969ec 100644 --- a/src/baby_list.zig +++ b/src/baby_list.zig @@ -13,9 +13,15 @@ pub fn BabyList(comptime Type: type) type { len: u32 = 0, cap: u32 = 0, + pub fn ensureUnusedCapacity(this: *@This(), allocator: std.mem.Allocator, count: usize) !void { + var list_ = this.listManaged(allocator); + try list_.ensureUnusedCapacity(count); + this.update(list_); + } + pub fn append(this: *@This(), allocator: std.mem.Allocator, value: Type) !void { if (this.len + 1 < this.cap) { - var list_ = listManaged(allocator); + var list_ = this.listManaged(allocator); try list_.ensureUnusedCapacity(1); this.update(list_); } diff --git a/src/js_ast.zig b/src/js_ast.zig index 2dea992f6c..002e68b7f0 100644 --- a/src/js_ast.zig +++ b/src/js_ast.zig @@ -4258,7 +4258,7 @@ pub const Ast = struct { symbols: Symbol.List = Symbol.List{}, module_scope: ?Scope = null, // char_freq: *CharFreq, - exports_ref: ?Ref = null, + exports_ref: Ref = Ref.None, module_ref: ?Ref = null, wrapper_ref: ?Ref = null, require_ref: Ref = Ref.None, @@ -4327,7 +4327,7 @@ pub const ExportsKind = enum { // "exports") with getters for the export names. All named imports to this // module are allowed. Direct named imports reference the corresponding export // directly. Other imports go through property accesses on "exports". - esm_with_dyn, + esm_with_dynamic_fallback, pub fn jsonStringify(self: @This(), opts: anytype, o: anytype) !void { return try std.json.stringify(@tagName(self), opts, o); diff --git a/src/js_parser/js_parser.zig b/src/js_parser/js_parser.zig index d9588fa1ec..50367017a3 100644 --- a/src/js_parser/js_parser.zig +++ b/src/js_parser/js_parser.zig @@ -4460,8 +4460,8 @@ fn NewParser_( } } - for (scope.children.slice) |_, i| { - p.hoistSymbols(scope.children.items[i]); + for (scope.children.slice()) |_, i| { + p.hoistSymbols(scope.children.ptr[i]); } } @@ -7217,9 +7217,9 @@ fn NewParser_( const child = _child orelse continue; if (child.scope.parent == p.current_scope) { - var i: usize = children.len - 1; + var i: usize = children.items.len - 1; while (i >= 0) { - if (children.ptr[i] == child.scope) { + if (children.items[i] == child.scope) { _ = children.orderedRemove(i); break; } @@ -16293,11 +16293,11 @@ fn NewParser_( // by the time we get here. p.scopes_in_order.items[scope_index] = null; // Remove the last child from the parent scope - const last = parent.children.items.len - 1; - if (comptime Environment.allow_assert) assert(parent.children.items[last] == to_flatten); - _ = parent.children.popOrNull(); + const last = parent.children.len - 1; + if (comptime Environment.allow_assert) assert(parent.children.ptr[last] == to_flatten); + parent.children.len -|= 1; - for (to_flatten.children.items) |item| { + for (to_flatten.children.slice()) |item| { item.parent = parent; parent.children.append(p.allocator, item) catch unreachable; }