aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bundler/bundle_v2.zig14
-rw-r--r--src/js_parser.zig8
2 files changed, 13 insertions, 9 deletions
diff --git a/src/bundler/bundle_v2.zig b/src/bundler/bundle_v2.zig
index 304621e50..76cc18877 100644
--- a/src/bundler/bundle_v2.zig
+++ b/src/bundler/bundle_v2.zig
@@ -5699,17 +5699,21 @@ const LinkerContext = struct {
if (shouldStripExports) {
// Turn this statement into "import {foo} from 'path'"
-
- for (s.items) |*item| {
- item.alias = item.original_name;
+ // TODO: is this allocation necessary?
+ var items = allocator.alloc(js_ast.ClauseItem, s.items.len) catch unreachable;
+ for (s.items, items) |src, *dest| {
+ dest.* = .{
+ .alias = src.original_name,
+ .alias_loc = src.alias_loc,
+ .name = src.name,
+ };
}
stmt = Stmt.alloc(
S.Import,
S.Import{
- .items = s.items,
+ .items = items,
.import_record_index = s.import_record_index,
- .star_name_loc = stmt.loc,
.namespace_ref = s.namespace_ref,
.is_single_line = s.is_single_line,
},
diff --git a/src/js_parser.zig b/src/js_parser.zig
index 8776d309f..ebb7a82d7 100644
--- a/src/js_parser.zig
+++ b/src/js_parser.zig
@@ -17052,8 +17052,8 @@ fn NewParser_(
const _name = p.loadNameFromRef(old_ref);
const ref = try p.newSymbol(.other, _name);
- try p.current_scope.generated.push(p.allocator, data.namespace_ref);
- try p.recordDeclaredSymbol(data.namespace_ref);
+ try p.current_scope.generated.push(p.allocator, ref);
+ try p.recordDeclaredSymbol(ref);
data.items[j] = item;
data.items[j].name.ref = ref;
j += 1;
@@ -17070,8 +17070,8 @@ fn NewParser_(
for (data.items) |*item| {
const _name = p.loadNameFromRef(item.name.ref.?);
const ref = try p.newSymbol(.other, _name);
- try p.current_scope.generated.push(p.allocator, data.namespace_ref);
- try p.recordDeclaredSymbol(data.namespace_ref);
+ try p.current_scope.generated.push(p.allocator, ref);
+ try p.recordDeclaredSymbol(ref);
item.name.ref = ref;
}
}