72
|
1 module dmd.BoolExp;
|
|
2
|
114
|
3 import dmd.common;
|
72
|
4 import dmd.Expression;
|
|
5 import dmd.backend.elem;
|
|
6 import dmd.UnaExp;
|
|
7 import dmd.InterState;
|
|
8 import dmd.Type;
|
|
9 import dmd.Loc;
|
|
10 import dmd.Scope;
|
0
|
11 import dmd.IRState;
|
72
|
12 import dmd.TOK;
|
0
|
13
|
|
14 import dmd.backend.OPER;
|
|
15 import dmd.backend.Util;
|
72
|
16
|
0
|
17 class BoolExp : UnaExp
|
|
18 {
|
|
19 this(Loc loc, Expression e, Type t)
|
|
20 {
|
36
|
21 super(loc, TOKtobool, BoolExp.sizeof, e);
|
0
|
22 type = t;
|
|
23 }
|
|
24
|
72
|
25 override Expression semantic(Scope sc)
|
0
|
26 {
|
|
27 UnaExp.semantic(sc);
|
|
28 e1 = resolveProperties(sc, e1);
|
|
29 e1 = e1.checkToBoolean();
|
|
30 type = Type.tboolean;
|
|
31 return this;
|
|
32 }
|
|
33
|
72
|
34 override Expression optimize(int result)
|
0
|
35 {
|
|
36 assert(false);
|
|
37 }
|
|
38
|
72
|
39 override Expression interpret(InterState istate)
|
0
|
40 {
|
|
41 assert(false);
|
|
42 }
|
|
43
|
72
|
44 override int isBit()
|
0
|
45 {
|
|
46 return true;
|
|
47 }
|
|
48
|
72
|
49 override elem* toElem(IRState* irs)
|
0
|
50 {
|
|
51 elem* e1 = this.e1.toElem(irs);
|
|
52 return el_una(OPbool,type.totym(),e1);
|
|
53 }
|
|
54 }
|
|
55
|