| 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 |
no test coverage detected