| 582 | } |
| 583 | |
| 584 | bool Type::CanImplicitCast( const Type& to, int& casts ) const |
| 585 | { |
| 586 | // For user-defined types and resource types we don't have implicit casts |
| 587 | if( symbol || to.symbol ) |
| 588 | { |
| 589 | return symbol == to.symbol; |
| 590 | } |
| 591 | if( !IsScalarOrVector() || !to.IsScalarOrVector() ) |
| 592 | { |
| 593 | return *this == to; |
| 594 | } |
| 595 | // Our types are scalars or vectors - check dimensions |
| 596 | if( width == 1 && height == 1 ) |
| 597 | { |
| 598 | if( to.width > 1 || to.height > 1 || to.builtInType != builtInType ) |
| 599 | { |
| 600 | casts++; |
| 601 | } |
| 602 | return true; |
| 603 | } |
| 604 | if( width >= to.width && height >= to.height ) |
| 605 | { |
| 606 | if( width != to.width || height != to.height ) |
| 607 | { |
| 608 | casts++; |
| 609 | } |
| 610 | if( builtInType != to.builtInType ) |
| 611 | { |
| 612 | casts++; |
| 613 | } |
| 614 | return true; |
| 615 | } |
| 616 | return false; |
| 617 | } |
| 618 | |
| 619 | bool Type::GetIndexedType( Type& type ) const |
| 620 | { |
no test coverage detected