unify catch fallback value sources
This commit is contained in:
@@ -468,9 +468,8 @@ lower_compound_expr :: proc(state: ^State, expr_id: hir.Expr_Id) -> ir.Instructi
|
||||
diagnostic=source.INVALID_DIAGNOSTIC,
|
||||
})
|
||||
} else {
|
||||
if expr.integer != hir.CATCH_EXPRESSION {
|
||||
capture := hir.as_local(expr.target)
|
||||
if capture != hir.INVALID_LOCAL && int(capture) < len(state.func_locals) {
|
||||
capture := hir.as_local(expr.target)
|
||||
if capture != hir.INVALID_LOCAL && int(capture) < len(state.func_locals) {
|
||||
error_type := state.func_locals[capture].type
|
||||
error_value := append_instruction(state, ir.Instruction{
|
||||
op=.Fallible_Error, span=expr.span, type=error_type,
|
||||
@@ -489,7 +488,8 @@ lower_compound_expr :: proc(state: ^State, expr_id: hir.Expr_Id) -> ir.Instructi
|
||||
target=ir.INVALID_REF, a=capture_slot, b=error_value,
|
||||
diagnostic=source.INVALID_DIAGNOSTIC,
|
||||
})
|
||||
}
|
||||
}
|
||||
if expr.integer != hir.CATCH_EXPRESSION {
|
||||
lower_statements(state, expr.body)
|
||||
if expr.integer == hir.CATCH_VOID_FALLTHROUGH {
|
||||
append_instruction(state, ir.Instruction{
|
||||
|
||||
Reference in New Issue
Block a user