ANN static m_bool emit_func_args(const Emitter emit, const Exp_Call *exp_call) {
if (exp_call->args) {
CHECK_BB(emit_exp(emit, exp_call->args));
- // emit_exp_addref(emit, exp_call->args, -exp_totalsize(exp_call->args));
+// emit_exp_addref_array(emit, exp_call->args, -exp_totalsize(exp_call->args));
}
const Type t = actual_type(emit->gwion, exp_call->func->type);
if (is_func(emit->gwion, t) &&
return emit_array_shift(emit, ArrayConcatRight);
const Instr pop = emit_add_instr(emit, RegMove);
pop->m_val = -SZ_INT;
- if (isa(bin->rhs->type, emit->gwion->type[et_object]) > 0)
- emit_add_instr(emit, RegAddRef);
+ if (isa(bin->lhs->type, emit->gwion->type[et_compound]) > 0)
+ emit_compound_addref(emit, bin->lhs->type, -SZ_INT, false);
(void)emit_add_instr(emit, ArrayAppendFront);
return GW_OK;
}
const Exp_Binary *bin = (Exp_Binary *)data;
if (shift_match(bin->rhs->type, bin->lhs->type))
return emit_array_shift(emit, ArrayConcatLeft);
+ if (isa(bin->rhs->type, emit->gwion->type[et_compound]) > 0)
+ emit_compound_addref(emit, bin->rhs->type, -SZ_INT, false);
const Instr pop = emit_add_instr(emit, RegMove);
pop->m_val = -bin->rhs->type->size;
- if (isa(bin->rhs->type, emit->gwion->type[et_object]) > 0) {
- const Instr ref = emit_add_instr(emit, RegAddRef);
- ref->m_val = -SZ_INT;
- }
emit_add_instr(emit, ArrayAppend);
return GW_OK;
}
if (value->from->owner_class)
CHECK_BO(ensure_traverse(env, value->from->owner_class));
}
- if (exp->args) CHECK_OO(check_exp(env, exp->args));
+ if (exp->args) {
+ CHECK_OO(check_exp(env, exp->args));
+ Exp e = exp->args;
+ do exp_setuse(e, true);
+ while((e = e->next));
+ }
if (tflag(t, tflag_ftmpl))
return check_exp_call_template(env, (Exp_Call *)exp); // TODO: effects?
const Func func = find_func_match(env, t->info->func, exp);
if (func) {
if (!is_fptr(env->gwion, func->value_ref->type)) // skip function pointers
if (func != env->func && func->def && !fflag(func, fflag_valid)) {
- struct EnvSet es = {.env = env,
- .data = env,
- .func = (_exp_func)check_cdef,
- .scope = env->scope->depth,
- .flag = tflag_check};
- CHECK_BO(envset_pushv(&es, func->value_ref));
- CHECK_BO(check_func_def(env, func->def));
- if (es.run) envset_pop(&es, func->value_ref->from->owner_class);
+ if(func->value_ref->from->owner_class)
+ CHECK_BO(ensure_check(env, func->value_ref->from->owner_class));
+ else {
+ const m_uint scope = env_push(env, NULL, func->value_ref->from->owner);
+ CHECK_BO(check_func_def(env, func->def));
+ env_pop(env, scope);
+ }
}
-
exp->func->type = func->value_ref->type;
call_add_effect(env, func, exp->func->pos);
if (func == env->func) set_fflag(env->func, fflag_recurs);
if (isa(if_exp, else_exp) < 0)
ERR_O(exp_self(exp_if)->pos, _("condition type '%s' does not match '%s'"),
cond->name, ret->name)
+ exp_setuse(exp_if->cond, true);
+ exp_setuse(exp_if->if_exp, true);
+ exp_setuse(exp_if->else_exp, true);
return ret;
}
const Func func = f->base->func;
const Func_Def fdef = func->def;
if(fflag(func, fflag_valid))return GW_OK;
- set_fflag(fdef->base->func, fflag_valid);
+ set_fflag(func, fflag_valid);
assert(func == fdef->base->func);
if (env->class_def) // tmpl ?
CHECK_BB(check_parent_match(env, fdef));