0
|
1 module dmd.WhileStatement;
|
|
2
|
|
3 import dmd.Statement;
|
|
4 import dmd.Expression;
|
|
5 import dmd.Scope;
|
|
6 import dmd.InterState;
|
|
7 import dmd.HdrGenState;
|
|
8 import dmd.OutBuffer;
|
|
9 import dmd.InlineScanState;
|
|
10 import dmd.IRState;
|
|
11 import dmd.Loc;
|
|
12 import dmd.BE;
|
|
13 import dmd.ForStatement;
|
|
14
|
|
15 class WhileStatement : Statement
|
|
16 {
|
|
17 Expression condition;
|
|
18 Statement body_;
|
|
19
|
|
20 this(Loc loc, Expression c, Statement b)
|
|
21 {
|
|
22 super(loc);
|
|
23 condition = c;
|
|
24 body_ = b;
|
|
25 }
|
|
26
|
|
27 Statement syntaxCopy()
|
|
28 {
|
|
29 assert(false);
|
|
30 }
|
|
31
|
|
32 Statement semantic(Scope sc)
|
|
33 {
|
|
34 /* Rewrite as a for(;condition;) loop
|
|
35 */
|
|
36
|
|
37 Statement s = new ForStatement(loc, null, condition, null, body_);
|
|
38 s = s.semantic(sc);
|
|
39 return s;
|
|
40 }
|
|
41
|
|
42 bool hasBreak()
|
|
43 {
|
56
|
44 return true;
|
0
|
45 }
|
|
46
|
|
47 bool hasContinue()
|
|
48 {
|
|
49 assert(false);
|
|
50 }
|
|
51
|
|
52 bool usesEH()
|
|
53 {
|
|
54 assert(false);
|
|
55 }
|
|
56
|
|
57 BE blockExit()
|
|
58 {
|
|
59 assert(false);
|
|
60 }
|
|
61
|
|
62 bool comeFrom()
|
|
63 {
|
|
64 assert(false);
|
|
65 }
|
|
66
|
|
67 Expression interpret(InterState* istate)
|
|
68 {
|
|
69 assert(false);
|
|
70 }
|
|
71
|
|
72 void toCBuffer(OutBuffer buf, HdrGenState* hgs)
|
|
73 {
|
|
74 assert(false);
|
|
75 }
|
|
76
|
|
77 Statement inlineScan(InlineScanState* iss)
|
|
78 {
|
|
79 assert(false);
|
|
80 }
|
|
81
|
|
82 void toIR(IRState* irs)
|
|
83 {
|
|
84 assert(false);
|
|
85 }
|
|
86 } |