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 --- types.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'types.c') diff --git a/types.c b/types.c index 0a379dd8..d7114a92 100644 --- a/types.c +++ b/types.c @@ -47,9 +47,9 @@ CORD type_to_cord(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, "%"); - return CORD_cat(sigil, type_to_cord(ptr->pointed)); + return CORD_all(sigil, type_to_cord(ptr->pointed), ptr->is_optional ? "?" : CORD_EMPTY); } case EnumType: { auto tagged = Match(t, EnumType); -- cgit v1.2.3