mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-29 09:55:00 +01:00
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:
@@ -12,19 +12,6 @@
|
||||
|
||||
namespace Carbon {
|
||||
|
||||
namespace {
|
||||
|
||||
struct TagVisitor {
|
||||
template <typename Alternative>
|
||||
auto operator()(const Alternative&) -> ValKind {
|
||||
return Alternative::Kind;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
auto Value::tag() const -> ValKind { return std::visit(TagVisitor(), value); }
|
||||
|
||||
auto Value::GetIntValue() const -> int {
|
||||
return std::get<IntValue>(value).value;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user