| ... | ... | @@ -6636,12 +6636,14 @@ fn markDeclIndexAlive(mod: *Module, decl_index: Decl.Index) Allocator.Error!void |
| 6636 | 6636 | } |
| 6637 | 6637 | |
| 6638 | 6638 | pub fn addGlobalAssembly(mod: *Module, decl_index: Decl.Index, source: []const u8) !void { |
| 6639 | | try mod.global_assembly.ensureUnusedCapacity(mod.gpa, 1); |
| 6640 | | |
| 6641 | | const duped_source = try mod.gpa.dupe(u8, source); |
| 6642 | | errdefer mod.gpa.free(duped_source); |
| 6643 | | |
| 6644 | | mod.global_assembly.putAssumeCapacityNoClobber(decl_index, duped_source); |
| 6639 | const gop = try mod.global_assembly.getOrPut(mod.gpa, decl_index); |
| 6640 | if (gop.found_existing) { |
| 6641 | const new_value = try std.fmt.allocPrint(mod.gpa, "{s}\n{s}", .{ gop.value_ptr.*, source }); |
| 6642 | mod.gpa.free(gop.value_ptr.*); |
| 6643 | gop.value_ptr.* = new_value; |
| 6644 | } else { |
| 6645 | gop.value_ptr.* = try mod.gpa.dupe(u8, source); |
| 6646 | } |
| 6645 | 6647 | } |
| 6646 | 6648 | |
| 6647 | 6649 | pub fn wantDllExports(mod: Module) bool { |