feat: code generation for conditional and switch statements

This commit is contained in:
Brett Broadhurst 2026-03-03 16:22:35 -07:00
parent 889f678dd8
commit d6ff3a40bd
Failed to generate hash of commit
7 changed files with 476 additions and 59 deletions

View file

@ -104,7 +104,7 @@ pub const Node = struct {
},
switch_stmt: struct {
condition_expr: ?*Node,
cases: ?[]*Node,
cases: []*Node,
},
knot_decl: struct {
prototype: *Node,
@ -175,7 +175,7 @@ pub const Node = struct {
tag: Tag,
loc: Span,
condition_expr: ?*Node,
cases_list: ?[]*Node,
cases_list: []*Node,
) !*Node {
const node = try Node.create(gpa, tag, loc);
node.data = .{
@ -227,6 +227,10 @@ pub const Error = struct {
invalid_lvalue,
too_many_arguments,
too_many_parameters,
invalid_else_stmt,
unexpected_else_stmt,
invalid_switch_case,
};
};