ANN bool envset_run(struct EnvSet *, const Type);
ANN2(1, 3) bool envset_push(struct EnvSet *, const Type, const Nspc);
+ANN2(1) void envset_pop(struct EnvSet *, const Type);
+
ANN static inline bool envset_pushv(struct EnvSet *es, const Value v) {
es->_ctx = es->env->context;
es->_filename = es->env->name;
- CHECK_B(envset_push(es, v->from->owner_class, v->from->owner));
- return true;
+ return envset_push(es, v->from->owner_class, v->from->owner);
}
-ANN2(1) void envset_pop(struct EnvSet *, const Type);
ANN2(1) static inline void envset_popv(struct EnvSet *es, const Value v) {
envset_pop(es, v->from->owner_class);
}
+
+ANN static inline bool envset_pushf(struct EnvSet *es, const Value owner) {
+ CHECK_B(envset_pushv(es, owner));
+ return env_pushv(es->env, owner);
+}
+ANN2(1) static inline void envset_popf(struct EnvSet *es, const Value owner) {
+ env_pop(es->env, es->scope);
+ envset_popv(es, owner);
+}
#endif
.func = (_envset_func)emit_cdef,
.scope = scope,
.flag = tflag_emit};
- CHECK_B(envset_pushv(&es, v));
- (void)emit_pushv(emit, v);
+ CHECK_B(envset_pushf(&es, v));
const bool ret = traverse_emit_func_def(emit, fdef);
- emit_pop(emit, scope);
- envset_popv(&es, v);
+ envset_popf(&es, v);
emit->env->scope->shadowing = shadowing;
return ret;
}
.func = (_envset_func)emit_cdef,
.scope = scope,
.flag = tflag_emit};
- CHECK_B(envset_pushv(&es, v));
- (void)emit_pushv(emit, v);
+ CHECK_B(envset_pushf(&es, v));
const bool ret = emit_func_def(emit, f->def);
- envset_popv(&es, v);
- emit_pop(emit, scope);
+ envset_popf(&es, v);
return ret ? push_func_code(emit, f) : false;
}
ANN static inline bool
tmpl_valid(const Env env, const Func_Def fdef, const m_str filename) {
if (safe_fflag(fdef->base->func, fflag_valid)) return true;
- const m_str old_file = env->name;
- env->name = filename;
+// const m_str old_file = env->name;
+// env->name = filename;
const bool ret = check_traverse_fdef(env, fdef);
- env->name = old_file;
+// env->name = old_file;
if(!fdef->base->func) free_func_def(env->gwion->mp, fdef);
return ret;
}
const m_str tmpl_name) {
const TmplArg_List types = exp->tmpl->call;
const Func former = env->func;
- const m_uint scope = env->scope->depth;
struct EnvSet es = {.env = env,
.data = env,
.func = (_envset_func)check_cdef,
- .scope = scope,
+ .scope = env->scope->depth,
.flag = tflag_check};
struct ResolverArgs ra = {
.v = v, .e = exp, .tmpl_name = tmpl_name, .types = types};
- CHECK_O(envset_pushv(&es, v));
- (void)env_pushv(env, v);
+ CHECK_O(envset_pushf(&es, v));
const Tmpl *tmpl = v->from->owner_class && v->from->owner_class->info->cdef ?
get_tmpl(v->from->owner_class) : NULL;
if(tmpl)
: fptr_match(env, &ra);
if(tmpl)
nspc_pop_type(env->gwion->mp, env->curr);
- env_pop(env, scope);
- envset_popv(&es, v);
+ envset_popf(&es, v);
env->func = former;
return m_func;
}