Mercurial > projects > ddmd
comparison dmd/DoStatement.d @ 155:a43c65469219
+ Statement.interpret()
+ ContinueStatement.interpret()
+ DoStatement.interpret()
author | trass3r |
---|---|
date | Wed, 15 Sep 2010 17:31:22 +0200 |
parents | e28b18c23469 |
children | af724d3510d7 |
comparison
equal
deleted
inserted
replaced
154:14feb7ae01a6 | 155:a43c65469219 |
---|---|
4 import dmd.Statement; | 4 import dmd.Statement; |
5 import dmd.Expression; | 5 import dmd.Expression; |
6 import dmd.Loc; | 6 import dmd.Loc; |
7 import dmd.Scope; | 7 import dmd.Scope; |
8 import dmd.InterState; | 8 import dmd.InterState; |
9 import dmd.GlobalExpressions; | |
9 import dmd.HdrGenState; | 10 import dmd.HdrGenState; |
10 import dmd.OutBuffer; | 11 import dmd.OutBuffer; |
11 import dmd.InlineScanState; | 12 import dmd.InlineScanState; |
12 import dmd.IRState; | 13 import dmd.IRState; |
13 import dmd.BE; | 14 import dmd.BE; |
98 assert(false); | 99 assert(false); |
99 } | 100 } |
100 | 101 |
101 override Expression interpret(InterState istate) | 102 override Expression interpret(InterState istate) |
102 { | 103 { |
103 assert(false); | 104 version(LOG) |
105 writef("DoStatement::interpret()\n"); | |
106 | |
107 if (istate.start == this) | |
108 istate.start = null; | |
109 Expression e; | |
110 | |
111 if (istate.start) | |
112 { | |
113 e = body_ ? body_.interpret(istate) : null; | |
114 if (istate.start) | |
115 return null; | |
116 if (e is EXP_CANT_INTERPRET) | |
117 return e; | |
118 if (e is EXP_BREAK_INTERPRET) | |
119 return null; | |
120 if (e is EXP_CONTINUE_INTERPRET) | |
121 goto Lcontinue; | |
122 if (e) | |
123 return e; | |
124 } | |
125 | |
126 while (1) | |
127 { | |
128 e = body_ ? body_.interpret(istate) : null; | |
129 if (e is EXP_CANT_INTERPRET) | |
130 break; | |
131 if (e is EXP_BREAK_INTERPRET) | |
132 { | |
133 e = null; | |
134 break; | |
135 } | |
136 if (e && e !is EXP_CONTINUE_INTERPRET) | |
137 break; | |
138 | |
139 Lcontinue: | |
140 e = condition.interpret(istate); | |
141 if (e is EXP_CANT_INTERPRET) | |
142 break; | |
143 if (!e.isConst()) | |
144 { | |
145 e = EXP_CANT_INTERPRET; | |
146 break; | |
147 } | |
148 if (e.isBool(true)) | |
149 { | |
150 } | |
151 else if (e.isBool(false)) | |
152 { | |
153 e = null; | |
154 break; | |
155 } | |
156 else | |
157 assert(0); | |
158 } | |
159 return e; | |
104 } | 160 } |
105 | 161 |
106 override void toCBuffer(OutBuffer buf, HdrGenState* hgs) | 162 override void toCBuffer(OutBuffer buf, HdrGenState* hgs) |
107 { | 163 { |
108 assert(false); | 164 assert(false); |