Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(419)

Side by Side Diff: sdk/lib/_internal/compiler/implementation/dart_backend/backend.dart

Issue 231863007: Support local variables in dart2dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Incorporated review comments. Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/dart_backend/dart_tree.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 final elementAsts = new Map<Element, ElementAst>(); 229 final elementAsts = new Map<Element, ElementAst>();
230 230
231 ElementAst parse(Element element, TreeElements treeElements) { 231 ElementAst parse(Element element, TreeElements treeElements) {
232 Node node; 232 Node node;
233 if (!compiler.irBuilder.hasIr(element)) { 233 if (!compiler.irBuilder.hasIr(element)) {
234 node = element.parseNode(compiler); 234 node = element.parseNode(compiler);
235 } else { 235 } else {
236 ir.FunctionDefinition function = compiler.irBuilder.getIr(element); 236 ir.FunctionDefinition function = compiler.irBuilder.getIr(element);
237 tree.Builder builder = new tree.Builder(compiler); 237 tree.Builder builder = new tree.Builder(compiler);
238 tree.FunctionDefinition definition = builder.build(function); 238 tree.FunctionDefinition definition = builder.build(function);
239 compiler.tracer.traceCompilation(element.name, null, compiler); 239 if (definition == null) {
240 compiler.tracer.traceGraph('Tree builder', definition); 240 node = element.parseNode(compiler);
241 treeElements = new TreeElementMapping(element); 241 } else {
242 tree.Unnamer unnamer = new tree.Unnamer(); 242 compiler.tracer.traceCompilation(element.name, null, compiler);
243 unnamer.unname(definition); 243 compiler.tracer.traceGraph('Tree builder', definition);
244 compiler.tracer.traceGraph('Unnamer', definition); 244 treeElements = new TreeElementMapping(element);
245 tree.Emitter emitter = new tree.Emitter(); 245 tree.Unnamer unnamer = new tree.Unnamer();
246 node = emitter.emit(element, treeElements, definition); 246 unnamer.unname(definition);
247 compiler.tracer.traceGraph('Unnamer', definition);
248 tree.Emitter emitter = new tree.Emitter();
249 node = emitter.emit(element, treeElements, definition);
250 }
247 } 251 }
248 return new ElementAst(node, treeElements); 252 return new ElementAst(node, treeElements);
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.
256 var newTypedefElementCallback, newClassElementCallback; 260 var newTypedefElementCallback, newClassElementCallback;
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 } 643 }
640 644
641 Constant compileMetadata(MetadataAnnotation metadata, 645 Constant compileMetadata(MetadataAnnotation metadata,
642 Node node, 646 Node node,
643 TreeElements elements) { 647 TreeElements elements) {
644 return measure(() { 648 return measure(() {
645 return constantCompiler.compileMetadata(metadata, node, elements); 649 return constantCompiler.compileMetadata(metadata, node, elements);
646 }); 650 });
647 } 651 }
648 } 652 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/dart_backend/dart_tree.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698