comparison dmd/ArrayLengthExp.d @ 162:438eaa11eed4

updated build script to use dmd2.039 some missing methods implemented
author korDen
date Tue, 21 Sep 2010 14:59:56 +0400
parents 60bb0fe4563e
children d237b38b5858
comparison
equal deleted inserted replaced
161:584dc990e12f 162:438eaa11eed4
1 module dmd.ArrayLengthExp; 1 module dmd.ArrayLengthExp;
2 2
3 import dmd.common; 3 import dmd.common;
4 import dmd.Expression; 4 import dmd.Expression;
5 import dmd.GlobalExpressions;
6 import dmd.IntegerExp;
5 import dmd.BinExp; 7 import dmd.BinExp;
6 import dmd.backend.elem; 8 import dmd.backend.elem;
7 import dmd.UnaExp; 9 import dmd.UnaExp;
8 import dmd.InterState; 10 import dmd.InterState;
9 import dmd.OutBuffer; 11 import dmd.OutBuffer;
93 return e; 95 return e;
94 } 96 }
95 97
96 override Expression interpret(InterState istate) 98 override Expression interpret(InterState istate)
97 { 99 {
98 assert(false); 100 Expression e;
101 Expression e1;
102
103 version (LOG) {
104 printf("ArrayLengthExp.interpret() %s\n", toChars());
105 }
106 e1 = this.e1.interpret(istate);
107 if (e1 is EXP_CANT_INTERPRET)
108 goto Lcant;
109 if (e1.op == TOKstring || e1.op == TOKarrayliteral || e1.op == TOKassocarrayliteral)
110 {
111 e = ArrayLength(type, e1);
112 }
113 else if (e1.op == TOKnull)
114 {
115 e = new IntegerExp(loc, 0, type);
116 }
117 else
118 goto Lcant;
119 return e;
120
121 Lcant:
122 return EXP_CANT_INTERPRET;
99 } 123 }
100 124
101 override void toCBuffer(OutBuffer buf, HdrGenState* hgs) 125 override void toCBuffer(OutBuffer buf, HdrGenState* hgs)
102 { 126 {
103 assert(false); 127 assert(false);