| author | |
| committer | |
| log | 3f7bab73734ce19615e131bd5ec3146ac30a9a85 |
| tree | 5fe2370fe6c454552c1ee26f40c7f61d9a3008b9 |
| parent | fceda07f94c9e4181f97ecacc1bdc1b9a0b7ab16 |
| signature | Commit is signed but in an unrecognized format. |
2 files changed, 4 insertions(+), 0 deletions(-)
lib/std/zig/ast.zig+3| ... | ... | @@ -13,6 +13,7 @@ pub const Tree = struct { |
| 13 | 13 | root_node: *Node.Root, |
| 14 | 14 | arena_allocator: std.heap.ArenaAllocator, |
| 15 | 15 | errors: ErrorList, |
| 16 | generated: bool = false, | |
| 16 | 17 | |
| 17 | 18 | pub const TokenList = SegmentedList(Token, 64); |
| 18 | 19 | pub const ErrorList = SegmentedList(Error, 0); |
| ... | ... | @@ -58,6 +59,8 @@ pub const Tree = struct { |
| 58 | 59 | .line_start = start_index, |
| 59 | 60 | .line_end = self.source.len, |
| 60 | 61 | }; |
| 62 | if (self.generated) | |
| 63 | return loc; | |
| 61 | 64 | const token_start = token.start; |
| 62 | 65 | for (self.source[start_index..]) |c, i| { |
| 63 | 66 | if (i + start_index == token_start) { |
src-self-hosted/translate_c.zig+1| ... | ... | @@ -249,6 +249,7 @@ pub fn translate( |
| 249 | 249 | .arena_allocator = tree_arena, |
| 250 | 250 | .tokens = undefined, // can't reference the allocator yet |
| 251 | 251 | .errors = undefined, // can't reference the allocator yet |
| 252 | .generated = true, | |
| 252 | 253 | }; |
| 253 | 254 | break :blk tree; |
| 254 | 255 | }; |