Use a lambda for tag's visit (#645)

Also shifts declaration order a little for [style](https://google.github.io/styleguide/cppguide.html#Declaration_Order); moving line_num down (data members after methods) and tag() down (factory functions before instance members).
This commit is contained in:
Jon Meow
2021-07-13 13:53:48 -07:00
committed by GitHub
parent 05c2e610ba
commit b03d3cdbb0
6 changed files with 14 additions and 50 deletions
@@ -17,21 +17,6 @@
namespace Carbon {
namespace {
struct TagVisitor {
template <typename Alternative>
auto operator()(const Alternative&) -> ActionKind {
return Alternative::Kind;
}
};
} // namespace
auto Action::tag() const -> ActionKind {
return std::visit(TagVisitor(), value);
}
auto Action::MakeLValAction(const Expression* e) -> Action* {
auto* act = new Action();
act->value = LValAction({.exp = e});