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

Method FindMacro

parser/macro_registry.cc:53–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51}
52
53absl::optional<Macro> MacroRegistry::FindMacro(absl::string_view name,
54 size_t arg_count,
55 bool receiver_style) const {
56 // <function>:<argument_count>:<receiver_style>
57 if (name.empty() || absl::StrContains(name, ':')) {
58 return absl::nullopt;
59 }
60 // Try argument count specific key first.
61 auto key = absl::StrCat(name, ":", arg_count, ":",
62 receiver_style ? "true" : "false");
63 if (auto it = macros_.find(key); it != macros_.end()) {
64 return it->second;
65 }
66 // Next try variadic.
67 key = absl::StrCat(name, ":*:", receiver_style ? "true" : "false");
68 if (auto it = macros_.find(key); it != macros_.end()) {
69 return it->second;
70 }
71 return absl::nullopt;
72}
73
74std::vector<Macro> MacroRegistry::ListMacros() const {
75 std::vector<Macro> macros;

Callers 3

TESTFunction · 0.80
GlobalCallOrMacroImplMethod · 0.80

Calls 2

emptyMethod · 0.45
endMethod · 0.45

Tested by 1

TESTFunction · 0.64