| 41 | static constexpr char kHasExt[] = "hasExt"; |
| 42 | |
| 43 | absl::optional<std::string> ValidateExtensionIdentifier(const Expr& expr) { |
| 44 | return absl::visit( |
| 45 | absl::Overload( |
| 46 | [](const SelectExpr& select_expr) -> absl::optional<std::string> { |
| 47 | if (select_expr.test_only()) { |
| 48 | return absl::nullopt; |
| 49 | } |
| 50 | auto op_name = ValidateExtensionIdentifier(select_expr.operand()); |
| 51 | if (!op_name.has_value()) { |
| 52 | return absl::nullopt; |
| 53 | } |
| 54 | return absl::StrCat(*op_name, ".", select_expr.field()); |
| 55 | }, |
| 56 | [](const IdentExpr& ident_expr) -> absl::optional<std::string> { |
| 57 | return ident_expr.name(); |
| 58 | }, |
| 59 | [](const auto&) -> absl::optional<std::string> { |
| 60 | return absl::nullopt; |
| 61 | }), |
| 62 | expr.kind()); |
| 63 | } |
| 64 | |
| 65 | absl::optional<std::string> GetExtensionFieldName(const Expr& expr) { |
| 66 | if (const auto* select_expr = |