Skip to content

Commit

Permalink
Fix fork node count
Browse files Browse the repository at this point in the history
  • Loading branch information
bgk- committed Apr 28, 2024
1 parent 0a701dd commit 0314755
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/compiler.zig
Original file line number Diff line number Diff line change
Expand Up @@ -472,11 +472,9 @@ pub const Compiler = struct {
try self.setSymbol(symbol, token, true);
},
.fork => |f| {
var buf: [11]u8 = undefined;
var fbs = std.io.fixedBufferStream(&buf);
try fbs.writer().writeByte('_');
try std.fmt.formatIntValue(self.visit_tree.current.anon_count, "", .{}, fbs.writer());
const fork_count = std.mem.trim(u8, buf[0..], &[_]u8{170});
const anon_count = self.visit_tree.current.anon_count;
const fork_count = try std.fmt.allocPrint(self.allocator, "_{d}", .{anon_count});
defer self.allocator.free(fork_count);

self.visit_tree.current.anon_count += 1;
const cur = if (self.visit_tree.current.getChild(f.name orelse fork_count)) |n| n else {
Expand Down

0 comments on commit 0314755

Please sign in to comment.