| ... | @@ -459,10 +459,12 @@ const Parser = struct { | ... | @@ -459,10 +459,12 @@ const Parser = struct { |
| 459 | switch (@typeInfo(@TypeOf(out.*))) { | 459 | switch (@typeInfo(@TypeOf(out.*))) { |
| 460 | .optional => |optional| if (node.get(self.zoir) == .null) { | 460 | .optional => |optional| if (node.get(self.zoir) == .null) { |
| 461 | out.* = null; | 461 | out.* = null; |
| | 462 | } else if (initialized and out.* != null) { |
| | 463 | try self.parseExprInnerInto(node, &out.*.?, true); |
| 462 | } else { | 464 | } else { |
| 463 | const child_initialized = initialized and out.* != null; | 465 | var some: optional.child = undefined; |
| 464 | if (!child_initialized) out.* = @as(optional.child, undefined); | 466 | try self.parseExprInnerInto(node, &some, false); |
| 465 | try self.parseExprInnerInto(node, &out.*.?, child_initialized); | 467 | out.* = some; |
| 466 | }, | 468 | }, |
| 467 | .bool => out.* = try self.parseBool(node), | 469 | .bool => out.* = try self.parseBool(node), |
| 468 | .int => out.* = try self.parseInt(@TypeOf(out.*), node), | 470 | .int => out.* = try self.parseInt(@TypeOf(out.*), node), |