MCPcopy Create free account
hub / github.com/appdevforall/CodeOnTheGo / try_builtin_func

Function try_builtin_func

subprojects/llama.cpp/common/jinja/runtime.cpp:277–293  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

275}
276
277static value try_builtin_func(context & ctx, const std::string & name, value & input, bool undef_on_missing = false) {
278 JJ_DEBUG("Trying built-in function '%s' for type %s", name.c_str(), input->type().c_str());
279 if (ctx.is_get_stats) {
280 input->stats.used = true;
281 input->stats.ops.insert(name);
282 }
283 auto builtins = input->get_builtins();
284 auto it = builtins.find(name);
285 if (it != builtins.end()) {
286 JJ_DEBUG("Binding built-in '%s'", name.c_str());
287 return mk_val<value_func>(name, it->second, input);
288 }
289 if (undef_on_missing) {
290 return mk_val<value_undefined>(name);
291 }
292 throw std::runtime_error("Unknown (built-in) filter '" + name + "' for type " + input->type());
293}
294
295value filter_expression::execute_impl(context & ctx) {
296 value input = operand ? operand->execute(ctx) : val;

Callers 1

execute_implMethod · 0.85

Calls 4

typeMethod · 0.65
findMethod · 0.65
insertMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected