Mercurial > projects > dang
comparison ast/Decl.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 | a14ac9e5c858 |
children | 362265427838 |
comparison
equal
deleted
inserted
replaced
147:060b6eb16db9 | 150:6c5a3c0bb4fb |
---|---|
8 import tango.io.Stdout; | 8 import tango.io.Stdout; |
9 | 9 |
10 import sema.Scope, | 10 import sema.Scope, |
11 sema.Symbol, | 11 sema.Symbol, |
12 sema.DType, | 12 sema.DType, |
13 sema.VC, | |
13 basic.SmallArray, | 14 basic.SmallArray, |
14 basic.Attribute; | 15 basic.Attribute; |
15 | 16 |
16 enum DeclType | 17 enum DeclType |
17 { | 18 { |
30 { | 31 { |
31 this.declType = declType; | 32 this.declType = declType; |
32 } | 33 } |
33 | 34 |
34 void simplify() | 35 void simplify() |
36 { | |
37 } | |
38 | |
39 void verify(VC vc) | |
35 { | 40 { |
36 } | 41 } |
37 | 42 |
38 DType type() | 43 DType type() |
39 { | 44 { |
76 { | 81 { |
77 super(DeclType.VarDecl); | 82 super(DeclType.VarDecl); |
78 this.varType = type; | 83 this.varType = type; |
79 this.identifier = identifier; | 84 this.identifier = identifier; |
80 this.init = e; | 85 this.init = e; |
81 } | |
82 | |
83 void simplify() | |
84 { | |
85 } | 86 } |
86 | 87 |
87 override DType type() | 88 override DType type() |
88 { | 89 { |
89 return env.findType(varType.get); | 90 return env.findType(varType.get); |
169 funcArg.simplify(); | 170 funcArg.simplify(); |
170 foreach (stmt; statements) | 171 foreach (stmt; statements) |
171 stmt.simplify(); | 172 stmt.simplify(); |
172 } | 173 } |
173 | 174 |
175 override void verify(VC vc) | |
176 { | |
177 foreach (stmt; statements) | |
178 stmt.verify(vc); | |
179 } | |
180 | |
174 override DFunction type() | 181 override DFunction type() |
175 { | 182 { |
176 if (myType !is null) | 183 if (myType !is null) |
177 return myType; | 184 return myType; |
178 | 185 |
210 | 217 |
211 void simplify() | 218 void simplify() |
212 { | 219 { |
213 } | 220 } |
214 | 221 |
222 override void verify(VC vc) | |
223 { | |
224 foreach (decl; decls) | |
225 decl.verify(vc); | |
226 } | |
227 | |
215 override DType type() | 228 override DType type() |
216 { | 229 { |
217 return env.findType(identifier.get); | 230 return env.findType(identifier.get); |
218 } | 231 } |
219 | 232 |