72
|
1 module dmd.NotExp;
|
|
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.Loc;
|
|
9 import dmd.Scope;
|
|
10 import dmd.IRState;
|
0
|
11 import dmd.TOK;
|
|
12 import dmd.Type;
|
|
13
|
|
14 import dmd.expression.Not;
|
|
15
|
|
16 import dmd.backend.OPER;
|
72
|
17 import dmd.backend.Util;
|
|
18
|
0
|
19 class NotExp : UnaExp
|
|
20 {
|
|
21 this(Loc loc, Expression e)
|
|
22 {
|
|
23 super(loc, TOK.TOKnot, NotExp.sizeof, e);
|
|
24 }
|
|
25
|
72
|
26 override Expression semantic(Scope sc)
|
0
|
27 {
|
|
28 UnaExp.semantic(sc);
|
|
29 e1 = resolveProperties(sc, e1);
|
|
30 e1 = e1.checkToBoolean();
|
|
31 type = Type.tboolean;
|
|
32 return this;
|
|
33 }
|
|
34
|
72
|
35 override Expression optimize(int result)
|
0
|
36 {
|
|
37 Expression e;
|
|
38
|
|
39 e1 = e1.optimize(result);
|
|
40 if (e1.isConst() == 1)
|
|
41 e = Not(type, e1);
|
|
42 else
|
|
43 e = this;
|
|
44
|
|
45 return e;
|
|
46 }
|
|
47
|
72
|
48 override Expression interpret(InterState istate)
|
0
|
49 {
|
|
50 assert(false);
|
|
51 }
|
|
52
|
72
|
53 override int isBit()
|
0
|
54 {
|
|
55 assert(false);
|
|
56 }
|
|
57
|
72
|
58 override elem* toElem(IRState* irs)
|
0
|
59 {
|
|
60 elem* e = el_una(OPnot, type.totym(), e1.toElem(irs));
|
|
61 el_setLoc(e,loc);
|
|
62 return e;
|
|
63 }
|
72
|
64 }
|