authorgravatar for matthew.h.borkowski@gmail.comMatthew Borkowski <matthew.h.borkowski@gmail.com> 2021-06-05 17:22:08-04:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2021-06-08 22:24:55+03:00
log39c80942e76be0d40b2e11247577f64cbc607666
treedcdbbba34ebd4c4680cb91be94882c0c040f2ff5
parentbfc85211bb440efb2fe0c2f693c4e0334939261e

stage1: fix render_const_value for printing const optional pointers


1 files changed, 9 insertions(+), 1 deletions(-)

src/stage1/analyze.cpp+9-1
......@@ -7588,8 +7588,16 @@ void render_const_value(CodeGen *g, Buf *buf, ZigValue *const_val) {
75887588 }
75897589 case ZigTypeIdOptional:
75907590 {
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 }
75927599 return render_const_val_ptr(g, buf, const_val, type_entry->data.maybe.child_type);
7600 }
75937601 if (type_entry->data.maybe.child_type->id == ZigTypeIdErrorSet)
75947602 return render_const_val_err_set(g, buf, const_val, type_entry->data.maybe.child_type);
75957603 if (const_val->data.x_optional) {