| 144 | } |
| 145 | |
| 146 | absl::optional<cel::Expr> CelIterVarMacroExpander( |
| 147 | cel::MacroExprFactory& factory, cel::Expr& target, |
| 148 | absl::Span<cel::Expr> args) { |
| 149 | if (!IsCelNamespace(target)) { |
| 150 | return absl::nullopt; |
| 151 | } |
| 152 | cel::Expr& depth_arg = args[0]; |
| 153 | if (!depth_arg.has_const_expr() || !depth_arg.const_expr().has_int_value() || |
| 154 | depth_arg.const_expr().int_value() < 0) { |
| 155 | return factory.ReportErrorAt( |
| 156 | depth_arg, "cel.iterVar requires two non-negative int constant args"); |
| 157 | } |
| 158 | cel::Expr& unique_arg = args[1]; |
| 159 | if (!unique_arg.has_const_expr() || |
| 160 | !unique_arg.const_expr().has_int_value() || |
| 161 | unique_arg.const_expr().int_value() < 0) { |
| 162 | return factory.ReportErrorAt( |
| 163 | unique_arg, "cel.iterVar requires two non-negative int constant args"); |
| 164 | } |
| 165 | return factory.NewIdent( |
| 166 | absl::StrCat("@it:", depth_arg.const_expr().int_value(), ":", |
| 167 | unique_arg.const_expr().int_value())); |
| 168 | } |
| 169 | |
| 170 | absl::optional<cel::Expr> CelAccuVarMacroExpander( |
| 171 | cel::MacroExprFactory& factory, cel::Expr& target, |
nothing calls this directly
no test coverage detected