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

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

Issue 11267046: [dart2dart] fix after https://codereview.chromium.org/11227007 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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 | lib/compiler/implementation/dart_backend/placeholder_collector.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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 newTypedefElementCallback = (TypedefElement element) { 303 newTypedefElementCallback = (TypedefElement element) {
304 if (!shouldOutput(element)) return; 304 if (!shouldOutput(element)) return;
305 addTopLevel(element, 305 addTopLevel(element,
306 new ElementAst.forClassLike(parse(element))); 306 new ElementAst.forClassLike(parse(element)));
307 }; 307 };
308 newClassElementCallback = (ClassElement classElement) { 308 newClassElementCallback = (ClassElement classElement) {
309 if (!shouldOutput(classElement)) return; 309 if (!shouldOutput(classElement)) return;
310 addClass(classElement); 310 addClass(classElement);
311 }; 311 };
312 312
313 compiler.resolverWorld.instantiatedClasses.forEach(
314 (ClassElement classElement) {
315 if (shouldOutput(classElement)) addClass(classElement);
316 });
313 resolvedElements.forEach((element, treeElements) { 317 resolvedElements.forEach((element, treeElements) {
314 if (!shouldOutput(element)) return; 318 if (!shouldOutput(element)) return;
315 319
316 var elementAst = new ElementAst.rewrite( 320 var elementAst = new ElementAst.rewrite(
317 compiler, parse(element), treeElements, stripAsserts); 321 compiler, parse(element), treeElements, stripAsserts);
318 if (element.isField()) { 322 if (element.isField()) {
319 final list = (element as VariableElement).variables; 323 final list = (element as VariableElement).variables;
320 elementAst = elementAsts.putIfAbsent( 324 elementAst = elementAsts.putIfAbsent(
321 list, () => new VariableListAst(parse(list))); 325 list, () => new VariableListAst(parse(list)));
322 (elementAst as VariableListAst).add(element, treeElements); 326 (elementAst as VariableListAst).add(element, treeElements);
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 } else { 478 } else {
475 super.visit(node); 479 super.visit(node);
476 } 480 }
477 } 481 }
478 482
479 unparseSendReceiver(Send node, {bool spacesNeeded: false}) { 483 unparseSendReceiver(Send node, {bool spacesNeeded: false}) {
480 // TODO(smok): Remove ugly hack for library prefices. 484 // TODO(smok): Remove ugly hack for library prefices.
481 if (node.receiver != null && renames[node.receiver] == '') return; 485 if (node.receiver != null && renames[node.receiver] == '') return;
482 super.unparseSendReceiver(node, spacesNeeded: spacesNeeded); 486 super.unparseSendReceiver(node, spacesNeeded: spacesNeeded);
483 } 487 }
488
489 unparseFunctionName(Node name) {
490 if (name != null && renames.containsKey(name)) {
491 sb.add(renames[name]);
492 } else {
493 super.unparseFunctionName(name);
494 }
495 }
484 } 496 }
485 497
486 498
487 /** 499 /**
488 * Some elements are not recorded by resolver now, 500 * Some elements are not recorded by resolver now,
489 * for example, typedefs or classes which are only 501 * for example, typedefs or classes which are only
490 * used in signatures, as/is operators or in super clauses 502 * used in signatures, as/is operators or in super clauses
491 * (just to name a few). Retraverse AST to pick those up. 503 * (just to name a few). Retraverse AST to pick those up.
492 */ 504 */
493 class ReferencedElementCollector extends Visitor { 505 class ReferencedElementCollector extends Visitor {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 } 555 }
544 556
545 compareElements(e0, e1) { 557 compareElements(e0, e1) {
546 int result = compareBy((e) => e.getLibrary().uri.toString())(e0, e1); 558 int result = compareBy((e) => e.getLibrary().uri.toString())(e0, e1);
547 if (result != 0) return result; 559 if (result != 0) return result;
548 return compareBy((e) => e.position().charOffset)(e0, e1); 560 return compareBy((e) => e.position().charOffset)(e0, e1);
549 } 561 }
550 562
551 List<Element> sortElements(Collection<Element> elements) => 563 List<Element> sortElements(Collection<Element> elements) =>
552 sorted(elements, compareElements); 564 sorted(elements, compareElements);
OLDNEW
« no previous file with comments | « no previous file | lib/compiler/implementation/dart_backend/placeholder_collector.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698