ANN m_bool scan0_class_def(const Env env, const Class_Def cdef) {
CHECK_BB(scan0_class_def_pre(env, cdef))
CHECK_OB((cdef->base.type = scan0_class_def_init(env, cdef)))
- if(cdef->body)
+ if(cdef->body) {
+int call = cdef->tmpl && !cdef->tmpl->base;
+if(call)cdef->tmpl->base = 1;
+// assert(cdef->tmpl->base);
CHECK_BB(env_body(env, cdef, scan0_section))
+if(call)cdef->tmpl->base = NULL;
+}
(void)mk_class(env, cdef->base.type);
if(GET_FLAG(cdef, global))
env->curr = (Nspc)vector_pop(&env->scope->nspc_stack);
if(!c->tmpl->base)
ERR_B(c->pos,
"you must provide template types for type '%s'", s_name(c->base.xid))
- CHECK_BB(template_push_types(env, c->tmpl->list.list, c->tmpl->base))
+ if(c->tmpl->base != 1)
+ CHECK_BB(template_push_types(env, c->tmpl->list.list, c->tmpl->base))
}
return scope;
}
ANN static inline void _pop(const Env e, const Class_Def c, const m_uint s) {
- if(c->tmpl)
- nspc_pop_type(e->gwion->mp, e->curr);
+ if(c->tmpl) {
+ if(c->tmpl->base != 1)
+ nspc_pop_type(e->gwion->mp, e->curr);
+ else
+ c->tmpl->base = NULL;
+ }
env_pop(e, s);
}
if(GET_FLAG(t, template)) {
if(GET_FLAG(t, ref))
return t;
+ if(!type->types)
+ ERR_O(t->e->def->pos,
+ "you must provide template types for type '%s'", t->name)
if(template_match(t->e->def->tmpl->list.list, type->types) < 0)
ERR_O(type->xid->pos, "invalid template types number")
const Class_Def a = template_class(env, t->e->def, type->types);