ANN Type find_type(const Env, ID_List);
ANN m_bool already_defined(const Env env, const Symbol s, const loc_t pos);
ANN m_bool type_engine_check_prog(const Env, const Ast);
-ANN Func get_func(const Env, const Func_Def);
ANN m_bool traverse_func_template(const Env, const Func_Def);
ANN ID_List str2list(const Env, const m_str path, m_uint* array_depth);
ANN2(1,3) void env_err(const Env, const struct YYLTYPE *pos, const m_str fmt, ...);
}
ANN static m_bool emit_func_def(const Emitter emit, const Func_Def fdef) {
- const Func func = get_func(emit->env, fdef);
+ const Func func = fdef->base->func;
const Func former = emit->env->func;
if(tmpl_base(fdef->base->tmpl))
return GW_OK;
}
ANN m_bool check_func_def(const Env env, const Func_Def fdef) {
- const Func func = get_func(env, fdef);
+ const Func func = fdef->base->func;
assert(func == fdef->base->func);
if(tmpl_base(fdef->base->tmpl))
return env->class_def ? check_parent_match(env, fdef) : 1;
#include "type.h"
#include "vm.h"
#include "gwion.h"
-ANN Func get_func(const Env env, const Func_Def def) {
- DECL_OO(Func, f, = def->base->func)
- m_str end = strrchr(f->name, '@'); // test end cause some template func do not have @x@env->curr->name
- if(end && env->class_def && GET_FLAG(env->class_def, template)) {
- ++end;
- const size_t len = strlen(f->name) - strlen(end);
- const size_t elen = strlen(env->class_def->name);
- char c[len + elen + 1];
- memcpy(c, f->name, len);
- strcpy(c + len, env->class_def->name);
- return nspc_lookup_func0(env->class_def->nspc, insert_symbol(env->gwion->st, c));
- }
- return f;
-}
ANN2(1,2) Symbol func_symbol(const Env env, const m_str nspc, const m_str base,
const m_str tmpl, const m_uint i) {
const m_str name = func_name(env, f, overload ?: NULL);
if((m_int)name <= GW_OK)
return (m_bool)(m_uint)name;
- const Func base = get_func(env, f);
+ const Func base = f->base->func;
if(!base)
CHECK_OB(func_create(env, f, overload, name))
else