Wiki

Changeset 2288

Show
Ignore:
Timestamp:
02/19/10 23:22:10 (2 years ago)
Author:
Chuck.Esterbrook
Message:

Fixed: Protected, nested enums are not read from libs.
reported-by:torial

Location:
cobra/trunk
Files:
1 added
1 modified

Legend:

Unmodified
Added
Removed
  • cobra/trunk/Source/BackEndClr/ScanClrType.cobra

    r2285 r2288  
    183183 
    184184    def _scanNestedTypes 
     185        # TODO: enable and fix resulting bugs 
     186        # for type in .clrType.getNestedTypes(BindingFlags(Instance, Static, DeclaredOnly, Public, NonPublic)) 
    185187        for type in .clrType.getNestedTypes 
    186             clrType = ClrNativeType(type) 
    187             if type.isClass 
    188                 .addDecl(Class(clrType)) 
    189             else if type.isInterface 
    190                 .addDecl(Interface(clrType)) 
    191             else if type.isEnum 
    192                 .addDecl(EnumDecl(this, clrType, List<of String>(), ''))  # TODO: isNames; docString? 
    193             else if type.isValueType 
    194                 .addDecl(Struct(clrType)) 
    195             else if type.isAnsiClass 
    196                 # The Enum class is an example that returns false for .isClass but true for .isAnsiClass 
    197                 .addDecl(Class(clrType)) 
    198             else 
    199                 throw FallThroughException(type) 
    200             lastDecl = .declsInOrder[.declsInOrder.count-1] to dynamic 
    201             if (lastDecl to Object).getType.getProperty('ParentBox')  # CC: if lastDecl responds to (get parentBox as Box?) 
    202                 lastDecl.parentBox = this 
     188            _scanNestedType(type) 
     189        for type in .clrType.getNestedTypes(BindingFlags(Static, DeclaredOnly, NonPublic)) 
     190            if type.isEnum and not type.isPublic, _scanNestedType(type) 
     191 
     192    def _scanNestedType(type as System.Type) 
     193        clrType = ClrNativeType(type) 
     194        if type.isClass 
     195            .addDecl(Class(clrType)) 
     196        else if type.isInterface 
     197            .addDecl(Interface(clrType)) 
     198        else if type.isEnum 
     199            .addDecl(EnumDecl(this, clrType, List<of String>(), ''))  # TODO: isNames; docString? 
     200        else if type.isValueType 
     201            .addDecl(Struct(clrType)) 
     202        else if type.isAnsiClass 
     203            # The Enum class is an example that returns false for .isClass but true for .isAnsiClass 
     204            .addDecl(Class(clrType)) 
     205        else 
     206            throw FallThroughException(type) 
     207        lastDecl = .declsInOrder[.declsInOrder.count-1] to dynamic 
     208        if (lastDecl to Object).getType.getProperty('ParentBox')  # CC: if lastDecl responds to (get parentBox as Box?) 
     209            lastDecl.parentBox = this 
    203210             
    204211    def _scanFields