| 2064 | } |
| 2065 | |
| 2066 | std::string FieldRef::ToDotPath() const { |
| 2067 | struct Visitor { |
| 2068 | std::string operator()(const FieldPath& path) { |
| 2069 | std::string out; |
| 2070 | for (int i : path.indices()) { |
| 2071 | out += "[" + internal::ToChars(i) + "]"; |
| 2072 | } |
| 2073 | return out; |
| 2074 | } |
| 2075 | |
| 2076 | std::string operator()(const std::string& name) { return "." + name; } |
| 2077 | |
| 2078 | std::string operator()(const std::vector<FieldRef>& children) { |
| 2079 | std::string out; |
| 2080 | for (const auto& child : children) { |
| 2081 | out += child.ToDotPath(); |
| 2082 | } |
| 2083 | return out; |
| 2084 | } |
| 2085 | }; |
| 2086 | |
| 2087 | return std::visit(Visitor{}, impl_); |
| 2088 | } |
| 2089 | |
| 2090 | size_t FieldRef::hash() const { |
| 2091 | struct Visitor : std::hash<std::string> { |
no outgoing calls