From 59a722c5939ac1c0ad49bcd8bf3228d1b8ad2bb0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Tue, 26 Nov 2019 02:36:59 +0100 Subject: [PATCH] :art: Fix find_value --- include/env/nspc.h | 10 ++++++++-- src/oo/type.c | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/include/env/nspc.h b/include/env/nspc.h index cc59e8aa..19c1eb8c 100644 --- a/include/env/nspc.h +++ b/include/env/nspc.h @@ -28,20 +28,26 @@ extern ANN void nspc_commit(const Nspc); #define describe_lookup0(A, b) \ static inline ANN A nspc_lookup_##b##0(const Nspc n, const Symbol s){ \ - return (A)scope_lookup0(n->info->b, (vtype)s); \ + return (A)scope_lookup0(n->info->b, (vtype)s); \ } #define describe_lookup1(A, b) \ static inline ANN A nspc_lookup_##b##1(const Nspc n, const Symbol s) { \ - const A a = (A)scope_lookup1(n->info->b, (vtype)s); \ + const A a = (A)scope_lookup1(n->info->b, (vtype)s); \ if(!a && n->parent) \ return nspc_lookup_##b##1(n->parent, s); \ return a; \ } +#define describe_lookup2(A, b) \ +static inline ANN A nspc_lookup_##b##2(const Nspc n, const Symbol s) { \ + return (A)scope_lookup1(n->info->b, (vtype)s); \ +} + #define describe_lookups(A, b) \ describe_lookup0(A, b) \ describe_lookup1(A, b) \ +describe_lookup2(A, b) #define describe_nspc_func(A, b) \ static inline ANN void nspc_add_##b(const Nspc n, const Symbol s, const A a) { \ diff --git a/src/oo/type.c b/src/oo/type.c index 6d70d1cb..8992127a 100644 --- a/src/oo/type.c +++ b/src/oo/type.c @@ -76,7 +76,7 @@ ANN Type find_common_anc(const restrict Type lhs, const restrict Type rhs) { #define describe_find(name, t) \ ANN t find_##name(const Type type, const Symbol xid) { \ if(type->nspc) { \ - const t val = nspc_lookup_##name##0(type->nspc, xid); \ + const t val = nspc_lookup_##name##2(type->nspc, xid); \ if(val) \ return val; \ } \ -- 2.43.0