| 166 | } |
| 167 | |
| 168 | absl::StatusOr<SelectQualifier> SelectQualifierFromList(const ListExpr& list) { |
| 169 | if (list.elements().size() != 2) { |
| 170 | return absl::InvalidArgumentError("Invalid cel.attribute select list"); |
| 171 | } |
| 172 | |
| 173 | const Expr& field_number = list.elements()[0].expr(); |
| 174 | const Expr& field_name = list.elements()[1].expr(); |
| 175 | |
| 176 | if (!field_number.has_const_expr() || |
| 177 | !field_number.const_expr().has_int64_value()) { |
| 178 | return absl::InvalidArgumentError( |
| 179 | "Invalid cel.attribute field select number"); |
| 180 | } |
| 181 | |
| 182 | if (!field_name.has_const_expr() || |
| 183 | !field_name.const_expr().has_string_value()) { |
| 184 | return absl::InvalidArgumentError( |
| 185 | "Invalid cel.attribute field select name"); |
| 186 | } |
| 187 | |
| 188 | return FieldSpecifier{field_number.const_expr().int64_value(), |
| 189 | field_name.const_expr().string_value()}; |
| 190 | } |
| 191 | |
| 192 | // Returns a qualifier instruction derived from a unoptimized ast. |
| 193 | absl::StatusOr<QualifierInstruction> SelectInstructionFromConstant( |
no test coverage detected