Implement IndirectValue (#588)

Also updates `FieldAccess` to use `IndirectValue`, as an example.
This commit is contained in:
Geoff Romer
2021-06-24 11:26:28 -07:00
committed by GitHub
parent 85cfb3b930
commit 6ca6822157
8 changed files with 265 additions and 7 deletions
@@ -638,7 +638,8 @@ void StepLvalue() {
case ExpressionKind::GetField: {
// { {e.f :: C, E, F} :: S, H}
// -> { e :: [].f :: C, E, F} :: S, H}
frame->todo.Push(MakeLvalAct(exp->GetFieldAccess().aggregate));
frame->todo.Push(
MakeLvalAct(exp->GetFieldAccess().aggregate.GetPointer()));
act->pos++;
break;
}
@@ -714,7 +715,8 @@ void StepExp() {
case ExpressionKind::GetField: {
// { { e.f :: C, E, F} :: S, H}
// -> { { e :: [].f :: C, E, F} :: S, H}
frame->todo.Push(MakeLvalAct(exp->GetFieldAccess().aggregate));
frame->todo.Push(
MakeLvalAct(exp->GetFieldAccess().aggregate.GetPointer()));
act->pos++;
break;
}
@@ -233,8 +233,8 @@ auto TypeCheckExp(const Expression* e, TypeEnv types, Env values,
return TCResult(tuple_e, tuple_t, new_types);
}
case ExpressionKind::GetField: {
auto res = TypeCheckExp(e->GetFieldAccess().aggregate, types, values,
nullptr, TCContext::ValueContext);
auto res = TypeCheckExp(e->GetFieldAccess().aggregate.GetPointer(), types,
values, nullptr, TCContext::ValueContext);
auto t = res.type;
switch (t->tag) {
case ValKind::StructTV: