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

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

Issue 22791002: Add renames in output when using the mirror helper library. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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
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 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 topLevelNodes.add(elementAsts[element].ast); 442 topLevelNodes.add(elementAsts[element].ast);
443 if (element.isClass() && !element.isMixinApplication) { 443 if (element.isClass() && !element.isMixinApplication) {
444 final members = <Node>[]; 444 final members = <Node>[];
445 for (final member in sortedClassMembers[element]) { 445 for (final member in sortedClassMembers[element]) {
446 members.add(elementAsts[member].ast); 446 members.add(elementAsts[member].ast);
447 } 447 }
448 memberNodes[elementAsts[element].ast] = members; 448 memberNodes[elementAsts[element].ast] = members;
449 } 449 }
450 } 450 }
451 451
452 Unparser unparser;
452 if (useMirrorHelperLibrary && compiler.mirrorsLibrary != null) { 453 if (useMirrorHelperLibrary && compiler.mirrorsLibrary != null) {
453 MirrorRenamer.addMirrorHelperImport(imports); 454 MirrorRenamer.addMirrorHelperImport(imports);
455 MirrorRenamer.registerRenames(renames);
456 unparser = new MirrorRenamerUnparser(renames);
457 } else {
458 unparser = new EmitterUnparser(renames);
454 } 459 }
455 460
456 final unparser = new EmitterUnparser(renames);
457 emitCode(unparser, imports, topLevelNodes, memberNodes); 461 emitCode(unparser, imports, topLevelNodes, memberNodes);
458 compiler.assembledCode = unparser.result; 462 compiler.assembledCode = unparser.result;
459 463
460 // Output verbose info about size ratio of resulting bundle to all 464 // Output verbose info about size ratio of resulting bundle to all
461 // referenced non-platform sources. 465 // referenced non-platform sources.
462 logResultBundleSizeInfo(topLevelElements); 466 logResultBundleSizeInfo(topLevelElements);
463 } 467 }
464 468
465 void logResultBundleSizeInfo(Set<Element> topLevelElements) { 469 void logResultBundleSizeInfo(Set<Element> topLevelElements) {
466 Iterable<LibraryElement> referencedLibraries = 470 Iterable<LibraryElement> referencedLibraries =
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 } 566 }
563 567
564 compareElements(e0, e1) { 568 compareElements(e0, e1) {
565 int result = compareBy((e) => e.getLibrary().canonicalUri.toString())(e0, e1); 569 int result = compareBy((e) => e.getLibrary().canonicalUri.toString())(e0, e1);
566 if (result != 0) return result; 570 if (result != 0) return result;
567 return compareBy((e) => e.position().charOffset)(e0, e1); 571 return compareBy((e) => e.position().charOffset)(e0, e1);
568 } 572 }
569 573
570 List<Element> sortElements(Iterable<Element> elements) => 574 List<Element> sortElements(Iterable<Element> elements) =>
571 sorted(elements, compareElements); 575 sorted(elements, compareElements);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698