}
ANN m_uint get_depth(const Type type);
ANN void inherit(const Type);
+ANN bool type_global(const Env env, Type t);
+ANN bool from_global_nspc(const Env env, const Nspc nspc);
__attribute__((returns_nonnull)) ANN static inline Type get_gack(Type t) {
do
if (tflag(t, tflag_emit)) return GW_OK;
set_tflag(t, tflag_emit);
const Class_Def c = t->info->cdef;
- const Type owner = t->info->value->from->owner_class;
- if (owner) CHECK_BB(ensure_emit(emit, owner));
if (c->base.ext && t->info->parent->info->cdef &&
!tflag(t->info->parent, tflag_emit)) // ?????
CHECK_BB(cdef_parent(emit, c));
m_bool envset_push(struct EnvSet *es, const Type t, const Nspc nspc) {
if (t) {
check(es, t);
+ if(es->run && type_global(es->env, t))
+ env_push_global(es->env);
return es->run ? push(es, t) : GW_OK;
}
if (nspc != es->env->curr) {
ANN2(1) void envset_pop(struct EnvSet *es, const Type t) {
_envset_pop(es, t);
+ if(t && type_global(es->env, t))
+ env_pop(es->env, es->scope);
if (es->_ctx) es->env->context = es->_ctx;
if (es->_filename) es->env->name = es->_filename;
}
nspc->offset = parent->offset;
if (parent->vtable.ptr) vector_copy2(&parent->vtable, &nspc->vtable);
}
+
+ANN bool from_global_nspc(const Env env, const Nspc nspc) {
+ Nspc global = env->global_nspc;
+ while(global) {
+ if (nspc == global)
+ return true;
+ global = global->parent;
+ }
+ return false;
+}
+
+ANN bool type_global(const Env env, Type t) {
+ while(t) {
+ if(from_global_nspc(env, t->info->value->from->owner)) return true;
+ t = t->info->value->from->owner_class;
+ }
+ return false;
+}
.data = (uintptr_t)c,
.pos = c->pos};
CHECK_OB(op_check(env, &opi));
- if (t->info->value->from->owner_class)
- CHECK_BB(ensure_check(env, t->info->value->from->owner_class));
if (tflag(t, tflag_check)) return GW_OK;
set_tflag(t, tflag_check);
return _check_class_def(env, c);
return envset_run(&es, t);
}
-ANN static inline bool from_global_nspc(const Env env, const Nspc nspc) {
- Nspc global = env->global_nspc;
- while(global) {
- if (nspc == global)
- return true;
- global = global->parent;
- }
- return false;
-}
-
-ANN static bool type_global(const Env env, Type t) {
- while(t) {
- if(from_global_nspc(env, t->info->value->from->owner)) return true;
- t = t->info->value->from->owner_class;
- }
- return false;
-}
-
ANN static m_bool check_global(const Env env, const Type t, const loc_t pos) {
const struct ValueFrom_ *from = t->info->value->from;
if(from->owner_class && isa(from->owner_class, env->class_def) > 0)
const Class_Def c = t->info->cdef;
if (tflag(t, tflag_scan1)) return GW_OK;
set_tflag(t, tflag_scan1);
- if (t->info->value->from->owner_class)
- CHECK_BB(ensure_scan1(env, t->info->value->from->owner_class));
if (c->base.ext) CHECK_BB(cdef_parent(env, c));
if (c->body) CHECK_BB(env_body(env, c, scan1_section));
return GW_OK;
const Type t = cdef->base.type;
const Class_Def c = t->info->cdef;
if (tflag(t, tflag_scan2)) return GW_OK;
- if (t->info->value->from->owner_class)
- CHECK_BB(ensure_scan2(env, t->info->value->from->owner_class));
set_tflag(t, tflag_scan2);
if (c->base.ext) CHECK_BB(cdef_parent(env, c));
if (c->body) CHECK_BB(env_body(env, c, scan2_section));