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 {
|
62
|
29 WhileStatement s = new WhileStatement(loc, condition.syntaxCopy(), body_ ? body_.syntaxCopy() : null);
|
|
30 return s;
|
0
|
31 }
|
|
32
|
|
33 Statement semantic(Scope sc)
|
|
34 {
|
|
35 /* Rewrite as a for(;condition;) loop
|
|
36 */
|
|
37
|
|
38 Statement s = new ForStatement(loc, null, condition, null, body_);
|
|
39 s = s.semantic(sc);
|
|
40 return s;
|
|
41 }
|
|
42
|
|
43 bool hasBreak()
|
|
44 {
|
56
|
45 return true;
|
0
|
46 }
|
|
47
|
|
48 bool hasContinue()
|
|
49 {
|
|
50 assert(false);
|
|
51 }
|
|
52
|
|
53 bool usesEH()
|
|
54 {
|
|
55 assert(false);
|
|
56 }
|
|
57
|
|
58 BE blockExit()
|
|
59 {
|
|
60 assert(false);
|
|
61 }
|
|
62
|
|
63 bool comeFrom()
|
|
64 {
|
|
65 assert(false);
|
|
66 }
|
|
67
|
63
|
68 Expression interpret(InterState istate)
|
0
|
69 {
|
|
70 assert(false);
|
|
71 }
|
|
72
|
|
73 void toCBuffer(OutBuffer buf, HdrGenState* hgs)
|
|
74 {
|
|
75 assert(false);
|
|
76 }
|
|
77
|
|
78 Statement inlineScan(InlineScanState* iss)
|
|
79 {
|
|
80 assert(false);
|
|
81 }
|
|
82
|
|
83 void toIR(IRState* irs)
|
|
84 {
|
|
85 assert(false);
|
|
86 }
|
|
87 } |