vflag_member = 1 << 6,
vflag_inner = 1 << 7, // value is in a scope
vflag_release = 1 << 8,
- vflag_assigned = 1 << 9
+ vflag_assigned = 1 << 9,
+ vflag_arg = 1 << 10
// vflag_used = 1 << 3
} __attribute__((packed));
return v;
} else if (SAFE_FLAG(env->class_def, global) ||
(env->func && GET_FLAG(env->func->def->base, global))) {
- if (!value || !is_value_global(env, value))
+ if (!value || !(is_value_global(env, value) || vflag(value, vflag_arg)))
ERR_O(prim_pos(data),
_("non-global variable '%s' used from global function/class."),
s_name(var))
ANN static m_bool scan2_args(const Func_Def f) {
Arg_List args = f->base->args;
- const bool global = GET_FLAG(f->base, global);
for(uint32_t i = 0; i < args->len; i++) {
Arg *arg = mp_vector_at(args, Arg, i);
const Value v = arg->var_decl.value;
v->from->offset = f->stack_depth;
- //f->stack_depth += v->type->size;
+ // when can there be no type?
f->stack_depth += v->type ? v->type->size : SZ_INT;
- if (global) SET_FLAG(v, global);
+ set_vflag(v, vflag_arg);
}
return GW_OK;
}