From: Jérémie Astor Date: Mon, 23 Aug 2021 19:57:14 +0000 (+0200) Subject: :art: Fox Ptr and Ref size X-Git-Tag: nightly~470^2~43 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=f81bf6497aef76794c8a1010af887b5c5dc77cb0;p=gwion.git :art: Fox Ptr and Ref size --- diff --git a/src/lib/ptr.c b/src/lib/ptr.c index 1a0ace40..bdc2cc7d 100644 --- a/src/lib/ptr.c +++ b/src/lib/ptr.c @@ -37,7 +37,8 @@ static OP_CHECK(opck_ptr_assign) { Type u = bin->rhs->type; do { const Type base = ptr_base(env, u); - if (isa(t, base) > 0) return t; +// if (isa(t, base) > 0) return t; + if (isa(t, base) > 0) return bin->rhs->type; } while ((u = u->info->parent) && u->info->cdef->base.tmpl->call); } while ((t = t->info->parent)); return env->gwion->type[et_error]; @@ -147,6 +148,7 @@ static OP_CHECK(opck_ptr_scan) { if (exists) return exists != env->gwion->type[et_error] ? exists : NULL; const Type base = known_type(env, ts->td->types->td); const Type t = new_type(env->gwion->mp, s_name(info.name), base); + t->size = SZ_INT; t->info->parent = env->gwion->type[et_ptr]; SET_FLAG(t, abstract | ae_flag_final); t->info->tuple = new_tupleform(env->gwion->mp, NULL); diff --git a/src/lib/ref.c b/src/lib/ref.c index ba22c2d3..9acd1820 100644 --- a/src/lib/ref.c +++ b/src/lib/ref.c @@ -69,6 +69,7 @@ static OP_CHECK(opck_ref_scan) { if (exists) return exists != env->gwion->type[et_error] ? exists : NULL; const Type base = known_type(env, ts->td->types->td); const Type t = new_type(env->gwion->mp, s_name(info.name), base); + t->size = SZ_INT; SET_FLAG(t, abstract | ae_flag_final); set_tflag(t, tflag_infer); set_tflag(t, tflag_noret);