Mercurial > projects > ddmd
comparison dmd/CastExp.d @ 137:09c858522d55
merge
author | Trass3r |
---|---|
date | Mon, 13 Sep 2010 23:29:00 +0200 |
parents | af1bebfd96a4 |
children | e3afd1303184 |
comparison
equal
deleted
inserted
replaced
136:9d194c848e3a | 137:09c858522d55 |
---|---|
181 | 181 |
182 if (t1bn.isShared() && !tobn.isShared()) | 182 if (t1bn.isShared() && !tobn.isShared()) |
183 // Cast away pointer to shared | 183 // Cast away pointer to shared |
184 goto Lunsafe; | 184 goto Lunsafe; |
185 | 185 |
186 if (t1bn.isWild() && !tobn.isConst() && !tobn.isWild()) | |
187 // Cast wild to anything but const | wild | |
188 goto Lunsafe; | |
189 | |
186 if (tobn.isTypeBasic() && tobn.size() < t1bn.size()) { | 190 if (tobn.isTypeBasic() && tobn.size() < t1bn.size()) { |
187 // Allow things like casting a long* to an int* | 191 // Allow things like casting a long* to an int* |
188 ; | 192 ; |
189 } else if (tobn.ty != TY.Tvoid) { | 193 } else if (tobn.ty != TY.Tvoid) { |
190 // Cast to a pointer other than void* | 194 // Cast to a pointer other than void* |
423 } else { | 427 } else { |
424 if (to) | 428 if (to) |
425 to.toCBuffer(buf, null, hgs); | 429 to.toCBuffer(buf, null, hgs); |
426 else | 430 else |
427 { | 431 { |
428 switch (mod) | 432 MODtoBuffer(buf, mod); |
429 { | |
430 case MODundefined: | |
431 break; | |
432 case MODconst: | |
433 buf.writestring(Token.tochars[TOKconst]); | |
434 break; | |
435 case MODinvariant: | |
436 buf.writestring(Token.tochars[TOKimmutable]); | |
437 break; | |
438 case MODshared: | |
439 buf.writestring(Token.tochars[TOKshared]); | |
440 break; | |
441 case MODshared | MODconst: | |
442 buf.writestring(Token.tochars[TOKshared]); | |
443 buf.writeByte(' '); | |
444 buf.writestring(Token.tochars[TOKconst]); | |
445 break; | |
446 default: | |
447 assert(0); | |
448 } | |
449 } | 433 } |
450 } | 434 } |
451 buf.writeByte(')'); | 435 buf.writeByte(')'); |
452 expToCBuffer(buf, hgs, e1, precedence[op]); | 436 expToCBuffer(buf, hgs, e1, precedence[op]); |
453 } | 437 } |