| 833 | | def isConstructionOf(box as Box) as bool |
| 834 | | """ |
| 835 | | Returns true if this type is a construction of the given generic type def, even going more than level deep through `genericDef`. |
| 836 | | """ |
| 837 | | # TODO: can this implementation be replaced by: |
| 838 | | # return .constructedTypeOf(box) is not nil |
| 839 | | if .genericDef is nil |
| 840 | | return false |
| 841 | | if .genericDef is box |
| 842 | | return true |
| 843 | | if .genericDef.genericDef |
| 844 | | return .genericDef.isConstructionOf(box) # TODO: would iteration be more efficient here? |
| 845 | | return false |
| | 831 | def isDirectConstructionOf(box as Box) as bool |
| | 832 | """ |
| | 833 | Returns true if this type was directly constructed from the given box. |
| | 834 | """ |
| | 835 | require |
| | 836 | .didBindInh |
| | 837 | box.isGenericDef |
| | 838 | body |
| | 839 | return .genericDef is box |
| | 840 | |
| | 841 | def isIndirectConstructionOf(box as Box) as bool |
| | 842 | """ |
| | 843 | Returns true if this type or any of its ancestor types |
| | 844 | is a construction of the given generic type def. |
| | 845 | """ |
| | 846 | require |
| | 847 | .didBindInh |
| | 848 | box.isGenericDef |
| | 849 | body |
| | 850 | return .constructedTypeOf(box) is not nil |