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 authored and GitHub committed 2021-07-13 13:53:48 -07:00
1 parent 05c2e610ba
commit b03d3cdbb0
6 files changed
+14 -50

No files matched your search

-15
View File
@@ -8,21 +8,6 @@
namespace Carbon {
namespace {
struct TagVisitor {
template <typename Alternative>
auto operator()(const Alternative&) -> ExpressionKind {
return Alternative::Kind;
}
};
} // namespace
auto Expression::tag() const -> ExpressionKind {
return std::visit(TagVisitor(), value);
}
auto Expression::GetIdentifierExpression() const
-> const IdentifierExpression& {
return std::get<IdentifierExpression>(value);