fix: content behavior bugs
This commit is contained in:
parent
2260ccda25
commit
11d99fba38
59 changed files with 243 additions and 31 deletions
|
|
@ -1224,7 +1224,34 @@ fn divertExpr(gi: *GenIr, scope: *Scope, node: *const Ast.Node) !void {
|
|||
// FIXME: Oh God, the AST is completely fucked for this.
|
||||
const lhs = node.data.bin.lhs.?;
|
||||
switch (lhs.tag) {
|
||||
.identifier, .selector_expr => {
|
||||
.identifier => {
|
||||
// TODO: Revisit this
|
||||
const str_slice = gi.astgen.tree.nodeSlice(lhs);
|
||||
if (std.mem.eql(u8, str_slice, "DONE")) {
|
||||
_ = try gi.addUnaryNode(.done, .none);
|
||||
return;
|
||||
} else if (std.mem.eql(u8, str_slice, "END")) {
|
||||
_ = try gi.addUnaryNode(.exit, .none);
|
||||
return;
|
||||
}
|
||||
const callee = try calleeExpr(gi, scope, lhs);
|
||||
switch (callee) {
|
||||
.direct => |callee_obj| {
|
||||
_ = try gi.addPayloadNode(.divert, lhs, Ir.Inst.Call{
|
||||
.callee = callee_obj,
|
||||
.args_len = 0,
|
||||
});
|
||||
},
|
||||
.field => |callee_field| {
|
||||
_ = try gi.addPayloadNode(.field_divert, lhs, Ir.Inst.FieldCall{
|
||||
.obj_ptr = callee_field.obj_ptr,
|
||||
.field_name_start = callee_field.field_name_start,
|
||||
.args_len = 0,
|
||||
});
|
||||
},
|
||||
}
|
||||
},
|
||||
.selector_expr => {
|
||||
const callee = try calleeExpr(gi, scope, lhs);
|
||||
switch (callee) {
|
||||
.direct => |callee_obj| {
|
||||
|
|
@ -1310,7 +1337,7 @@ fn blockInner(gi: *GenIr, parent_scope: *Scope, stmt_list: []*Ast.Node) !void {
|
|||
.choice_stmt => try choiceStmt(gi, &child_scope, inner_node),
|
||||
.expr_stmt => try exprStmt(gi, &child_scope, inner_node),
|
||||
.divert_stmt => try divertStmt(gi, &child_scope, inner_node),
|
||||
else => unreachable,
|
||||
inline else => |e| @panic("Unexpected node: " ++ @tagName(e)),
|
||||
};
|
||||
}
|
||||
_ = try gi.addUnaryNode(.implicit_ret, .none);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue