ANN static inline m_int push_tmpl_func(const Emitter emit, const Func f) {
const Value v = f->value_ref;
if(isa(v->type, t_class) > 0 &&
- isa(actual_type(v->type), t_fptr) > 0)
+ is_fptr(v->type))
return emit->env->scope->depth;
const m_uint scope = emit_push(emit, v->owner_class, v->owner);
CHECK_BB(traverse_func_template(emit->env, f->def))
exp_call->m_func->def->base->tmpl->call = exp_call->tmpl->call;
DECL_BB(const m_int,scope, = push_tmpl_func(emit, exp_call->m_func))
CHECK_BB(prepare_call(emit, exp_call))
- emit_pop_type(emit);
+ if(!is_fptr(exp_call->m_func->value_ref->type))
+ emit_pop_type(emit);
emit_pop(emit, (m_uint)scope);
UNSET_FLAG(exp_call->m_func, checked);
return GW_OK;
ANN m_bool emit_exp_call1(const Emitter emit, const Func f) {
if(!f->code || (GET_FLAG(f, ref) && !GET_FLAG(f, builtin))) {
- if(GET_FLAG(f, template) && emit->env->func != f && isa(actual_type(f->value_ref->type), t_fptr) < 0)
+ if(GET_FLAG(f, template) && emit->env->func != f && !is_fptr(f->value_ref->type))
CHECK_BB(emit_template_code(emit, f))
} else if((f->value_ref->owner_class && is_special(f->value_ref->owner_class) > 0) ||
!f->value_ref->owner_class || (GET_FLAG(f, template) &&
back->m_val = f->vt_index;
}
if(vector_size(&emit->code->instr) && GET_FLAG(f, member) &&
- isa(actual_type(f->value_ref->type), t_fptr) > 0) {
+ is_fptr(f->value_ref->type)) {
const Instr back = (Instr)vector_back(&emit->code->instr);
m_bit exec = back->opcode;
m_uint val = back->m_val;
const Instr spork = emit_add_instr(emit, is_spork ? SporkExp : ForkEnd);
spork->m_val = emit->code->stack_depth;
} else {
- if(GET_FLAG(f, member) && isa(actual_type(f->value_ref->type), t_fptr) > 0) {
+ if(GET_FLAG(f, member) && is_fptr(f->value_ref->type)) {
const m_uint depth = f->def->stack_depth;
regpop(emit, depth);
emit_add_instr(emit, RegPushMem);
Func m_func = NULL, former = env->func;
const m_str tmpl_name = tl2str(env, types);
const m_uint scope = env_push(env, v->owner_class, v->owner);
- if(isa(actual_type(v->type), t_fptr) > 0) {
+ if(is_fptr(v->type)) {
const Symbol sym = func_symbol(env, v->owner->name, v->name, tmpl_name, 0);
const Value value = nspc_lookup_value1(v->owner, sym);
Func_Def base = v->d.func_ref->def;
if(exp->args)
CHECK_OO(check_exp(env, exp->args))
const Func func = find_func_match(env, fbase->func, exp->args);
- // nspc_pop_type(env->gwion->mp, env->curr);
- // env_pop(env, scope);
if(!value)
map_set(&v->owner->info->type->map, (vtype)sym, (vtype)actual_type(func->value_ref->type));
+ nspc_pop_type(env->gwion->mp, env->curr);
xfree(tmpl_name);
env->func = former;
return func;
#include "value.h"
ANN static void free_func(Func a, Gwion gwion) {
- if(GET_FLAG(a, template) && isa(actual_type(a->value_ref->type), t_fptr) < 0) {
+ if(GET_FLAG(a, template) && !is_fptr(a->value_ref->type)) {
free_tmpl(gwion->mp, a->def->base->tmpl);
free_func_base(gwion->mp, a->def->base);
free_loc(gwion->mp, a->def->pos);