| ... | ... | @@ -100,14 +100,19 @@ pub fn parse(gpa: Allocator, source: [:0]const u8, mode: Mode) Allocator.Error!A |
| 100 | 100 | .zon => try parser.parseZon(), |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | const extra_data = try parser.extra_data.toOwnedSlice(gpa); |
| 104 | errdefer gpa.free(extra_data); |
| 105 | const errors = try parser.errors.toOwnedSlice(gpa); |
| 106 | errdefer gpa.free(errors); |
| 107 | |
| 103 | 108 | // TODO experiment with compacting the MultiArrayList slices here |
| 104 | 109 | return Ast{ |
| 105 | 110 | .source = source, |
| 106 | 111 | .mode = mode, |
| 107 | 112 | .tokens = tokens.toOwnedSlice(), |
| 108 | 113 | .nodes = parser.nodes.toOwnedSlice(), |
| 109 | | .extra_data = try parser.extra_data.toOwnedSlice(gpa), |
| 110 | | .errors = try parser.errors.toOwnedSlice(gpa), |
| 114 | .extra_data = extra_data, |
| 115 | .errors = errors, |
| 111 | 116 | }; |
| 112 | 117 | } |
| 113 | 118 | |