| ... | @@ -1063,13 +1063,12 @@ pub fn genTypedValue( | ... | @@ -1063,13 +1063,12 @@ pub fn genTypedValue( |
| 1063 | }, | 1063 | }, |
| 1064 | .Optional => { | 1064 | .Optional => { |
| 1065 | if (typed_value.ty.isPtrLikeOptional()) { | 1065 | if (typed_value.ty.isPtrLikeOptional()) { |
| 1066 | if (typed_value.val.isNull()) | 1066 | if (typed_value.val.tag() == .null_value) return GenResult.mcv(.{ .immediate = 0 }); |
| 1067 | return GenResult.mcv(.{ .immediate = 0 }); | | |
| 1068 | | 1067 | |
| 1069 | var buf: Type.Payload.ElemType = undefined; | 1068 | var buf: Type.Payload.ElemType = undefined; |
| 1070 | return genTypedValue(bin_file, src_loc, .{ | 1069 | return genTypedValue(bin_file, src_loc, .{ |
| 1071 | .ty = typed_value.ty.optionalChild(&buf), | 1070 | .ty = typed_value.ty.optionalChild(&buf), |
| 1072 | .val = typed_value.val, | 1071 | .val = if (typed_value.val.castTag(.opt_payload)) |pl| pl.data else typed_value.val, |
| 1073 | }, owner_decl_index); | 1072 | }, owner_decl_index); |
| 1074 | } else if (typed_value.ty.abiSize(target) == 1) { | 1073 | } else if (typed_value.ty.abiSize(target) == 1) { |
| 1075 | return GenResult.mcv(.{ .immediate = @boolToInt(!typed_value.val.isNull()) }); | 1074 | return GenResult.mcv(.{ .immediate = @boolToInt(!typed_value.val.isNull()) }); |