comparison dmd/Expression.d @ 141:7171e6ea651d

+ Expression.toElem + Expression.toDt + Expression.isBit + BoolExp.optimize
author Trass3r
date Tue, 14 Sep 2010 02:38:37 +0200
parents af1bebfd96a4
children e3afd1303184
comparison
equal deleted inserted replaced
140:31c086f76669 141:7171e6ea651d
51 import dmd.TypeReference; 51 import dmd.TypeReference;
52 import dmd.Util; 52 import dmd.Util;
53 import dmd.Complex; 53 import dmd.Complex;
54 54
55 import dmd.backend.elem; 55 import dmd.backend.elem;
56 import dmd.backend.Util;
56 import dmd.backend.dt_t; 57 import dmd.backend.dt_t;
57 58
58 import core.memory; 59 import core.memory;
59 60
60 import std.stdio : writef; 61 import std.stdio : writef;
912 bool isBool(bool result) 913 bool isBool(bool result)
913 { 914 {
914 return false; 915 return false;
915 } 916 }
916 917
917 int isBit() 918 /********************************
918 { 919 * Does this expression result in either a 1 or a 0?
919 assert(false); 920 */
921 int isBit()
922 {
923 return false;
920 } 924 }
921 925
922 /******************************** 926 /********************************
923 * Check for expressions that have no use. 927 * Check for expressions that have no use.
924 * Input: 928 * Input:
958 } 962 }
959 963
960 /**************************************** 964 /****************************************
961 * Resolve __LINE__ and __FILE__ to loc. 965 * Resolve __LINE__ and __FILE__ to loc.
962 */ 966 */
963
964 Expression resolveLoc(Loc loc, Scope sc) 967 Expression resolveLoc(Loc loc, Scope sc)
965 { 968 {
966 return this; 969 return this;
967 } 970 }
968 971
1062 } 1065 }
1063 1066
1064 // Back end 1067 // Back end
1065 elem* toElem(IRState* irs) 1068 elem* toElem(IRState* irs)
1066 { 1069 {
1070 print();
1067 assert(false); 1071 assert(false);
1072 return null;
1068 } 1073 }
1069 1074
1070 dt_t** toDt(dt_t** pdt) 1075 dt_t** toDt(dt_t** pdt)
1071 { 1076 {
1072 assert(false); 1077 debug
1078 {
1079 writef("Expression::toDt() %d\n", op);
1080 dump(0);
1081 }
1082 error("non-constant expression %s", toChars());
1083 pdt = dtnzeros(pdt, 1);
1084 return pdt;
1073 } 1085 }
1074 } 1086 }
1075 1087
1076 alias Vector!Expression Expressions; 1088 alias Vector!Expression Expressions;