Mercurial > projects > ddmd
comparison dmd/Expression.d @ 73:ef02e2e203c2
Updating to dmd2.033
author | korDen |
---|---|
date | Sat, 28 Aug 2010 19:42:41 +0400 |
parents | efb1e5bdf63c |
children | be2ab491772e |
comparison
equal
deleted
inserted
replaced
72:2e2a5c3f943a | 73:ef02e2e203c2 |
---|---|
528 | 528 |
529 IntRange getIntRange() | 529 IntRange getIntRange() |
530 { | 530 { |
531 IntRange ir; | 531 IntRange ir; |
532 ir.imin = 0; | 532 ir.imin = 0; |
533 ir.imax = type.sizemask(); | 533 if (type.isintegral()) |
534 ir.imax = type.sizemask(); | |
535 else | |
536 ir.imax = 0xFFFFFFFFFFFFFFFFUL; // assume the worst | |
537 | |
534 return ir; | 538 return ir; |
535 } | 539 } |
536 | 540 |
537 /************************************** | 541 /************************************** |
538 * Do an explicit cast. | 542 * Do an explicit cast. |
739 * If this is a reference, dereference it. | 743 * If this is a reference, dereference it. |
740 */ | 744 */ |
741 Expression deref() | 745 Expression deref() |
742 { | 746 { |
743 //printf("Expression::deref()\n"); | 747 //printf("Expression::deref()\n"); |
744 if (type.ty == TY.Treference) | 748 // type could be null if forward referencing an 'auto' variable |
745 { | 749 if (type && type.ty == Treference) |
750 { | |
746 Expression e = new PtrExp(loc, this); | 751 Expression e = new PtrExp(loc, this); |
747 e.type = (cast(TypeReference)type).next; | 752 e.type = (cast(TypeReference)type).next; |
748 return e; | 753 return e; |
749 } | 754 } |
750 return this; | 755 return this; |
861 */ | 866 */ |
862 bool checkSideEffect(int flag) | 867 bool checkSideEffect(int flag) |
863 { | 868 { |
864 if (flag == 0) | 869 if (flag == 0) |
865 { | 870 { |
866 if (op == TOKimport) | 871 if (op == TOKerror) |
872 { | |
873 // Error should have already been printed | |
874 } | |
875 else if (op == TOKimport) | |
867 error("%s has no effect", toChars()); | 876 error("%s has no effect", toChars()); |
868 else | 877 else |
869 error("%s has no effect in expression (%s)", | 878 error("%s has no effect in expression (%s)", |
870 | 879 |
871 Token.toChars(op), toChars()); | 880 Token.toChars(op), toChars()); |