0
|
1 module dmd.GotoDefaultStatement;
|
|
2
|
|
3 import dmd.Statement;
|
|
4 import dmd.SwitchStatement;
|
|
5 import dmd.Loc;
|
|
6 import dmd.Scope;
|
|
7 import dmd.Expression;
|
|
8 import dmd.InterState;
|
|
9 import dmd.OutBuffer;
|
|
10 import dmd.HdrGenState;
|
|
11 import dmd.IRState;
|
|
12 import dmd.BE;
|
|
13
|
|
14 class GotoDefaultStatement : Statement
|
|
15 {
|
|
16 SwitchStatement sw;
|
|
17
|
|
18 this(Loc loc)
|
|
19 {
|
|
20 super(loc);
|
51
|
21 sw = null;
|
0
|
22 }
|
|
23
|
|
24 Statement syntaxCopy()
|
|
25 {
|
64
|
26 GotoDefaultStatement s = new GotoDefaultStatement(loc);
|
|
27 return s;
|
0
|
28 }
|
|
29
|
|
30 Statement semantic(Scope sc)
|
|
31 {
|
64
|
32 sw = sc.sw;
|
|
33 if (!sw)
|
|
34 error("goto default not in switch statement");
|
|
35 return this;
|
0
|
36 }
|
|
37
|
63
|
38 Expression interpret(InterState istate)
|
0
|
39 {
|
|
40 assert(false);
|
|
41 }
|
|
42
|
|
43 BE blockExit()
|
|
44 {
|
64
|
45 return BEgoto;
|
0
|
46 }
|
|
47
|
|
48 void toCBuffer(OutBuffer buf, HdrGenState* hgs)
|
|
49 {
|
64
|
50 buf.writestring("goto default;\n");
|
0
|
51 }
|
|
52
|
|
53 void toIR(IRState *irs)
|
|
54 {
|
|
55 assert(false);
|
|
56 }
|
|
57 } |