Commit 3f7bab7373
Changed files (2)
lib
std
zig
src-self-hosted
lib/std/zig/ast.zig
@@ -13,6 +13,7 @@ pub const Tree = struct {
root_node: *Node.Root,
arena_allocator: std.heap.ArenaAllocator,
errors: ErrorList,
+ generated: bool = false,
pub const TokenList = SegmentedList(Token, 64);
pub const ErrorList = SegmentedList(Error, 0);
@@ -58,6 +59,8 @@ pub const Tree = struct {
.line_start = start_index,
.line_end = self.source.len,
};
+ if (self.generated)
+ return loc;
const token_start = token.start;
for (self.source[start_index..]) |c, i| {
if (i + start_index == token_start) {
src-self-hosted/translate_c.zig
@@ -249,6 +249,7 @@ pub fn translate(
.arena_allocator = tree_arena,
.tokens = undefined, // can't reference the allocator yet
.errors = undefined, // can't reference the allocator yet
+ .generated = true,
};
break :blk tree;
};