Changeset 1581
- Timestamp:
- 08/18/08 08:40:54 (3 months ago)
- Location:
- cobra/trunk
- Files:
-
- 3 modified
-
Developer/IntermediateReleaseNotes.text (modified) (1 diff)
-
Source/Expr.cobra (modified) (2 diffs)
-
Tests/100-basics/920-hex-lit.cobra (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cobra/trunk/Developer/IntermediateReleaseNotes.text
r1577 r1581 101 101 102 102 * Fixed: Using `ref` on a variable that experienced an error causes an internal exception. 103 104 * Fixed: Some bitwise operations with integer literals of 16 or 8 bits produce invalid compilation errors. -
cobra/trunk/Source/Expr.cobra
r1577 r1581 242 242 """ 243 243 type = .type 244 cast = _contextType and type.isDynamic 244 cast = false 245 if _contextType 246 if type.isDynamic 247 cast = true 248 else if type inherits IntType 249 if type.size < 32, cast = true 245 250 if cast 246 251 if parens, sw.write('(') … … 2762 2767 2763 2768 get asSharp as String is override 2764 return _value.toString 2769 s = '' 2770 if (info = .token.info) inherits int 2771 branch info 2772 on - 8, s = 'System.SByte' 2773 on + 8, s = 'System.Byte' 2774 on -16, s = 'System.Int16' 2775 on +16, s = 'System.UInt16' 2776 on -32, s = '' 2777 on +32, s = 'U' 2778 on -64, s = 'L' 2779 on +64, s = 'UL' 2780 else, throw FallThroughException(info) 2781 if s.length <= 2 2782 return _value.toString + s 2783 else 2784 return '([s])[_value.toString]' 2765 2785 2766 2786 -
cobra/trunk/Tests/100-basics/920-hex-lit.cobra
r1537 r1581 137 137 assert b.getType is Byte 138 138 139 # These dont compile for some reason - same with non hex vals 140 #b = 255u8 141 #b = b & 0x1fu8 142 ## OR 143 ##b = b & 31u8 144 #assert b == 0x1fu8 145 #b = 255u8 146 #b1 = 0x1fu8 147 #b = b & b1 148 #print b 139 b = 255u8 140 b = b & 0x1fu8 141 assert b == 0x1fu8 142 143 b = 255u8 144 b = b & 31u8 145 assert b == 0x1fu8 146 147 b = 255u8 148 b1 = 0x1fu8 149 b = b & b1 150 assert b == 0x1fu8 149 151 150 152 c = 0x0_u8 … … 152 154 assert c == 0x1e_u8 153 155 154 # Neither do these 155 #c = 0x0_u8 156 #c = c | 0x0_u8 157 #assert c == 0x1e_u8 158 # 159 #c = 0x0_u8 160 #c1 = 0x0_u8 161 #c = c | c1 162 #assert c == 0x1e_u8 163 156 c = 0x0_u8 157 c = c | 0x1e_u8 158 assert c == 0x1e_u8 159 160 c = 0x0_u8 161 c1 = 0x1e_u8 162 c = c | c1 163 assert c == 0x1e_u8 164 164 165 def main is shared 165 166 .lit
