MCPcopy Create free account
hub / github.com/cel-expr/cel-cpp / ReceiverCallOrMacroImpl

Method ReceiverCallOrMacroImpl

parser/parser.cc:1470–1500  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1468}
1469
1470Expr ParserVisitor::ReceiverCallOrMacroImpl(int64_t expr_id,
1471 absl::string_view function,
1472 Expr target,
1473 std::vector<Expr> args) {
1474 if (auto macro = macro_registry_.FindMacro(function, args.size(), true);
1475 macro) {
1476 Expr macro_target;
1477 std::vector<Expr> macro_args;
1478 if (add_macro_calls_) {
1479 macro_args.reserve(args.size());
1480 macro_target = factory_.BuildMacroCallArg(target);
1481 for (const auto& arg : args) {
1482 macro_args.push_back(factory_.BuildMacroCallArg(arg));
1483 }
1484 }
1485 factory_.BeginMacro(factory_.GetSourceRange(expr_id));
1486 auto expr = macro->Expand(factory_, std::ref(target), absl::MakeSpan(args));
1487 factory_.EndMacro();
1488 if (expr) {
1489 if (add_macro_calls_) {
1490 factory_.AddMacroCall(expr->id(), function, std::move(macro_target),
1491 std::move(macro_args));
1492 }
1493 // We did not end up using `expr_id`. Delete metadata.
1494 factory_.EraseId(expr_id);
1495 return std::move(*expr);
1496 }
1497 }
1498 return factory_.NewMemberCall(expr_id, function, std::move(target),
1499 std::move(args));
1500}
1501
1502std::string ParserVisitor::ExtractQualifiedName(antlr4::ParserRuleContext* ctx,
1503 const Expr& e) {

Callers

nothing calls this directly

Calls 10

FindMacroMethod · 0.80
BuildMacroCallArgMethod · 0.80
BeginMacroMethod · 0.80
GetSourceRangeMethod · 0.80
EndMacroMethod · 0.80
AddMacroCallMethod · 0.80
EraseIdMethod · 0.80
sizeMethod · 0.45
idMethod · 0.45
NewMemberCallMethod · 0.45

Tested by

no test coverage detected