| 1310 | } |
| 1311 | |
| 1312 | bool ProcessGlobalInputAttribute( ParserState& state, ASTNode* func, std::vector<GlobalInputElement>& globalInput ) |
| 1313 | { |
| 1314 | if( auto attribs = func->GetChildOrNull( 2 ) ) |
| 1315 | { |
| 1316 | for( auto& attrib : attribs->GetChildren() ) |
| 1317 | { |
| 1318 | if( attrib->GetToken()->stringValue == "globalinput" ) |
| 1319 | { |
| 1320 | if( !attrib->GetChildOrNull( 0 ) ) |
| 1321 | { |
| 1322 | state.ShowMessage( attrib->GetToken()->fileLocation, EC_CUSTOM_ERROR, "Function annotation globalinput must have a string parameter with global input declarations" ); |
| 1323 | return false; |
| 1324 | } |
| 1325 | auto input = ParseGlobalInput( state, *attrib->GetChildOrNull( 0 )->GetToken() ); |
| 1326 | if( !input ) |
| 1327 | { |
| 1328 | return false; |
| 1329 | } |
| 1330 | if( !globalInput.empty() ) |
| 1331 | { |
| 1332 | if( globalInput != *input ) |
| 1333 | { |
| 1334 | state.ShowMessage( attrib->GetToken()->fileLocation, EC_CUSTOM_ERROR, "Function annotations globalinput must match across all functions in the library" ); |
| 1335 | return false; |
| 1336 | } |
| 1337 | } |
| 1338 | else |
| 1339 | { |
| 1340 | globalInput = *input; |
| 1341 | } |
| 1342 | } |
| 1343 | } |
| 1344 | } |
| 1345 | return true; |
| 1346 | } |
no test coverage detected