};
ANEW ANN Value new_value(MemPool p, const Type type, const m_str name);
+ANN void valuefrom(const Env, struct ValueFrom_*);
#endif
#include "gwion_util.h"
#include "gwion_ast.h"
#include "oo.h"
+#include "env.h"
#include "nspc.h"
#include "value.h"
#include "env.h"
const Type t = union_type(env, nspc, udef->type_xid ?: udef->xid,
!!udef->type_xid);
udef->value = new_value(env->gwion->mp, t, s_name(udef->xid));
-// set owner ?
- udef->value->from->owner_class = env->class_def;
- udef->value->from->owner = nspc;
- udef->value->from->ctx = env->context;
+ valuefrom(env, udef->value->from);
nspc_add_value(nspc, udef->xid, udef->value);
add_type(env, nspc, t);
SET_FLAG(t, scan1 | ae_flag_union);
const Symbol sym = insert_symbol(name);
const Type t = union_type(env, nspc, sym, 1);
udef->value = new_value(env->gwion->mp, t, s_name(sym));
- udef->value->from->owner_class = env->class_def;
- udef->value->from->owner = nspc;
- udef->value->from->ctx = env->context;
+ valuefrom(env, udef->value->from);
nspc_add_value(nspc, udef->xid, udef->value);
add_type(env, nspc, t);
SET_FLAG(udef->value, checked | udef->flag);
if(!env->scope->depth && !env->class_def)
SET_FLAG(v, global);
v->d.ptr = var->addr;
-// set from ?
- v->from->owner = !env->func ? env->curr : NULL;
- v->from->owner_class = env->scope->depth ? NULL : env->class_def;
- v->from->ctx = env->context;
+ if(!env->scope->depth)
+ valuefrom(env, v->from);
} while((list = list->next));
((Exp_Decl*)decl)->type = decl->list->self->value->type;
if(global)
do {
CHECK_BB(already_defined(env, list->xid, edef->pos))
const Value v = new_value(env->gwion->mp, edef->t, s_name(list->xid));
+ valuefrom(env, v->from);
if(env->class_def) {
- v->from->owner_class = env->class_def;
SET_FLAG(v, static);
SET_ACCESS(edef, v)
}
-// set from ?
- v->from->owner = env->curr;
- v->from->ctx = env->context;
SET_FLAG(v, const | ae_flag_enum | ae_flag_checked);
nspc_add_value(edef->t->e->owner, list->xid, v);
vector_add(&edef->values, (vtype)v);
ANN static Value scan2_func_assign(const Env env, const Func_Def d,
const Func f, const Value v) {
-// set from ?
- v->from->owner = env->curr;
- v->from->ctx = env->context;
+ valuefrom(env, v->from);
SET_FLAG(v, func | ae_flag_const);
- if(!(v->from->owner_class = env->class_def))
+ if(!env->class_def)
SET_FLAG(v, global);
else {
if(GET_FLAG(f, member))