| 431 | } |
| 432 | |
| 433 | static bool GetElementType( const Type& type, unsigned index, Type& elementType ) |
| 434 | { |
| 435 | if( type.symbol ) |
| 436 | { |
| 437 | if( !type.symbol->definition ) |
| 438 | { |
| 439 | return false; |
| 440 | } |
| 441 | for( unsigned i = 0; i < type.symbol->definition->GetChildrenCount(); ++i ) |
| 442 | { |
| 443 | if( index <= type.symbol->definition->GetChild( i )->GetChildrenCount() ) |
| 444 | { |
| 445 | elementType = type.symbol->definition->GetChild( i )->GetType(); |
| 446 | return true; |
| 447 | } |
| 448 | index -= unsigned( type.symbol->definition->GetChild( i )->GetChildrenCount() ); |
| 449 | } |
| 450 | return false; |
| 451 | } |
| 452 | else |
| 453 | { |
| 454 | if( type.height > 1 ) |
| 455 | { |
| 456 | if( int( index ) >= type.height ) |
| 457 | { |
| 458 | return false; |
| 459 | } |
| 460 | elementType = type; |
| 461 | elementType.height = 1; |
| 462 | return true; |
| 463 | } |
| 464 | else |
| 465 | { |
| 466 | elementType = type; |
| 467 | elementType.height = 1; |
| 468 | elementType.width = 1; |
| 469 | return true; |
| 470 | } |
| 471 | } |
| 472 | } |
| 473 | |
| 474 | bool EvaluateInitializer( ParserState& state, ASTNode* node, Type& type, ExpressionValue& value, StateValue* stateValues ) |
| 475 | { |
no test coverage detected