return post->exp->type;
}
-ANN m_bool check_exp_array_subscripts(const Env env, const Exp exp);
OP_CHECK(opck_new) {
const Exp_Unary* unary = (Exp_Unary*)data;
SET_FLAG(unary->td, ref);
ERR_N(td_pos(unary->td), _("can't use 'new' on ref type '%s'\n"), t->name)
UNSET_FLAG(unary->td, ref);
if(unary->td->array)
- CHECK_BO(check_exp_array_subscripts(env, unary->td->array->exp))
+ CHECK_BO(check_subscripts(env, unary->td->array))
return t;
}
}
-ANN m_bool check_exp_array_subscripts(Env env, Exp exp) {
- CHECK_OB(check_exp(env, exp))
- do if(isa(exp->type, env->gwion->type[et_int]) < 0)
- ERR_B(exp->pos, _("incompatible array subscript type '%s' ..."), exp->type->name)
- while((exp = exp->next));
+ANN m_bool check_subscripts(Env env, const Array_Sub array) {
+ CHECK_OB(check_exp(env, array->exp))
+ Exp e = array->exp;
+ do if(isa(e->type, env->gwion->type[et_int]) < 0)
+ ERR_B(e->pos, _("incompatible array subscript type '%s' ..."), e->type->name)
+ while((e = e->next));
return GW_OK;
}
if(env->class_def && !env->scope->depth && env->class_def->e->parent)
CHECK_BO(check_exp_decl_parent(env, var))
if(var->array && var->array->exp)
- CHECK_BO(check_exp_array_subscripts(env, var->array->exp))
+ CHECK_BO(check_subscripts(env, var->array))
if(env->class_def) {
if(GET_FLAG(decl->td, member)) {
decl_member(env, v);
const Type parent = cdef->base.type->e->parent;
const Type_Decl *td = cdef->base.ext;
if(td->array)
- CHECK_BB(check_exp_array_subscripts(env, td->array->exp))
+ CHECK_BB(check_subscripts(env, td->array))
if(parent->e->def && !GET_FLAG(parent, check))
CHECK_BB(scanx_parent(parent, traverse_cdef, env))
if(GET_FLAG(parent, typedef))