Turn various value copying-related functions into methods

This patch turns a grab bag of value functions to methods of value.
These are done together because their implementations are
interrelated.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
This commit is contained in:
Tom Tromey
2023-02-01 07:27:50 -07:00
parent e3fb3c4772
commit 6c49729e59
16 changed files with 193 additions and 197 deletions

View File

@ -1382,7 +1382,7 @@ rust_struct_anon::evaluate (struct type *expect_type,
field_number, type->name ());
int fieldno = rust_enum_variant (type);
lhs = value_primitive_field (lhs, 0, fieldno, type);
lhs = lhs->primitive_field (0, fieldno, type);
outer_type = type;
type = lhs->type ();
}
@ -1418,7 +1418,7 @@ rust_struct_anon::evaluate (struct type *expect_type,
field_number, type->name ());
}
return value_primitive_field (lhs, 0, field_number, type);
return lhs->primitive_field (0, field_number, type);
}
else
error(_("Anonymous field access is only allowed on tuples, \
@ -1445,7 +1445,7 @@ rust_structop::evaluate (struct type *expect_type,
field_name, type->name ());
int fieldno = rust_enum_variant (type);
lhs = value_primitive_field (lhs, 0, fieldno, type);
lhs = lhs->primitive_field (0, fieldno, type);
struct type *outer_type = type;
type = lhs->type ();