ast_array_index_delete(self);
return NULL;
}
+ if (array->expression.vtype == TYPE_FIELD && outtype->expression.vtype == TYPE_ARRAY) {
+ if (self->expression.vtype != TYPE_ARRAY) {
+ asterror(ast_ctx(self), "array_index node on type");
+ ast_array_index_delete(self);
+ return NULL;
+ }
+ self->array = outtype;
+ self->expression.vtype = TYPE_FIELD;
+ }
return self;
}
break;
case opid1('['):
- if (exprs[0]->expression.vtype != TYPE_ARRAY) {
+ if (exprs[0]->expression.vtype != TYPE_ARRAY &&
+ !(exprs[0]->expression.vtype == TYPE_FIELD &&
+ exprs[0]->expression.next->expression.vtype == TYPE_ARRAY))
+ {
ast_type_to_string(exprs[0], ty1, sizeof(ty1));
parseerror(parser, "cannot index value of type %s", ty1);
return false;