| 58 | |
| 59 | |
| 60 | static bool FindParameterBySemantics( ASTNode* node, const char** semantics, std::vector<Symbol*>* path, bool outParameter = false ) |
| 61 | { |
| 62 | for( unsigned j = 0; j < node->GetChildrenCount(); ++j ) |
| 63 | { |
| 64 | Symbol* symbol = node->GetChild( j )->GetSymbol(); |
| 65 | if( symbol == nullptr ) |
| 66 | { |
| 67 | continue; |
| 68 | } |
| 69 | if( outParameter ) |
| 70 | { |
| 71 | if( node->GetChild( j )->GetToken() == 0 || node->GetChild( j )->GetToken()->type == OP_IN ) |
| 72 | { |
| 73 | continue; |
| 74 | } |
| 75 | } |
| 76 | for( unsigned k = 0; semantics[k]; ++k ) |
| 77 | { |
| 78 | if( _stricmp( ToString( symbol->semantic ).c_str(), semantics[k] ) == 0 ) |
| 79 | { |
| 80 | if( path ) |
| 81 | { |
| 82 | path->clear(); |
| 83 | path->push_back( symbol ); |
| 84 | } |
| 85 | return true; |
| 86 | } |
| 87 | } |
| 88 | if( node->GetChild( j )->GetType().symbol && node->GetChild( j )->GetType().symbol->definition ) |
| 89 | { |
| 90 | for( unsigned i = 0; i < node->GetChild( j )->GetType().symbol->definition->GetChildrenCount(); ++i ) |
| 91 | { |
| 92 | if( FindParameterBySemantics( node->GetChild( j )->GetType().symbol->definition->GetChild( i ), semantics, path ) ) |
| 93 | { |
| 94 | if( path ) |
| 95 | { |
| 96 | path->insert( path->begin(), symbol ); |
| 97 | } |
| 98 | return true; |
| 99 | } |
| 100 | } |
| 101 | } |
| 102 | } |
| 103 | return false; |
| 104 | } |
| 105 | |
| 106 | bool FindOutputBySemantics( ASTNode* node, const char** semantics, std::vector<Symbol*>* path ) |
| 107 | { |