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

Method visit_relation

cel/src/parser/parser.rs:597–638  ·  view source on GitHub ↗
(&mut self, ctx: &RelationContext<'_>)

Source from the content-addressed store, hash-verified

595 }
596
597 fn visit_relation(&mut self, ctx: &RelationContext<'_>) -> Self::Return {
598 if ctx.op.is_none() {
599 match ctx.calc() {
600 None => self.report_error::<ParseError, _>(
601 ctx.start().deref(),
602 None,
603 "No `CalcContextAll`!",
604 ),
605 Some(calc) => <Self as ParseTreeVisitorCompat>::visit(self, calc.as_ref()),
606 }
607 } else {
608 match &ctx.op {
609 None => <Self as ParseTreeVisitorCompat>::visit_children(self, ctx),
610 Some(op) => {
611 if let (Some(lhs), Some(rhs)) = (ctx.relation(0), ctx.relation(1)) {
612 let lhs = self.visit(lhs.as_ref());
613 let op_id = self.helper.next_id(op.as_ref());
614 let rhs = self.visit(rhs.as_ref());
615 match operators::find_operator(op.get_text()) {
616 None => {
617 self.report_error::<ParseError, _>(
618 op.as_ref(),
619 None,
620 format!("Unknown `{}` operator!", op.get_text()),
621 );
622 IdedExpr::default()
623 }
624 Some(op) => {
625 self.global_call_or_macro(op_id, op.to_string(), vec![lhs, rhs])
626 }
627 }
628 } else {
629 self.report_error::<ParseError, _>(
630 ctx.start().deref(),
631 None,
632 format!("Incomplete `RelationContext` for `{:?}`!", ctx.op),
633 )
634 }
635 }
636 }
637 }
638 }
639
640 fn visit_calc(&mut self, ctx: &CalcContext<'_>) -> Self::Return {
641 match &ctx.op {

Callers

nothing calls this directly

Calls 8

find_operatorFunction · 0.85
startMethod · 0.80
visitMethod · 0.80
next_idMethod · 0.80
global_call_or_macroMethod · 0.80
calcMethod · 0.45
derefMethod · 0.45
relationMethod · 0.45

Tested by

no test coverage detected