| ... | @@ -7588,8 +7588,16 @@ void render_const_value(CodeGen *g, Buf *buf, ZigValue *const_val) { | ... | @@ -7588,8 +7588,16 @@ void render_const_value(CodeGen *g, Buf *buf, ZigValue *const_val) { |
| 7588 | } | 7588 | } |
| 7589 | case ZigTypeIdOptional: | 7589 | case ZigTypeIdOptional: |
| 7590 | { | 7590 | { |
| 7591 | if (get_src_ptr_type(const_val->type) != nullptr) | 7591 | ZigType *src_ptr_type = get_src_ptr_type(const_val->type); |
| | 7592 | if (src_ptr_type != nullptr) { |
| | 7593 | if (src_ptr_type->id == ZigTypeIdPointer && !optional_value_is_null(const_val)) { |
| | 7594 | ZigValue tmp = {}; |
| | 7595 | copy_const_val(g, &tmp, const_val); |
| | 7596 | tmp.type = type_entry->data.maybe.child_type; |
| | 7597 | return render_const_val_ptr(g, buf, &tmp, tmp.type); |
| | 7598 | } |
| 7592 | return render_const_val_ptr(g, buf, const_val, type_entry->data.maybe.child_type); | 7599 | return render_const_val_ptr(g, buf, const_val, type_entry->data.maybe.child_type); |
| | 7600 | } |
| 7593 | if (type_entry->data.maybe.child_type->id == ZigTypeIdErrorSet) | 7601 | if (type_entry->data.maybe.child_type->id == ZigTypeIdErrorSet) |
| 7594 | return render_const_val_err_set(g, buf, const_val, type_entry->data.maybe.child_type); | 7602 | return render_const_val_err_set(g, buf, const_val, type_entry->data.maybe.child_type); |
| 7595 | if (const_val->data.x_optional) { | 7603 | if (const_val->data.x_optional) { |