| 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 |