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