| ... | ... | @@ -181,14 +181,19 @@ pub fn parse(gpa: Allocator, source: [:0]const u8, mode: Mode) Allocator.Error!A |
| 181 | 181 | .zon => try parser.parseZon(), |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | const extra_data = try parser.extra_data.toOwnedSlice(gpa); |
| 185 | errdefer gpa.free(extra_data); |
| 186 | const errors = try parser.errors.toOwnedSlice(gpa); |
| 187 | errdefer gpa.free(errors); |
| 188 | |
| 184 | 189 | // TODO experiment with compacting the MultiArrayList slices here |
| 185 | 190 | return Ast{ |
| 186 | 191 | .source = source, |
| 187 | 192 | .mode = mode, |
| 188 | 193 | .tokens = tokens.toOwnedSlice(), |
| 189 | 194 | .nodes = parser.nodes.toOwnedSlice(), |
| 190 | | .extra_data = try parser.extra_data.toOwnedSlice(gpa), |
| 191 | | .errors = try parser.errors.toOwnedSlice(gpa), |
| 195 | .extra_data = extra_data, |
| 196 | .errors = errors, |
| 192 | 197 | }; |
| 193 | 198 | } |
| 194 | 199 | |