Changeset 1703
- Timestamp:
- 10/23/08 13:27:14 (3 months ago)
- Location:
- cobra/trunk
- Files:
-
- 2 added
- 2 modified
-
Developer/IntermediateReleaseNotes.text (modified) (1 diff)
-
Source/Enums.cobra (modified) (4 diffs)
-
Tests/720-libraries/400-other/300-ReadLibTest-Lib.cobra (added)
-
Tests/720-libraries/400-other/302-ReadLibTest-Program.cobra (added)
Legend:
- Unmodified
- Added
- Removed
-
cobra/trunk/Developer/IntermediateReleaseNotes.text
r1702 r1703 169 169 170 170 * Fixed: CobraCore.exePath uses `Assembly.getExecutingAssembly` when it should be using `Assembly.getEntryAssembly` instead. This reveals itself when using -embed-run-time:no. 171 172 * Fixed: Reading enums with non-int32 storage types (such as uint32 and uint64) causes an exception in the compiler. -
cobra/trunk/Source/Enums.cobra
r1681 r1703 31 31 _needScanNativeType = false 32 32 clrType = (_nativeType to ClrType).theClrType # TODO: fix native 33 isByte = Enum.getUnderlyingType(clrType).name == 'Byte' 34 is64 = Enum.getUnderlyingType(clrType).name == 'Int64' 35 values = Enum.getValues(clrType) 33 isByte = Enum.getUnderlyingType(clrType).name == 'Byte' 34 is64 = Enum.getUnderlyingType(clrType).name == 'Int64' 35 isU32 = Enum.getUnderlyingType(clrType).name == 'UInt32' 36 isU64 = Enum.getUnderlyingType(clrType).name == 'UInt64' 37 values = Enum.getValues(clrType) 36 38 i = 0 37 39 for name in Enum.getNames(clrType) … … 45 47 catch OverflowException 46 48 intValue = 999 # CC: omg. but probably doesn't affect anything. we're reading the DLL here, not creating one 49 else if isU32 50 try 51 intValue = int.parse((value to UInt32).toString) 52 catch OverflowException 53 intValue = 2147483647 54 else if isU64 55 try 56 intValue = int.parse((value to UInt64).toString) 57 catch OverflowException 58 intValue = 2147483647 47 59 else 48 60 intValue = value to int … … 87 99 if _storageTypeNode 88 100 _storageType = _storageTypeNode.realType 89 # TODO: give error if _storageType is not some kind of int or char or whatever is legal 101 if not _storageType.isDescendantOf(.compiler.anyIntType) 102 .throwError('The enumeration storage type must be a primitive integer type such as int8, uint8, int16, uint16, int, uint, int64 or uint64.') 90 103 if _needScanNativeType 91 104 _scanClrType … … 94 107 base._bindImp 95 108 for attrib in .attributes, attrib.bindImp 96 # TODO: can this be removed? since the storage type is always something primitive like 'int', there should be no need for enum to give it .bindImp 97 if _storageType 98 _storageType.bindImp 109 # the storage type is always a primitive type like `int` so no _bindImp is necessary 99 110 100 111 def extensionMemberFor(box as Box, name as String) as IMember?
