Mercurial > projects > dang
comparison sema/AstAction.d @ 150:6c5a3c0bb4fb
Make switch work again
Also added locations to statements (only filled out for switch)
Added a verification pass
Removed some comments
author | Anders Halager <halager@gmail.com> |
---|---|
date | Mon, 21 Jul 2008 20:35:03 +0200 |
parents | 6e6355fb5f0f |
children | ee202c72cd30 |
comparison
equal
deleted
inserted
replaced
147:060b6eb16db9 | 150:6c5a3c0bb4fb |
---|---|
200 { | 200 { |
201 Decl d = cast(Decl)decl; | 201 Decl d = cast(Decl)decl; |
202 return new DeclStmt(d); | 202 return new DeclStmt(d); |
203 } | 203 } |
204 | 204 |
205 StmtT actOnStartOfSwitchStmt(ExprT exp) | 205 StmtT actOnStartOfSwitchStmt(Token _switch, ExprT exp) |
206 { | 206 { |
207 return new SwitchStmt(cast(Exp)exp); | 207 return new SwitchStmt(_switch.location, cast(Exp)exp); |
208 } | 208 } |
209 | 209 |
210 void actOnCaseStmt(StmtT stmt, ExprT[] exps, StmtT[] stmts) | 210 void actOnCaseStmt(StmtT stmt, Token _case, ExprT[] exps, StmtT[] stmts) |
211 { | 211 { |
212 auto sw = cast(SwitchStmt)stmt; | 212 auto sw = cast(SwitchStmt)stmt; |
213 sw.addCase(cast(Exp[])exps, cast(Stmt[])stmts); | 213 sw.addCase(_case.location, cast(Exp[])exps, cast(Stmt[])stmts); |
214 } | 214 } |
215 | 215 |
216 void actOnDefaultStmt(StmtT stmt, StmtT[] stmts) | 216 void actOnDefaultStmt(StmtT stmt, Token _default, StmtT[] stmts) |
217 { | 217 { |
218 auto sw = cast(SwitchStmt)stmt; | 218 auto sw = cast(SwitchStmt)stmt; |
219 sw.setDefault(cast(Stmt[])stmts); | 219 sw.setDefault(_default.location, cast(Stmt[])stmts); |
220 } | 220 } |
221 | 221 |
222 // -- Expressions -- | 222 // -- Expressions -- |
223 ExprT actOnNumericConstant(Token c) | 223 ExprT actOnNumericConstant(Token c) |
224 { | 224 { |