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 328085e commit a4e659f
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/compiler.zig
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,9 @@ pub const Compiler = struct {
try node.children.append(bough_node);
},
.fork => |f| {
var buf: [11]u8 = undefined;
var fbs = std.io.fixedBufferStream(&buf);
try fbs.writer().writeByte('_');
var v_node = self.visit_tree.current;
try std.fmt.formatIntValue(v_node.anon_count, "", .{}, fbs.writer());
const fork_count = std.mem.trim(u8, buf[0..], &[_]u8{170});
const fork_count = try std.fmt.allocPrint(self.allocator, "_{d}", .{v_node.anon_count});
defer self.allocator.free(fork_count);
v_node.anon_count += 1;

try self.compileVisitDecl(f.name orelse fork_count, stmt.token);
Expand Down

0 comments on commit a4e659f

Please sign in to comment.