| 1023 | } |
| 1024 | |
| 1025 | std::any ParserVisitor::visitSelect(CelParser::SelectContext* ctx) { |
| 1026 | auto operand = ExprFromAny(visit(ctx->member())); |
| 1027 | // Handle the error case where no valid identifier is specified. |
| 1028 | if (!ctx->id || !ctx->op) { |
| 1029 | return ExprToAny(factory_.NewUnspecified( |
| 1030 | factory_.NextId(SourceRangeFromParserRuleContext(ctx)))); |
| 1031 | } |
| 1032 | auto id = NormalizeIdentifier(ctx->id); |
| 1033 | if (ctx->opt != nullptr) { |
| 1034 | if (!enable_optional_syntax_) { |
| 1035 | return ExprToAny(factory_.ReportError( |
| 1036 | SourceRangeFromParserRuleContext(ctx), "unsupported syntax '.?'")); |
| 1037 | } |
| 1038 | auto op_id = factory_.NextId(SourceRangeFromToken(ctx->op)); |
| 1039 | std::vector<Expr> arguments; |
| 1040 | arguments.reserve(2); |
| 1041 | arguments.push_back(std::move(operand)); |
| 1042 | arguments.push_back(factory_.NewStringConst( |
| 1043 | factory_.NextId(SourceRangeFromParserRuleContext(ctx)), std::move(id))); |
| 1044 | return ExprToAny(factory_.NewCall(op_id, "_?._", std::move(arguments))); |
| 1045 | } |
| 1046 | return ExprToAny( |
| 1047 | factory_.NewSelect(factory_.NextId(SourceRangeFromToken(ctx->op)), |
| 1048 | std::move(operand), std::move(id))); |
| 1049 | } |
| 1050 | |
| 1051 | std::any ParserVisitor::visitMemberCall(CelParser::MemberCallContext* ctx) { |
| 1052 | auto operand = ExprFromAny(visit(ctx->member())); |
nothing calls this directly
no test coverage detected