int index;
struct text name;
};
+ enum { IndexUnknown = -1, IndexInvalid = -2 };
###### free exec cases
case Xfieldref:
struct fieldref *fr = new_pos(fieldref, $2);
fr->left = $<1;
fr->name = $3.txt;
- fr->index = -2;
+ fr->index = IndexUnknown;
$0 = fr;
} }$
for (i = 0; i < type->structure.nfields; i++)
if (text_cmp(type->structure.fields[i].name, field) == 0)
return i;
- return -1;
+ return IndexInvalid;
}
###### propagate exec cases
else if (st->init != structure_init)
type_err(c, "error: field reference attempted on %1, not a struct",
f->left, st, 0, NULL);
- else if (f->index == -2) {
+ else if (f->index == IndexUnknown) {
f->index = find_struct_index(st, f->name);
if (f->index < 0)
type_err(c, "error: cannot find requested field in %1",