MCPcopy Create free account
hub / github.com/GaijinEntertainment/daScript / forEachFunction

Function forEachFunction

src/builtin/module_builtin_ast.cpp:104–124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102 }
103
104 void forEachFunction ( Module * module, const char * name, const TBlock<void,FunctionPtr> & block, Context * context, LineInfoArg * lineInfo ) {
105 if ( !module ) context->throw_error_at(lineInfo, "expecting module, not null");
106 vec4f args[1];
107 if ( builtin_empty(name) ) {
108 auto & fnbn = module->functions;
109 context->invokeEx(block, args, nullptr, [&](SimNode * code){
110 fnbn.foreach([&](auto fnv){
111 args[0] = cast<FunctionPtr>::from(fnv);
112 code->eval(*context);
113 });
114 },lineInfo);
115 } else {
116 auto & fnbn = module->functionsByName[hash64z(name)];
117 context->invokeEx(block, args, nullptr, [&](SimNode * code){
118 for ( auto & nv : fnbn ) {
119 args[0] = cast<FunctionPtr>::from(nv);
120 code->eval(*context);
121 }
122 },lineInfo);
123 }
124 }
125
126 void forEachGenericFunction ( Module * module, const char * name, const TBlock<void,FunctionPtr> & block, Context * context, LineInfoArg * lineInfo ) {
127 if ( !module ) context->throw_error_at(lineInfo, "expecting module, not null");

Callers

nothing calls this directly

Calls 6

builtin_emptyFunction · 0.85
hash64zFunction · 0.85
throw_error_atMethod · 0.80
invokeExMethod · 0.80
foreachMethod · 0.45
evalMethod · 0.45

Tested by

no test coverage detected