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