From: fennecdjay Date: Tue, 10 Nov 2020 22:16:54 +0000 (+0100) Subject: :art: Improve lambda tests X-Git-Tag: nightly~1183 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=ad3a5cb9bd896a06eb29ca1f3690731ce62f8765;p=gwion.git :art: Improve lambda tests --- diff --git a/src/emit/emit.c b/src/emit/emit.c index 526f237c..410b0b13 100644 --- a/src/emit/emit.c +++ b/src/emit/emit.c @@ -2045,7 +2045,7 @@ ANN static m_bool emit_fdef(const Emitter emit, const Func_Def fdef) { } static ANN int fdef_is_file_global(const Emitter emit, const Func_Def fdef) { - return isa(fdef->base->func->value_ref->type, emit->gwion->type[et_lambda]) < 0 && + return !fbflag(fdef->base, fbflag_lambda) && !emit->env->class_def && !GET_FLAG(fdef->base, global) && !fdef->base->tmpl && !emit->env->scope->depth; } diff --git a/src/parse/check.c b/src/parse/check.c index 07ffe748..c8d0b421 100644 --- a/src/parse/check.c +++ b/src/parse/check.c @@ -317,7 +317,7 @@ ANN static Type prim_id_non_res(const Env env, const Symbol *data) { } prim_self(data)->value = v; if(env->func) { - if(isa(env->func->value_ref->type, env->gwion->type[et_lambda]) > 0) + if(fbflag(env->func->def->base, fbflag_lambda)) check_upvalue(env, prim_self(data)); if(env->func && !GET_FLAG(v, const) && v->from->owner) unset_fflag(env->func, fflag_pure);