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

Method makeCall

src/ast/ast_program.cpp:297–317  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

295 }
296
297 ExprLooksLikeCall * Program::makeCall ( const LineInfo & at, const string & name ) {
298 vector<ExprCallFactory *> ptr;
299 string moduleName, funcName;
300 splitTypeName(name, moduleName, funcName);
301 if ( moduleName != "_" && moduleName != "__" ) { // those are never found. in reality we may want to support this one day with "*" and "thisModuleName" accordingly
302 library.foreach([&](Module * pm) -> bool {
303 if ( auto pp = pm->findCall(funcName) ) {
304 ptr.push_back(pp);
305 }
306 return true;
307 }, moduleName);
308 }
309 if ( ptr.size()==1 ) {
310 return (*ptr.back())(at);
311 } else if ( ptr.size()==0 ) {
312 return new ExprCall(at,name);
313 } else {
314 error("too many options for " + name,"","", at, CompilationError::ambiguous_function);
315 return new ExprCall(at,name);
316 }
317 }
318
319 ExprLooksLikeCall * Program::makeCall ( const LineInfo & at, const LineInfo & atEnd, const string & name ) {
320 auto res = makeCall(at, name);

Callers 6

yyparseFunction · 0.80
yyparseFunction · 0.80
ast_lpipeFunction · 0.80
ast_rpipeFunction · 0.80
yyparseFunction · 0.80
makeCallFunction · 0.80

Calls 6

splitTypeNameFunction · 0.85
makeCallFunction · 0.85
findCallMethod · 0.80
foreachMethod · 0.45
push_backMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected