static inline ANN void nspc_add_##b(const Nspc n, const Symbol s, const A a) { \
scope_add(n->info->b, (vtype)s, (vtype)a); \
} \
+static inline ANN void nspc_add_##b##_front(const Nspc n, const Symbol s, const A a) { \
+ map_set(&n->info->b->map, (vtype)s, (vtype)a); \
+} \
ANN static inline void nspc_push_##b(MemPool p, const Nspc n) { scope_push(p, n->info->b); }\
ANN static inline void nspc_pop_##b (MemPool p, const Nspc n) { scope_pop (p, n->info->b); }\
describe_lookups(A, b)
ADD_REF(ret->nspc)
ret->name = s_name(sym);
ret->flag = t->flag | ae_flag_force;
- map_set(&t->e->owner->info->type->map, (vtype)sym, (vtype)ret);
+ nspc_add_type_front(t->e->owner, sym, ret);
return ret;
}
SET_FLAG(cdef->base.type, abstract);
cdef->base.type->e->tuple->list = tlbase;
CHECK_BO(traverse_cdef(env, cdef))
- map_set(&env->curr->info->type->map, (vtype)sym, (vtype)cdef->base.type);
+ nspc_add_type_front(env->curr, sym, cdef->base.type);
return cdef->base.type;
}
v_type->e->d.base_type = type;
SET_FLAG(type, builtin);
const Symbol sym = insert_symbol(type->name);
- map_set(&env->curr->info->type->map, (vtype)sym, (vtype)type);
+ nspc_add_type_front(env->curr, sym, type);
const Value v = new_value(env->gwion->mp, v_type, s_name(sym));
SET_FLAG(v, checked | ae_flag_const | ae_flag_global | ae_flag_builtin);
nspc_add_value(env->curr, insert_symbol(type->name), v);
ADD_REF(t->nspc);
SET_FLAG(t, checked);
t->e->owner = base->e->owner;
- map_set(&base->e->owner->info->type->map, (vtype)sym, (vtype)t);
+ nspc_add_type_front(base->e->owner, sym, t);
return t;
}
if(v)
return v;
const Value value = new_value(env->gwion->mp, t_string, s_name(sym));
- map_set(&env->global_nspc->info->value->map, (vtype)sym, (vtype)value);
+ nspc_add_value_front(env->global_nspc, sym, value);
return value;
}
m_func = find_func_match(env, fbase->func, exp->args);
nspc_pop_type(env->gwion->mp, env->curr);
if(!value && m_func)
- map_set(&v->owner->info->type->map, (vtype)sym, (vtype)actual_type(m_func->value_ref->type));
+ nspc_add_type_front(v->owner, sym, actual_type(m_func->value_ref->type));
}
free_fptr_def(env->gwion->mp, fptr); // ???? related
}
#include "parser.h"
static inline void add_type(const Env env, const Nspc nspc, const Type t) {
- map_set(&nspc->info->type->map, (m_uint)insert_symbol(t->name), (m_uint)t);
+ nspc_add_type_front(nspc, insert_symbol(t->name), t);
}
ANN static Value mk_class(const Env env, const Type base) {
t->e->d.base_type = base;
v->owner = base->e->owner;
SET_FLAG(v, const | ae_flag_checked);
- map_set(&base->e->owner->info->value->map, (vtype)sym, (vtype)v);
+ nspc_add_value_front(base->e->owner, sym, v);
return v;
}
a->base.tmpl = mk_tmpl(env, t, t->e->def->base.tmpl, type->types);
if(t->e->parent != t_union) {
CHECK_BO(scan0_class_def(env, a))
- map_set(&env->curr->info->type->map, (vtype)a->base.xid, (vtype)a->base.type);
+ nspc_add_type_front(env->curr, a->base.xid, a->base.type);
} else {
a->union_def = new_union_def(env->gwion->mp, a->list,
loc_cpy(env->gwion->mp, t->e->def->pos));
ret->e->parent = t;
ret->name = s_name(sym);
SET_FLAG(ret, func);
- map_set(&t->e->owner->info->type->map, (vtype)sym, (vtype)ret);
+ nspc_add_type_front(t->e->owner, sym, ret);
const Func_Def def = cpy_func_def(env->gwion->mp, t->e->d.func->def);
const Func func = ret->e->d.func = new_func(env->gwion->mp, s_name(sym), def);
const Value value = new_value(env->gwion->mp, ret, s_name(sym));
func->value_ref = value;
func->def->base->tmpl = mk_tmpl(env, t, t->e->d.func->def->base->tmpl, type->types);
def->base->func = func;
- map_set(&t->e->owner->info->value->map, (vtype)sym, (vtype)value); // to base ?
+ nspc_add_value_front(t->e->owner, sym, value);
return ret;
}
ERR_O(type->xid->pos,
t->name = s_name(sym);
t->flag = base->flag;
SET_FLAG(t, nonnull);
- map_set(&t->e->owner->info->type->map, (vtype)sym, (vtype)t);
+ nspc_add_type_front(t->e->owner, sym, t);
return t;
}