feat: code generation for conditional and switch statements
This commit is contained in:
parent
889f678dd8
commit
d6ff3a40bd
7 changed files with 476 additions and 59 deletions
|
|
@ -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,
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue