From: Jérémie Astor Date: Sun, 8 Mar 2020 16:53:06 +0000 (+0100) Subject: :art: Remove t_vararg X-Git-Tag: nightly~1726^2~41 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=bc6d7d15958fa10f8ea33beb296324b0c90f56c4;p=gwion.git :art: Remove t_vararg --- diff --git a/include/env/type.h b/include/env/type.h index 89fbb445..deaa596b 100644 --- a/include/env/type.h +++ b/include/env/type.h @@ -49,7 +49,7 @@ ANN m_uint get_depth(const Type type); typedef enum { et_void, et_int, et_bool, et_char, et_float, et_null, et_object, et_shred, et_fork, et_event, et_ugen, et_string, et_ptr, et_array, et_gack, - et_function, et_fptr, et_varloop, et_vararg, et_lambda, et_class, et_union, et_undefined, et_auto, + et_function, et_fptr, et_varloop, et_lambda, et_class, et_union, et_undefined, et_auto, MAX_TYPE } type_enum; #endif diff --git a/include/specialid.h b/include/specialid.h index 69c5809e..8deeb2fe 100644 --- a/include/specialid.h +++ b/include/specialid.h @@ -1,7 +1,6 @@ #ifndef __SPECIALID #define __SPECIALID -//typedef struct SpecialId_* SpecialId; struct SpecialId_; typedef Type (*idck)(const Env, const Exp_Primary*); typedef Instr (*idem)(const Emitter, const Exp_Primary*); @@ -19,6 +18,7 @@ struct SpecialId_ { ANN static inline Type specialid_type(const Env env, struct SpecialId_ *spid, const Exp_Primary* prim) { + exp_self(prim)->type = spid->type; if(spid->is_const) exp_self(prim)->meta = ae_meta_value; return spid->ck ? spid->ck(env, prim) : spid->type; diff --git a/src/lib/vararg.c b/src/lib/vararg.c index e57026c6..e8b76e47 100644 --- a/src/lib/vararg.c +++ b/src/lib/vararg.c @@ -105,7 +105,7 @@ static FREEARG(freearg_vararg) { static ID_CHECK(idck_vararg) { if(env->func && GET_FLAG(env->func->def, variadic)) - return env->gwion->type[et_vararg]; + return exp_self(prim)->type; ERR_O(exp_self(prim)->pos, _("'vararg' must be used inside variadic function")) } @@ -162,7 +162,6 @@ GWION_IMPORT(vararg) { GWI_BB(gwi_set_global_type(gwi, t_varloop, et_varloop)) const Type t_vararg = gwi_class_spe(gwi, "@Vararg", 0); gwi_gack(gwi, t_vararg, gack_vararg); - gwi->gwion->type[et_vararg] = t_vararg; // use func GWI_BB(gwi_union_ini(gwi, NULL, NULL)) GWI_BB(gwi_union_add(gwi, "@VarLoop", "start")) GWI_BB(gwi_union_add(gwi, "@VarLoop", "end"))