authorgravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2019-12-21 14:40:47+02:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2019-12-29 11:04:58+02:00
log3f7bab73734ce19615e131bd5ec3146ac30a9a85
tree5fe2370fe6c454552c1ee26f40c7f61d9a3008b9
parentfceda07f94c9e4181f97ecacc1bdc1b9a0b7ab16
signature Commit is signed but in an unrecognized format.

fix translate-c taking ages


2 files changed, 4 insertions(+), 0 deletions(-)

lib/std/zig/ast.zig+3
......@@ -13,6 +13,7 @@ pub const Tree = struct {
1313 root_node: *Node.Root,
1414 arena_allocator: std.heap.ArenaAllocator,
1515 errors: ErrorList,
16 generated: bool = false,
1617
1718 pub const TokenList = SegmentedList(Token, 64);
1819 pub const ErrorList = SegmentedList(Error, 0);
......@@ -58,6 +59,8 @@ pub const Tree = struct {
5859 .line_start = start_index,
5960 .line_end = self.source.len,
6061 };
62 if (self.generated)
63 return loc;
6164 const token_start = token.start;
6265 for (self.source[start_index..]) |c, i| {
6366 if (i + start_index == token_start) {
src-self-hosted/translate_c.zig+1
......@@ -249,6 +249,7 @@ pub fn translate(
249249 .arena_allocator = tree_arena,
250250 .tokens = undefined, // can't reference the allocator yet
251251 .errors = undefined, // can't reference the allocator yet
252 .generated = true,
252253 };
253254 break :blk tree;
254255 };