rename none to null

This commit is contained in:
2026-07-21 22:59:51 +02:00
parent 1619ea98a3
commit 402871ef7a
44 changed files with 3771 additions and 3767 deletions
+4 -4
View File
@@ -275,7 +275,7 @@ valid_value :: proc(
return false
}
switch instructions[value_id].op {
case .Param, .Const, .Poison, .String, .Aggregate, .None, .Optional_Some,
case .Param, .Const, .Poison, .String, .Aggregate, .Null, .Optional_Some,
.Load_Global, .Function_Address, .Address_Of, .Load, .Union_Tag, .Slice, .Length, .Slice_Ptr,
.Fallible_Error, .Extract, .Select, .Unwrap,
.Optional_Is_Some, .Optional_Value, .Orelse,
@@ -1109,10 +1109,10 @@ emit_instruction_stream :: proc(
}
fmt.sbprintf(&emitter.builder, ", %d\n", arg_index)
}
case .None:
case .Null:
item, ok := types.node(&emitter.module.types, instruction.type)
if !ok || item.kind != .Optional {
emit_recovery_value(emitter, instruction_index, instruction, "invalid optional none")
emit_recovery_value(emitter, instruction_index, instruction, "invalid optional null")
continue
}
if types.is_pointer(item.child, &emitter.module.types) {
@@ -1656,7 +1656,7 @@ emit_instruction_stream :: proc(
fmt.sbprintf(&emitter.builder, " %%optional_ok%d = extractvalue %s %%v%d, 0\n", instruction_index, llvm_type(optional_type, &emitter.module.types), instruction.a)
}
fmt.sbprintf(&emitter.builder, " br i1 %%optional_ok%d, label %%optional_continue%d, label %%optional_trap%d\noptional_trap%d:\n", instruction_index, instruction_index, instruction_index, instruction_index)
message := diagnostic_message(emitter, source.INVALID_DIAGNOSTIC, instruction.span, "attempted to unwrap none")
message := diagnostic_message(emitter, source.INVALID_DIAGNOSTIC, instruction.span, "attempted to unwrap null")
emit_trap_call(emitter, message)
fmt.sbprintf(&emitter.builder, " unreachable\noptional_continue%d:\n", instruction_index)
if types.is_pointer(item.child, &emitter.module.types) {