OLD | NEW |
---|---|
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 class WorkItem { | 5 class WorkItem { |
6 final Element element; | 6 final Element element; |
7 TreeElements resolutionTree; | 7 TreeElements resolutionTree; |
8 Function run; | 8 Function run; |
9 Map<int, BailoutInfo> bailouts = null; | 9 Map<int, BailoutInfo> bailouts = null; |
10 | 10 |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
205 return elements; | 205 return elements; |
206 } | 206 } |
207 | 207 |
208 TreeElements analyze(WorkItem work) { | 208 TreeElements analyze(WorkItem work) { |
209 work.resolutionTree = analyzeElement(work.element); | 209 work.resolutionTree = analyzeElement(work.element); |
210 return work.resolutionTree; | 210 return work.resolutionTree; |
211 } | 211 } |
212 | 212 |
213 String codegen(WorkItem work) { | 213 String codegen(WorkItem work) { |
214 String code; | 214 String code; |
215 if (work.element.kind == ElementKind.FIELD) { | 215 if (work.element.kind == ElementKind.FIELD |
216 || work.element.kind == ElementKind.PARAMETER) { | |
216 compileTimeConstantHandler.compileWorkItem(work); | 217 compileTimeConstantHandler.compileWorkItem(work); |
217 return null; | 218 return null; |
218 } else { | 219 } else { |
219 HGraph graph = builder.build(work); | 220 HGraph graph = builder.build(work); |
220 optimizer.optimize(work, graph); | 221 optimizer.optimize(work, graph); |
221 code = generator.generate(work, graph); | 222 code = generator.generate(work, graph); |
222 universe.addGeneratedCode(work, code); | 223 universe.addGeneratedCode(work, code); |
223 return code; | 224 return code; |
224 } | 225 } |
225 } | 226 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
264 } | 265 } |
265 | 266 |
266 Type resolveType(ClassElement element) { | 267 Type resolveType(ClassElement element) { |
267 return resolver.resolveType(element); | 268 return resolver.resolveType(element); |
268 } | 269 } |
269 | 270 |
270 FunctionParameters resolveSignature(FunctionElement element) { | 271 FunctionParameters resolveSignature(FunctionElement element) { |
271 return resolver.resolveSignature(element); | 272 return resolver.resolveSignature(element); |
272 } | 273 } |
273 | 274 |
275 Object compileVariable(VariableElement element) { | |
276 Element savedElement = currentElement; | |
floitsch
2012/02/01 14:35:39
why is this necessary?
ngeoffray
2012/02/01 15:54:59
To get proper error messages if the work item gene
| |
277 currentElement = element; | |
278 compile(new WorkItem.toCompile(element)); | |
279 currentElement = savedElement; | |
280 return compileTimeConstantHandler.compileVariable(element); | |
281 } | |
282 | |
274 reportWarning(Node node, var message) {} | 283 reportWarning(Node node, var message) {} |
275 reportError(Node node, var message) {} | 284 reportError(Node node, var message) {} |
276 | 285 |
277 Script readScript(String filename) { | 286 Script readScript(String filename) { |
278 unimplemented('Compiler.readScript'); | 287 unimplemented('Compiler.readScript'); |
279 } | 288 } |
280 | 289 |
281 String get legDirectory() { | 290 String get legDirectory() { |
282 unimplemented('Compiler.legDirectory'); | 291 unimplemented('Compiler.legDirectory'); |
283 } | 292 } |
(...skipping 24 matching lines...) Expand all Loading... | |
308 | 317 |
309 class CompilerCancelledException implements Exception { | 318 class CompilerCancelledException implements Exception { |
310 final String reason; | 319 final String reason; |
311 CompilerCancelledException(this.reason); | 320 CompilerCancelledException(this.reason); |
312 | 321 |
313 String toString() { | 322 String toString() { |
314 String banner = 'compiler cancelled'; | 323 String banner = 'compiler cancelled'; |
315 return (reason !== null) ? '$banner: $reason' : '$banner'; | 324 return (reason !== null) ? '$banner: $reason' : '$banner'; |
316 } | 325 } |
317 } | 326 } |
OLD | NEW |