Switch Member to variant in anticipation of more kinds. (#656)

Note this overlaps a little with #644's Member changes, but not too badly.
This commit is contained in:
Jon Meow
2021-07-15 15:23:52 -07:00
committed by GitHub
parent 467b58abe9
commit ada2be2d16
6 changed files with 54 additions and 37 deletions
@@ -300,12 +300,12 @@ auto ChoiceDeclaration::InitGlobals(Env& globals) const -> void {
auto StructDeclaration::InitGlobals(Env& globals) const -> void {
VarValues fields;
VarValues methods;
for (auto i = definition.members->begin(); i != definition.members->end();
++i) {
switch ((*i)->tag) {
for (Member* m : *definition.members) {
switch (m->tag()) {
case MemberKind::FieldMember: {
auto t = InterpExp(Env(), (*i)->u.field.type);
fields.push_back(make_pair(*(*i)->u.field.name, t));
const auto& field = m->GetFieldMember();
auto t = InterpExp(Env(), field.type);
fields.push_back({field.name, t});
break;
}
}