Changeset 2305 for cobra/trunk/Source/Boxes.cobra
- Timestamp:
- 03/10/10 06:47:00 (2 years ago)
- Files:
-
- 1 modified
-
cobra/trunk/Source/Boxes.cobra (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cobra/trunk/Source/Boxes.cobra
r2299 r2305 835 835 Returns true if this type is a construction of the given generic type def, even going more than level deep through `genericDef`. 836 836 """ 837 # TODO: can this implementation be replaced by: 838 # return .constructedTypeOf(box) is not nil 837 839 if .genericDef is nil 838 840 return false … … 1764 1766 if box.isDescendantOf(cto) and .declForName(name) 1765 1767 return .constructedTypeFor(cto.genericParams).declForName(name) 1768 else if .isGeneric 1769 # Example: 1770 # this == Extension of IEnumerable<of T> 1771 # box == X implements IEnumerable<of int> 1772 # name == 'toList' 1773 # The IEnumerable<of T> has .genericDef IEnumerable<> 1774 # The X's IEnumerable<of int> has .genericDef IEnumerable<> 1775 # Note that X and the Extension are not directly connected. 1776 # Only by tracing up to the generic def IEnumerable<> do they "connect". 1777 # see cobra/Tests/420-extensions/400-extend-generics/220-extend-ancestor-interface.cobra 1778 constructed = box.constructedTypeOf(_extendedBox.genericDef to !) 1779 if constructed, return .extensionMemberFor(constructed, name) 1766 1780 return nil 1767 1781 1768 1782 def memberForName(name as String) as IMember? 1769 1783 result = base.memberForName(name) 1770 if result is nil 1771 result = .extendedBox.memberForName(name) 1784 if result is nil, result = .extendedBox.memberForName(name) 1772 1785 return result 1773 1786



