| 1197 | } |
| 1198 | |
| 1199 | std::vector<ListExprElement> ParserVisitor::visitList( |
| 1200 | CelParser::ListInitContext* ctx) { |
| 1201 | std::vector<ListExprElement> rv; |
| 1202 | if (!ctx) return rv; |
| 1203 | rv.reserve(ctx->elems.size()); |
| 1204 | for (size_t i = 0; i < ctx->elems.size(); ++i) { |
| 1205 | auto* expr_ctx = ctx->elems[i]; |
| 1206 | if (expr_ctx == nullptr) { |
| 1207 | return rv; |
| 1208 | } |
| 1209 | if (!enable_optional_syntax_ && expr_ctx->opt != nullptr) { |
| 1210 | factory_.ReportError(SourceRangeFromParserRuleContext(ctx), |
| 1211 | "unsupported syntax '?'"); |
| 1212 | rv.push_back(factory_.NewListElement(factory_.NewUnspecified(0), false)); |
| 1213 | continue; |
| 1214 | } |
| 1215 | rv.push_back(factory_.NewListElement(ExprFromAny(visitExpr(expr_ctx->e)), |
| 1216 | expr_ctx->opt != nullptr)); |
| 1217 | } |
| 1218 | return rv; |
| 1219 | } |
| 1220 | |
| 1221 | std::vector<Expr> ParserVisitor::visitList(CelParser::ExprListContext* ctx) { |
| 1222 | std::vector<Expr> rv; |
nothing calls this directly
no test coverage detected