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

Method GlobalCallOrMacroImpl

parser/parser.cc:1441–1468  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1439std::string ParserVisitor::ErrorMessage() { return factory_.ErrorMessage(); }
1440
1441Expr ParserVisitor::GlobalCallOrMacroImpl(int64_t expr_id,
1442 absl::string_view function,
1443 std::vector<Expr> args) {
1444 if (auto macro = macro_registry_.FindMacro(function, args.size(), false);
1445 macro) {
1446 std::vector<Expr> macro_args;
1447 if (add_macro_calls_) {
1448 macro_args.reserve(args.size());
1449 for (const auto& arg : args) {
1450 macro_args.push_back(factory_.BuildMacroCallArg(arg));
1451 }
1452 }
1453 factory_.BeginMacro(factory_.GetSourceRange(expr_id));
1454 auto expr = macro->Expand(factory_, absl::nullopt, absl::MakeSpan(args));
1455 factory_.EndMacro();
1456 if (expr) {
1457 if (add_macro_calls_) {
1458 factory_.AddMacroCall(expr->id(), function, absl::nullopt,
1459 std::move(macro_args));
1460 }
1461 // We did not end up using `expr_id`. Delete metadata.
1462 factory_.EraseId(expr_id);
1463 return std::move(*expr);
1464 }
1465 }
1466
1467 return factory_.NewCall(expr_id, function, std::move(args));
1468}
1469
1470Expr ParserVisitor::ReceiverCallOrMacroImpl(int64_t expr_id,
1471 absl::string_view function,

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
NewCallMethod · 0.45

Tested by

no test coverage detected