aboutsummaryrefslogtreecommitdiff
path: root/types.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-04-30 13:18:47 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-04-30 13:18:47 -0400
commit2e27b88c1b9fa8ec9b9f243909f5b793b376f207 (patch)
treef70433489c8a1fbf3bae6bf4cce364f6bdf8c9f7 /types.c
parent3c0a8f0b899a343f43caf9c95147b2cf77a7b525 (diff)
Improved syntax for optionals
Diffstat (limited to 'types.c')
-rw-r--r--types.c4
1 files changed, 2 insertions, 2 deletions
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);