Commit 7c6f2908 authored by Götz Lindenmaier's avatar Götz Lindenmaier
Browse files

new access routine

[r2671]
parent 43af5a65
......@@ -660,6 +660,17 @@ entity *get_class_member (type *clss, int pos) {
assert(pos >= 0 && pos < get_class_n_members(clss));
return clss->attr.ca.members[pos+1];
}
entity *get_class_member_by_name(type *clss, ident *name) {
int i, n_mem;
assert(clss && (clss->type_op == type_class));
n_mem = get_class_n_members(clss);
for (i = 0; i < n_mem; ++i) {
entity *mem = get_class_member(clss, i);
if (get_entity_ident(mem) == name) return mem;
}
return NULL;
}
void set_class_member (type *clss, entity *member, int pos) {
assert(clss && (clss->type_op == type_class));
assert(pos >= 0 && pos < get_class_n_members(clss));
......
......@@ -349,6 +349,10 @@ entity *get_class_member (type *clss, int pos);
/** Returns index of mem in clss, -1 if not contained. */
int get_class_member_index(type *clss, entity *mem);
/** Finds the member with name 'name'. If several members with the same
name returns one of them. Returns NULL if no member found. */
entity *get_class_member_by_name(type *clss, ident *name);
/** Overwrites the member at position pos, 0 <= pos < n_member with
the passed entity. */
void set_class_member (type *clss, entity *member, int pos);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment