void-payloads, multi-pattern arms, and range patterns (match statements)
This commit is contained in:
@@ -211,7 +211,9 @@ lower_compound_expr :: proc(state: ^State, expr_id: hir.Expr_Id) -> ir.Instructi
|
||||
case .Array, .Struct:
|
||||
args := make([]ir.Instruction_Id, len(expr.args), state.allocator)
|
||||
for arg, index in expr.args {
|
||||
args[index] = lower_nested_expr(state, arg)
|
||||
// A void union variant (`T{ variant }`) has no payload operand; leave it
|
||||
// invalid so codegen emits only the tag, not a trapping recovery value.
|
||||
args[index] = lower_nested_expr(state, arg) if arg != hir.INVALID_EXPR else ir.INVALID_INSTRUCTION
|
||||
}
|
||||
return append_instruction(state, ir.Instruction{
|
||||
op=.Aggregate, span=expr.span, type=expr.type, args=args, integer=expr.integer,
|
||||
|
||||
Reference in New Issue
Block a user