From 7dad9ccba2b8479fcc2d2e6dbc40fb74e41e8712 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Sun, 13 Jun 2021 19:59:32 +0200 Subject: [PATCH] :art: Use Ref as a bool --- ast | 2 +- src/parse/type_decl.c | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/ast b/ast index 591953c6..6d965961 160000 --- a/ast +++ b/ast @@ -1 +1 @@ -Subproject commit 591953c6a241aa5ec7cbfed3ed73ab819fdeb75f +Subproject commit 6d965961163bf32e912acd09d6cda41b93e24ff7 diff --git a/src/parse/type_decl.c b/src/parse/type_decl.c index 56e7f718..c74f2408 100644 --- a/src/parse/type_decl.c +++ b/src/parse/type_decl.c @@ -20,17 +20,16 @@ ANN static Type option(const Env env, Type_Decl *td) { return t; } -ANN static Type _ref(const Env env, Type_Decl *td, const uint8_t n) { +ANN static Type _ref(const Env env, Type_Decl *td) { struct Type_List_ tl = {.td = td}; Type_Decl tmp = {.xid = insert_symbol("Ref"), .types = &tl, .pos = td->pos}; - return !(n - 1) ? known_type(env, &tmp) : _ref(env, &tmp, n - 1); + return known_type(env, &tmp); } ANN static inline Type ref(const Env env, Type_Decl *td) { - const uint8_t ref = td->ref; - td->ref = 0; - const Type t = _ref(env, td, ref); - td->ref = ref; + td->ref = false; + const Type t = _ref(env, td); + td->ref = true; return t; } -- 2.43.0