| ... | ... | @@ -421,7 +421,7 @@ pub const Wip = struct { |
| 421 | 421 | _ = try addExtra(wip, rt); |
| 422 | 422 | } |
| 423 | 423 | |
| 424 | | pub fn addBundle(wip: *Wip, other: ErrorBundle) !void { |
| 424 | pub fn addBundleAsNotes(wip: *Wip, other: ErrorBundle) !void { |
| 425 | 425 | const gpa = wip.gpa; |
| 426 | 426 | |
| 427 | 427 | try wip.string_bytes.ensureUnusedCapacity(gpa, other.string_bytes.len); |
| ... | ... | @@ -436,6 +436,21 @@ pub const Wip = struct { |
| 436 | 436 | } |
| 437 | 437 | } |
| 438 | 438 | |
| 439 | pub fn addBundleAsRoots(wip: *Wip, other: ErrorBundle) !void { |
| 440 | const gpa = wip.gpa; |
| 441 | |
| 442 | try wip.string_bytes.ensureUnusedCapacity(gpa, other.string_bytes.len); |
| 443 | try wip.extra.ensureUnusedCapacity(gpa, other.extra.len); |
| 444 | |
| 445 | const other_list = other.getMessages(); |
| 446 | |
| 447 | try wip.root_list.ensureUnusedCapacity(gpa, other_list.len); |
| 448 | for (other_list) |other_msg| { |
| 449 | // The ensureUnusedCapacity calls above guarantees this. |
| 450 | wip.root_list.appendAssumeCapacity(wip.addOtherMessage(other, other_msg) catch unreachable); |
| 451 | } |
| 452 | } |
| 453 | |
| 439 | 454 | pub fn reserveNotes(wip: *Wip, notes_len: u32) !u32 { |
| 440 | 455 | try wip.extra.ensureUnusedCapacity(wip.gpa, notes_len + |
| 441 | 456 | notes_len * @typeInfo(ErrorBundle.ErrorMessage).Struct.fields.len); |