72
|
1 module dmd.HaltExp;
|
|
2
|
114
|
3 import dmd.common;
|
72
|
4 import dmd.Expression;
|
|
5 import dmd.backend.elem;
|
|
6 import dmd.OutBuffer;
|
|
7 import dmd.Loc;
|
|
8 import dmd.Scope;
|
0
|
9 import dmd.IRState;
|
72
|
10 import dmd.Type;
|
|
11 import dmd.HdrGenState;
|
|
12 import dmd.Loc;
|
0
|
13 import dmd.TOK;
|
|
14
|
|
15 import dmd.backend.Util;
|
|
16 import dmd.backend.OPER;
|
72
|
17 import dmd.backend.TYM;
|
|
18
|
0
|
19 class HaltExp : Expression
|
|
20 {
|
|
21 this(Loc loc)
|
|
22 {
|
178
|
23 register();
|
0
|
24 super(loc, TOK.TOKhalt, HaltExp.sizeof);
|
|
25 }
|
|
26
|
72
|
27 override Expression semantic(Scope sc)
|
0
|
28 {
|
|
29 version (LOGSEMANTIC) {
|
|
30 printf("HaltExp.semantic()\n");
|
|
31 }
|
|
32 type = Type.tvoid;
|
|
33 return this;
|
|
34 }
|
|
35
|
72
|
36 override void toCBuffer(OutBuffer buf, HdrGenState* hgs)
|
0
|
37 {
|
|
38 buf.writestring("halt");
|
|
39 }
|
|
40
|
72
|
41 override bool checkSideEffect(int flag)
|
0
|
42 {
|
|
43 return true;
|
|
44 }
|
|
45
|
72
|
46 override elem* toElem(IRState* irs)
|
0
|
47 {
|
|
48 elem *e;
|
|
49
|
|
50 e = el_calloc();
|
|
51 e.Ety = TYvoid;
|
|
52 e.Eoper = OPhalt;
|
|
53 el_setLoc(e,loc);
|
|
54 return e;
|
|
55 }
|
|
56 }
|
|
57
|