MCPcopy Create free account
hub / github.com/cel-rust/cel-rust / list_initializer_list

Method list_initializer_list

cel/src/parser/parser.rs:337–361  ·  view source on GitHub ↗
(&mut self, ctx: &ListInitContextAll)

Source from the content-addressed store, hash-verified

335 }
336
337 fn list_initializer_list(&mut self, ctx: &ListInitContextAll) -> (Vec<IdedExpr>, Vec<usize>) {
338 let mut list = Vec::default();
339 let mut optionals = Vec::default();
340 for (i, e) in ctx.elems.iter().enumerate() {
341 match &e.e {
342 None => return (Vec::default(), Vec::default()),
343 Some(exp) => {
344 if let Some(opt) = &e.opt {
345 if self.enable_optional_syntax {
346 optionals.push(i);
347 } else {
348 self.report_error::<ParseError, _>(
349 opt.as_ref(),
350 None,
351 "unsupported syntax '?'",
352 );
353 continue;
354 }
355 }
356 list.push(self.visit(exp.as_ref()));
357 }
358 }
359 }
360 (list, optionals)
361 }
362
363 fn report_error<E: Error + Send + Sync + 'static, S: Into<String>>(
364 &mut self,

Callers 1

visit_CreateListMethod · 0.80

Calls 3

pushMethod · 0.80
visitMethod · 0.80
iterMethod · 0.45

Tested by

no test coverage detected