mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 07:21:04 +01:00
Eliminate ExpToLValAction and DeleteTmpAction (#636)
We will eventually need the ability to materialize temporaries eventually, but we don't really seem to need it yet, and when we do, I think we should do it in a way that gives uniform treatment to temporaries and local variables.
This commit is contained in:
@@ -56,18 +56,6 @@ auto Action::MakeValAction(const Value* v) -> Action* {
|
||||
return act;
|
||||
}
|
||||
|
||||
auto Action::MakeExpToLValAction() -> Action* {
|
||||
auto* act = new Action();
|
||||
act->value = ExpToLValAction();
|
||||
return act;
|
||||
}
|
||||
|
||||
auto Action::MakeDeleteTmpAction(Address a) -> Action* {
|
||||
auto* act = new Action();
|
||||
act->value = DeleteTmpAction({.delete_tmp = a});
|
||||
return act;
|
||||
}
|
||||
|
||||
auto Action::GetLValAction() const -> const LValAction& {
|
||||
return std::get<LValAction>(value);
|
||||
}
|
||||
@@ -84,22 +72,8 @@ auto Action::GetValAction() const -> const ValAction& {
|
||||
return std::get<ValAction>(value);
|
||||
}
|
||||
|
||||
auto Action::GetExpToLValAction() const -> const ExpToLValAction& {
|
||||
return std::get<ExpToLValAction>(value);
|
||||
}
|
||||
|
||||
auto Action::GetDeleteTmpAction() const -> const DeleteTmpAction& {
|
||||
return std::get<DeleteTmpAction>(value);
|
||||
}
|
||||
|
||||
void Action::Print(std::ostream& out) {
|
||||
switch (tag()) {
|
||||
case ActionKind::DeleteTmpAction:
|
||||
std::cout << "delete_tmp(" << GetDeleteTmpAction().delete_tmp << ")";
|
||||
break;
|
||||
case ActionKind::ExpToLValAction:
|
||||
out << "exp=>lval";
|
||||
break;
|
||||
case ActionKind::LValAction:
|
||||
PrintExp(GetLValAction().exp);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user