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