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

Function splitTypeName

src/ast/ast_module.cpp:32–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30 }
31
32 bool splitTypeName ( const string & name, string & moduleName, string & funcName ) {
33 // Find the first '::' that is NOT inside angle brackets — template-instance
34 // struct names like "Option<_wip_mod::Thing>" embed '::' inside '<...>',
35 // and we must not split there.
36 size_t at = string::npos;
37 int depth = 0;
38 for ( size_t i = 0; i + 1 < name.size(); ++i ) {
39 char c = name[i];
40 if ( c=='<' ) {
41 depth++;
42 } else if ( c=='>' ) {
43 if ( depth>0 ) depth--;
44 } else if ( depth==0 && c==':' && name[i+1]==':' ) {
45 at = i;
46 break;
47 }
48 }
49 if ( at!=string::npos ) {
50 moduleName = name.substr(0,at);
51 funcName = name.substr(at+2);
52 if ( moduleName=="builtin`" ) moduleName="$";
53 return true;
54 } else {
55 moduleName = "*";
56 funcName = name;
57 return false;
58 }
59 }
60
61 // ANNOTATION
62

Callers 15

getReaderMacroMethod · 0.85
makeCallMethod · 0.85
visitMethod · 0.85
findFuncAddrMethod · 0.85
findMissingCandidatesMethod · 0.85
findMatchingFunctionsMethod · 0.85
findTypeMacroMethod · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected