: emit_struct_addref(emit, t, size, emit_var);
}
-ANN static inline bool is_static_call(const Exp e) {
+ANN static inline bool is_static_call(const Emitter emit, const Exp e) {
if (e->exp_type != ae_exp_dot) return true;
const Exp_Dot *member = &e->d.exp_dot;
return GET_FLAG(e->type, final) ||
GET_FLAG(member->base->type, final) ||
+ is_class(emit->gwion, member->base->type) ||
// GET_FLAG(e->type->info->func, static) ||
member->base->exp_type == ae_exp_cast;
}
CHECK_BB(emit_func_args(emit, exp_call));
if (is_func(emit->gwion, t)) // is_callable needs type
CHECK_BB(emit_exp_call1(emit, t->info->func,
- is_static_call(exp_call->func)));
+ is_static_call(emit, exp_call->func)));
else {
struct Op_Import opi = {.op = insert_symbol("@ctor"),
.rhs = t,
ANN static Instr get_prelude(const Emitter emit, const Func f,
const bool is_static) {
- if (f != emit->env->func || (!is_static && strcmp(s_name(f->def->base->xid), "new")) /* ||
-// strstr(emit->code->name, "ork~")*/) {
+ if (f != emit->env->func || (!is_static && strcmp(s_name(f->def->base->xid), "new"))) {
const Instr instr = emit_add_instr(emit, SetCode);
instr->udata.one = 1;
return instr;
return op_emit(emit, &opi);
}
-ANN2(1,2) static Instr _flow(const Emitter emit, const Exp e, Instr *const instr, const bool b) {
-// CHECK_BO(emit_exp_pop_next(emit, e));
+ANN2(1,2) static Instr _flow(const Emitter emit, const Exp e, Instr *const instr, /*const */bool b) {
CHECK_BO(emit_exp(emit, e));
{
const Instr ex = (Instr)vector_back(&emit->code->instr);
- if(ex->execute == fast_except) {
+ if(ex->opcode == eOP_MAX && ex->execute == fast_except) {
vector_rem(&emit->code->instr, vector_size(&emit->code->instr) - 1);
free_instr(emit->gwion, ex);
}
}
+
if(instr)
*instr = emit_add_instr(emit, NoOp);
-// emit_exp_addref1(emit, e, -exp_size(e)); // ????
struct Op_Import opi = {
.op = insert_symbol(b ? "@conditional" : "@unconditional"),
.rhs = e->type,
instr->m_val = (m_uint)f;
return;
}
- } else if (is_static_call(exp_self(member))) {
+ } else if (is_static_call(emit, exp_self(member))) {
if (member->is_call && f == emit->env->func) return;
const Instr func_i = emit_add_instr(emit, f->code ? RegPushImm : SetFunc);
func_i->m_val = (m_uint)f->code ?: (m_uint)f;