From 2e993bf8c272ea528395e36a8b1daac4d755a7bb Mon Sep 17 00:00:00 2001 From: fennecdjay Date: Tue, 10 Jan 2023 02:07:11 +0100 Subject: [PATCH] :art: secure _check_lambda --- src/lib/closure.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/lib/closure.c b/src/lib/closure.c index 27fc4a12..2b44e32e 100644 --- a/src/lib/closure.c +++ b/src/lib/closure.c @@ -312,11 +312,12 @@ ANN static m_bool _check_lambda(const Env env, Exp_Lambda *l, for(uint32_t i = 0; i < bases->len; i++) { Arg *base = mp_vector_at(bases, Arg, i); Arg *arg = mp_vector_at(args, Arg, i); - arg->td = type2td(env->gwion, known_type(env, base->td), exp_self(l)->pos); + DECL_OB(const Type, arg_type, = known_type(env, base->td)); + arg->td = type2td(env->gwion, arg_type, exp_self(l)->pos); } } - l->def->base->td = - type2td(env->gwion, known_type(env, fdef->base->td), exp_self(l)->pos); + DECL_OB(const Type, ret_type, = known_type(env, fdef->base->td)); + l->def->base->td = type2td(env->gwion, ret_type, exp_self(l)->pos); /*Type*/ owner = fdef->base->func->value_ref->from->owner_class; Upvalues upvalues = { @@ -349,7 +350,7 @@ ANN static m_bool _check_lambda(const Env env, Exp_Lambda *l, if(ret < 0) { if(args) { for(uint32_t i = 0; i < bases->len; i++) { - Arg *arg = mp_vector_at(args, Arg, i); + Arg *arg = mp_vector_at(args, Arg, i); free_value(arg->var_decl.value, env->gwion); arg->var_decl.value = NULL; } -- 2.43.0