static OP_CHECK(opck_fptr_at) {
Exp_Binary* bin = (Exp_Binary*)data;
+ if(bin->rhs->exp_type == ae_exp_decl)
+ UNSET_FLAG(bin->rhs->d.exp_decl.list->self->value, late);
if(bin->rhs->info->type->info->func->def->base->tmpl &&
bin->rhs->info->type->info->func->def->base->tmpl->call) {
struct FptrInfo info = { bin->lhs->info->type->info->func, bin->rhs->info->type->info->parent->info->func,
const Instr instr = emit_add_instr(emit, RegPushImm);
instr->m_val = (m_uint)value->type;
}
- if(GET_FLAG(value, late)) {
+ if(GET_FLAG(value, late) && !exp_getvar(exp_self(member))) {
const Instr instr = emit_add_instr(emit, GWOP_EXCEPT);
- instr->m_val = -SZ_INT;
+ if(!is_fptr(emit->gwion, value->type))
+ instr->m_val = -SZ_INT;
}
return GW_OK;
}
ANN Type tmpl_exists(const Env env, struct tmpl_info *const info);
ANN Type scan_class(const Env env, const Type t, const Type_Decl *td) {
-puts("here");
struct tmpl_info info = { .base=t, .td=td, .list=t->info->cdef->base.tmpl->list };
const Type exists = tmpl_exists(env, &info);
if(exists)
#include "tmpl_info.h"
ANN static inline m_str tmpl_get(struct tmpl_info* info, m_str str) {
- const Type t = (Type)vector_at(&info->type, info->index);
- strcpy(str, t->name);
+ const m_str tmp = (m_str)vector_at(&info->type, info->index);
+ strcpy(str, tmp);
return str += vector_at(&info->size, info->index);
}
*str = '\0';
}
-ANN static inline size_t tmpl_set(struct tmpl_info* info, const Type t) {
- vector_add(&info->type, (vtype)t);
- const size_t len = strlen(t->name);
+ANN static inline size_t tmpl_set(struct tmpl_info* info, const m_str str) {
+ vector_add(&info->type, (vtype)str);
+ const size_t len = strlen(str);
vector_add(&info->size, len);
return len;
}
ANN static ssize_t template_size(const Env env, struct tmpl_info* info) {
- ID_List base = info->list; // ???
- Type_List call = info->td->types;
- size_t size = 0;
- do {
- DECL_OB(const Type, t, = known_type(env, call->td))
- size += tmpl_set(info, t);
- } while((call = call->next) && (base = base->next) && ++size);
- size += tmpl_set(info, info->base);
- return size + 4;
+ DECL_OB(const m_str, str, = tl2str(env, info->td->types))
+ return tmpl_set(info, str) + tmpl_set(info, info->base->name) + 4;
}
ANEW ANN static Symbol template_id(const Env env, struct tmpl_info *const info) {
map_release(map);
}
-ANN static Type op_parent(const Env env, const Type t) {
- if(tflag(t, tflag_ctmpl)) {
- const Type type = typedef_base(t);
- char name[strlen(type->name) + 1];
- strcpy(name, type->name);
- const m_str post = strchr(name, ':');
- *post = '\0';
- return nspc_lookup_type1(env->curr, insert_symbol(env->gwion->st, name));
- }
- return t->info->parent;
-}
-
static m_bool op_match(const restrict Type t, const restrict Type mo) {
if(t == OP_ANY_TYPE || mo == OP_ANY_TYPE)
return GW_OK;
else
return mo->ret;
}
- } while(r && (r = op_parent(ock->env, r)));
+ } while(r && (r = r->info->parent));
return NULL;
}
set_nspc(&opi2, nspc);
return ret;
}
- } while(l && (l = op_parent(env, l)));
+ } while(l && (l = l->info->parent));
}
} while((nspc = nspc->parent));
// if(env->func && env->func->nspc)
const m_bool ret = mo->em(emit, (void*)opi->data);
if(ret)
return ret;
- }
- else if(mo->func || mo->instr)
+ } else if(mo->func || mo->instr)
return handle_instr(emit, mo);
}
- } while(r && (r = op_parent(emit->env, r)));
- } while(l && (l = op_parent(emit->env, l)));
+ } while(r && (r = r->info->parent));
+ } while(l && (l = l->info->parent));
return GW_ERROR;
}
* VAL = offset (no default SZ_INT) *
* VAL2 = error message *
* grep for GWOP_EXCEPT and Except, exception... */
- if(!*(M_Object*)(reg-(m_int)VAL)) {
+ if(!*(void**)(reg-(m_int)VAL)) {
shred->pc = PC;
exception(shred, "NullPtrException");
continue;