Mercurial > projects > ddmd
comparison dmd/HaltExp.d @ 0:10317f0c89a5
Initial commit
author | korDen |
---|---|
date | Sat, 24 Oct 2009 08:42:06 +0400 |
parents | |
children | 2e2a5c3f943a |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:10317f0c89a5 |
---|---|
1 module dmd.HaltExp; | |
2 | |
3 import dmd.Expression; | |
4 import dmd.backend.elem; | |
5 import dmd.OutBuffer; | |
6 import dmd.Loc; | |
7 import dmd.Scope; | |
8 import dmd.IRState; | |
9 import dmd.Type; | |
10 import dmd.HdrGenState; | |
11 import dmd.Loc; | |
12 import dmd.TOK; | |
13 | |
14 import dmd.backend.Util; | |
15 import dmd.backend.OPER; | |
16 import dmd.backend.TYM; | |
17 | |
18 class HaltExp : Expression | |
19 { | |
20 this(Loc loc) | |
21 { | |
22 super(loc, TOK.TOKhalt, HaltExp.sizeof); | |
23 } | |
24 | |
25 Expression semantic(Scope sc) | |
26 { | |
27 version (LOGSEMANTIC) { | |
28 printf("HaltExp.semantic()\n"); | |
29 } | |
30 type = Type.tvoid; | |
31 return this; | |
32 } | |
33 | |
34 void toCBuffer(OutBuffer buf, HdrGenState* hgs) | |
35 { | |
36 buf.writestring("halt"); | |
37 } | |
38 | |
39 bool checkSideEffect(int flag) | |
40 { | |
41 return true; | |
42 } | |
43 | |
44 elem* toElem(IRState* irs) | |
45 { | |
46 elem *e; | |
47 | |
48 e = el_calloc(); | |
49 e.Ety = TYvoid; | |
50 e.Eoper = OPhalt; | |
51 el_setLoc(e,loc); | |
52 return e; | |
53 } | |
54 } | |
55 |