Wiki
Show
Ignore:
Timestamp:
03/10/10 08:30:47 (2 years ago)
Author:
Chuck.Esterbrook
Message:

Code cleanup.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • cobra/trunk/Source/Statements.cobra

    r2300 r2307  
    591591        isStreamOfKeyValue = .what.type.isDictionaryLike 
    592592        if not isStreamOfKeyValue and _var.type inherits Box 
    593             isStreamOfKeyValue = (_var.type to Box).isConstructionOf(.compiler.libraryType('System.Collections.Generic.KeyValuePair<of,>') to Box) 
     593            isStreamOfKeyValue = (_var.type to Box).isIndirectConstructionOf(.compiler.libraryType('System.Collections.Generic.KeyValuePair<of,>') to Box) 
    594594        if isStreamOfKeyValue 
    595595            # This covers: 
     
    14621462            resultType = curCodeMember.resultType 
    14631463            if not resultType inherits StreamType and resultType <> .compiler.enumerableType and resultType <> .compiler.enumeratorType 
    1464                 okay = false 
     1464                bad = true 
    14651465                if resultType inherits Box 
    14661466                    ienumerableOf = .compiler.enumerableOfType 
    14671467                    ienumeratorOf = .compiler.enumeratorOfType 
    1468                     okay = not (resultType is not ienumerableOf and resultType is not ienumeratorOf and not resultType.isConstructionOf(ienumerableOf) and not resultType.isConstructionOf(ienumeratorOf)) 
    1469                 if not okay 
    1470                     .throwError('Cannot yield unless the return type is an iterator type. Try "[expr.type.name]*".') 
     1468                    bad = resultType is not ienumerableOf and resultType is not ienumeratorOf and not resultType.isDirectConstructionOf(ienumerableOf) and not resultType.isDirectConstructionOf(ienumeratorOf) 
     1469                if bad, .throwError('Cannot yield unless the return type is an iterator type. Try "[expr.type.name]*".') 
    14711470            if resultType inherits StreamType 
    14721471                elementType = resultType.innerType to !