struct td_checker tdc = {.str = path, .pos = pos};
return _str2sym(gwion, &tdc, path);
}
-/*
-// only in enum.c
-ANN ID_List str2symlist(const Gwion gwion, const m_str path, const loc_t pos) {
- DECL_OO(const Symbol, sym, = str2sym(gwion, path, pos));
- return new_id_list(gwion->mp, sym);
-}
-*/
+
ANN m_bool str2var(const Gwion gwion, Var_Decl vd, const m_str path, const loc_t pos) {
struct td_checker tdc = {.str = path, .pos = pos};
DECL_OB(const Symbol, sym, = __str2sym(gwion, &tdc));
struct td_checker tdc = {.str = str, .pos = pos};
DECL_OO(Type_Decl *, td, = _str2td(gwion, &tdc));
if(*tdc.str) {
-/*
- Type_Decl *tmp = td;
- while(tmp->next) tmp = tmp->next;
- while(!strcmp(tdc.str, "[]")) {
- tdc.str += 2;
- if(!td->array) td->array = new_array_sub(gwion->mp, NULL);
- else td->array->depth++;
- return td;
- }
-*/
free_type_decl(gwion->mp, td);
GWION_ERR_O(pos, "excedental character '%c' in '%s'", *tdc.str, str);
}
Type_List tl = info->tl;
for(uint32_t i = 0; i < tl->len; i++) {
if (i) text_add(&info->text, ",");
- Type_Decl *td = *mp_vector_at(tl, Type_Decl*, i);
+ DECL_OB(Type_Decl *, td, = *mp_vector_at(tl, Type_Decl*, i));
DECL_OB(const Type, t, = known_type(env, td));
td_fullname(env, &info->text, t);
}
ANEW ANN m_str type2str(const Gwion gwion, const Type t,
const loc_t pos NUSED) {
GwText text = {.mp = gwion->mp};
- const Type owner = t->info->value->from->owner_class;
- if (owner) {
- td_fullname(gwion->env, &text, owner);
- text_add(&text, ".");
- }
- text_add(&text, t->name);
+ td_fullname(gwion->env, &text, t);
return text.str;
}
DECL_OB(const m_str, str,
= tl2str(env->gwion, info->td->types, info->td->pos));
const size_t tmpl_sz = tmpl_set(info, str);
- const m_str base = type2str(env->gwion, info->base, info->td->pos);
+ const m_str base = !is_func(env->gwion, info->base)
+ ? mstrdup(env->gwion->mp, info->base->name)
+ : type2str(env->gwion, info->base, info->td->pos);
return tmpl_sz + tmpl_set(info, base) + 4;
-// return tmpl_sz + tmpl_set(info, info->base->name) + 4;
}
ANEW ANN static Symbol _template_id(const Env env, struct tmpl_info *const info,
if (i >= tl->len) return GW_OK;
Type_Decl *td = *mp_vector_at(tl, Type_Decl*, i);
const Type t = known_type(env, td);
- if (!t) return GW_OK;
Specialized *spec = mp_vector_at(sl, Specialized, i);
nspc_add_type(nspc, spec->xid, t);
};
}
ANN m_bool template_push(const Env env, const Type t) {
- nspc_push_type(env->gwion->mp, env->curr);
- return _template_push(env, t);
+ nspc_push_type(env->gwion->mp, env->curr);
+ return _template_push(env, t);
}
+ANN void check_call(const Env env, const Tmpl *tmpl) {
+ for(uint32_t i = 0; i < tmpl->call->len; i++) {
+ Specialized *spec = mp_vector_at(tmpl->list, Specialized, i);
+ Type_Decl *call = *mp_vector_at(tmpl->call, Type_Decl*, i);
+ if(spec->xid == call->xid)
+ call->xid = insert_symbol("auto");
+ }
+}
ANN m_bool template_push_types(const Env env, const Tmpl *tmpl) {
nspc_push_type(env->gwion->mp, env->curr);
+ if(tmpl->call) check_call(env, tmpl);
if (push_types(env, env->curr, tmpl) > 0) return GW_OK;
POP_RET(GW_ERROR);
}