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 part of dart_backend; | 5 part of dart_backend; |
6 | 6 |
7 // TODO(ahe): This class is simply wrong. This backend should use | 7 // TODO(ahe): This class is simply wrong. This backend should use |
8 // elements when it can, not AST nodes. Perhaps a [Map<Element, | 8 // elements when it can, not AST nodes. Perhaps a [Map<Element, |
9 // TreeElements>] is what is needed. | 9 // TreeElements>] is what is needed. |
10 class ElementAst { | 10 class ElementAst { |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 if (!compiler.irBuilder.hasIr(element)) { | 230 if (!compiler.irBuilder.hasIr(element)) { |
231 return new ElementAst(element); | 231 return new ElementAst(element); |
232 } else { | 232 } else { |
233 ir.FunctionDefinition function = compiler.irBuilder.getIr(element); | 233 ir.FunctionDefinition function = compiler.irBuilder.getIr(element); |
234 tree.Builder builder = new tree.Builder(compiler); | 234 tree.Builder builder = new tree.Builder(compiler); |
235 tree.FunctionDefinition definition = builder.build(function); | 235 tree.FunctionDefinition definition = builder.build(function); |
236 assert(definition != null); | 236 assert(definition != null); |
237 compiler.tracer.traceCompilation(element.name, null, compiler); | 237 compiler.tracer.traceCompilation(element.name, null, compiler); |
238 compiler.tracer.traceGraph('Tree builder', definition); | 238 compiler.tracer.traceGraph('Tree builder', definition); |
239 TreeElementMapping treeElements = new TreeElementMapping(element); | 239 TreeElementMapping treeElements = new TreeElementMapping(element); |
| 240 new tree.CopyPropagateClosureVariables().rewrite(definition); |
| 241 compiler.tracer.traceGraph('Copy propagate closure vars', definition); |
240 new tree.StatementRewriter().rewrite(definition); | 242 new tree.StatementRewriter().rewrite(definition); |
241 compiler.tracer.traceGraph('Statement rewriter', definition); | 243 compiler.tracer.traceGraph('Statement rewriter', definition); |
242 new tree.LoopRewriter().rewrite(definition); | 244 new tree.LoopRewriter().rewrite(definition); |
243 compiler.tracer.traceGraph('Loop rewriter', definition); | 245 compiler.tracer.traceGraph('Loop rewriter', definition); |
244 new tree.LogicalRewriter().rewrite(definition); | 246 new tree.LogicalRewriter().rewrite(definition); |
245 compiler.tracer.traceGraph('Logical rewriter', definition); | 247 compiler.tracer.traceGraph('Logical rewriter', definition); |
| 248 new dart_codegen.UnshadowParameters().unshadow(definition); |
| 249 compiler.tracer.traceGraph('Unshadow parameters', definition); |
246 Node node = dart_codegen.emit(element, treeElements, definition); | 250 Node node = dart_codegen.emit(element, treeElements, definition); |
247 return new ElementAst.internal(node, treeElements); | 251 return new ElementAst.internal(node, treeElements); |
248 } | 252 } |
249 } | 253 } |
250 | 254 |
251 Set<Element> topLevelElements = new Set<Element>(); | 255 Set<Element> topLevelElements = new Set<Element>(); |
252 Map<ClassElement, Set<Element>> classMembers = | 256 Map<ClassElement, Set<Element>> classMembers = |
253 new Map<ClassElement, Set<Element>>(); | 257 new Map<ClassElement, Set<Element>>(); |
254 | 258 |
255 // Build all top level elements to emit and necessary class members. | 259 // Build all top level elements to emit and necessary class members. |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 } | 663 } |
660 | 664 |
661 Constant compileMetadata(MetadataAnnotation metadata, | 665 Constant compileMetadata(MetadataAnnotation metadata, |
662 Node node, | 666 Node node, |
663 TreeElements elements) { | 667 TreeElements elements) { |
664 return measure(() { | 668 return measure(() { |
665 return constantCompiler.compileMetadata(metadata, node, elements); | 669 return constantCompiler.compileMetadata(metadata, node, elements); |
666 }); | 670 }); |
667 } | 671 } |
668 } | 672 } |
OLD | NEW |