From 2e27b88c1b9fa8ec9b9f243909f5b793b376f207 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Tue, 30 Apr 2024 13:18:47 -0400 Subject: Improved syntax for optionals --- repl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'repl.c') diff --git a/repl.c b/repl.c index 0e968cdf..94b47e45 100644 --- a/repl.c +++ b/repl.c @@ -132,11 +132,11 @@ const TypeInfo *type_to_type_info(type_t *t) } case PointerType: { auto ptr = Match(t, PointerType); - CORD sigil = ptr->is_stack ? "&" : (ptr->is_optional ? "?" : "@"); + CORD sigil = ptr->is_stack ? "&" : "@"; if (ptr->is_readonly) sigil = CORD_cat(sigil, "%"); const TypeInfo *pointed_info = type_to_type_info(ptr->pointed); const TypeInfo pointer_info = {.size=sizeof(void*), .align=__alignof__(void*), - .tag=PointerInfo, .PointerInfo.sigil=sigil, .PointerInfo.pointed=pointed_info}; + .tag=PointerInfo, .PointerInfo={.sigil=sigil, .pointed=pointed_info, .is_optional=ptr->is_optional}}; return memcpy(GC_MALLOC(sizeof(TypeInfo)), &pointer_info, sizeof(TypeInfo)); } default: errx(1, "Unsupported type: %T", t); -- cgit v1.2.3