comparison dmd/BoolExp.d @ 0:10317f0c89a5

Initial commit
author korDen
date Sat, 24 Oct 2009 08:42:06 +0400
parents
children 3012e829306f
comparison
equal deleted inserted replaced
-1:000000000000 0:10317f0c89a5
1 module dmd.BoolExp;
2
3 import dmd.Expression;
4 import dmd.backend.elem;
5 import dmd.UnaExp;
6 import dmd.InterState;
7 import dmd.Type;
8 import dmd.Loc;
9 import dmd.Scope;
10 import dmd.IRState;
11 import dmd.TOK;
12
13 import dmd.backend.OPER;
14 import dmd.backend.Util;
15
16 class BoolExp : UnaExp
17 {
18 this(Loc loc, Expression e, Type t)
19 {
20 super(loc, TOK.init, 0, e);
21 type = t;
22 }
23
24 Expression semantic(Scope sc)
25 {
26 UnaExp.semantic(sc);
27 e1 = resolveProperties(sc, e1);
28 e1 = e1.checkToBoolean();
29 type = Type.tboolean;
30 return this;
31 }
32
33 Expression optimize(int result)
34 {
35 assert(false);
36 }
37
38 Expression interpret(InterState* istate)
39 {
40 assert(false);
41 }
42
43 int isBit()
44 {
45 return true;
46 }
47
48 elem* toElem(IRState* irs)
49 {
50 elem* e1 = this.e1.toElem(irs);
51 return el_una(OPbool,type.totym(),e1);
52 }
53 }
54