| 104 | } |
| 105 | |
| 106 | bool FindOutputBySemantics( ASTNode* node, const char** semantics, std::vector<Symbol*>* path ) |
| 107 | { |
| 108 | // check "out" function arguments |
| 109 | if( FindParameterBySemantics( node, semantics, path, true ) ) |
| 110 | { |
| 111 | return true; |
| 112 | } |
| 113 | // check return value if it has semantics |
| 114 | if( node->GetSymbol() && node->GetSymbol()->semantic.start ) |
| 115 | { |
| 116 | std::string sematic = ToString( node->GetSymbol()->semantic ); |
| 117 | for( unsigned i = 0; semantics[i]; ++i ) |
| 118 | { |
| 119 | if( _stricmp( sematic.c_str(), semantics[i] ) == 0 ) |
| 120 | { |
| 121 | if( path ) |
| 122 | { |
| 123 | path->push_back( nullptr ); |
| 124 | } |
| 125 | return true; |
| 126 | } |
| 127 | } |
| 128 | } |
| 129 | // finally check return value as a structure |
| 130 | if( node->GetType().symbol && |
| 131 | node->GetType().symbol->definition ) |
| 132 | { |
| 133 | for( unsigned i = 0; i < node->GetType().symbol->definition->GetChildrenCount(); ++i ) |
| 134 | { |
| 135 | if( FindParameterBySemantics( node->GetType().symbol->definition->GetChild( i ), semantics, path ) ) |
| 136 | { |
| 137 | if( path ) |
| 138 | { |
| 139 | path->insert( path->begin(), nullptr ); |
| 140 | } |
| 141 | return true; |
| 142 | } |
| 143 | } |
| 144 | } |
| 145 | return false; |
| 146 | } |
| 147 | |
| 148 | void PrintValuePath( std::ostream& os, const std::vector<Symbol*>& path, const char* functionSymbol ) |
| 149 | { |
no test coverage detected