feat: support checked explicit sentinel slices

This commit is contained in:
2026-10-23 11:18:08 +02:00
parent 7cb4ace0fa
commit 8ab5b71a0c
7 changed files with 465 additions and 31 deletions
+5 -1
View File
@@ -306,9 +306,13 @@ lower_compound_expr :: proc(state: ^State, expr_id: hir.Expr_Id) -> ir.Instructi
args[index] = lower_nested_expr(state, arg)
}
}
checked_sentinel := ir.INVALID_INSTRUCTION
if expr.right != hir.INVALID_EXPR {
checked_sentinel = lower_nested_expr(state, expr.right)
}
return append_instruction(state, ir.Instruction{
op=.Slice, span=expr.span, type=expr.type, args=args,
target=ir.INVALID_REF, a=container, b=ir.INVALID_INSTRUCTION,
target=ir.INVALID_REF, a=container, b=checked_sentinel,
diagnostic=source.INVALID_DIAGNOSTIC,
})
case .Unwrap: