From 41c0ea851a542bcd7d54b8c5c06d70e1e00095e1 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 27 Oct 2024 19:54:48 -0400 Subject: Deprecate "&" for stack references --- types.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'types.c') diff --git a/types.c b/types.c index ec1b66c7..1a140a32 100644 --- a/types.c +++ b/types.c @@ -67,7 +67,7 @@ CORD type_to_cord(type_t *t) { } case PointerType: { auto ptr = Match(t, PointerType); - CORD sigil = ptr->is_stack ? "&" : "@"; + CORD sigil = ptr->is_view ? "&" : "@"; return CORD_all(sigil, type_to_cord(ptr->pointed)); } case EnumType: { @@ -123,7 +123,7 @@ bool type_is_a(type_t *t, type_t *req) auto t_ptr = Match(t, PointerType); auto req_ptr = Match(req, PointerType); if (type_eq(t_ptr->pointed, req_ptr->pointed)) - return (!t_ptr->is_stack && req_ptr->is_stack) || (!t_ptr->is_stack); + return (!t_ptr->is_view && req_ptr->is_view) || (!t_ptr->is_view); } return false; } @@ -275,11 +275,11 @@ PUREFUNC bool can_send_over_channel(type_t *t) } } -PUREFUNC bool has_stack_memory(type_t *t) +PUREFUNC bool has_view_memory(type_t *t) { switch (t->tag) { - case PointerType: return Match(t, PointerType)->is_stack; - case OptionalType: return has_stack_memory(Match(t, OptionalType)->type); + case PointerType: return Match(t, PointerType)->is_view; + case OptionalType: return has_view_memory(Match(t, OptionalType)->type); default: return false; } } @@ -345,7 +345,7 @@ PUREFUNC bool can_promote(type_t *actual, type_t *needed) // Can't use @Foo for a function that wants @Baz // But you *can* use @Foo for a function that wants @Memory return false; - else if (actual_ptr->is_stack && !needed_ptr->is_stack) + else if (actual_ptr->is_view && !needed_ptr->is_view) // Can't use &x for a function that wants a @Foo or ?Foo return false; else -- cgit v1.2.3