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

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

Issue 22849007: Enable unique global renaming in dart2dart minification. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments. 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
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/dart_backend/renamer.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 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 classMembers[element].forEach(makePlaceholders); 402 classMembers[element].forEach(makePlaceholders);
403 } 403 }
404 } 404 }
405 topLevelElements.forEach(makePlaceholders); 405 topLevelElements.forEach(makePlaceholders);
406 // Create renames. 406 // Create renames.
407 bool shouldCutDeclarationTypes = forceStripTypes 407 bool shouldCutDeclarationTypes = forceStripTypes
408 || (compiler.enableMinification 408 || (compiler.enableMinification
409 && isSafeToRemoveTypeDeclarations(classMembers)); 409 && isSafeToRemoveTypeDeclarations(classMembers));
410 renamePlaceholders( 410 renamePlaceholders(
411 compiler, collector, renames, imports, 411 compiler, collector, renames, imports,
412 fixedMemberNames, shouldCutDeclarationTypes); 412 fixedMemberNames, shouldCutDeclarationTypes,
413 uniqueGlobalNaming: useMirrorHelperLibrary);
413 414
414 // Sort elements. 415 // Sort elements.
415 final sortedTopLevels = sortElements(topLevelElements); 416 final sortedTopLevels = sortElements(topLevelElements);
416 final sortedClassMembers = new Map<ClassElement, List<Element>>(); 417 final sortedClassMembers = new Map<ClassElement, List<Element>>();
417 classMembers.forEach((classElement, members) { 418 classMembers.forEach((classElement, members) {
418 sortedClassMembers[classElement] = sortElements(members); 419 sortedClassMembers[classElement] = sortElements(members);
419 }); 420 });
420 421
421 if (outputAst) { 422 if (outputAst) {
422 // TODO(antonm): Ideally XML should be a separate backend. 423 // TODO(antonm): Ideally XML should be a separate backend.
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 } 563 }
563 564
564 compareElements(e0, e1) { 565 compareElements(e0, e1) {
565 int result = compareBy((e) => e.getLibrary().canonicalUri.toString())(e0, e1); 566 int result = compareBy((e) => e.getLibrary().canonicalUri.toString())(e0, e1);
566 if (result != 0) return result; 567 if (result != 0) return result;
567 return compareBy((e) => e.position().charOffset)(e0, e1); 568 return compareBy((e) => e.position().charOffset)(e0, e1);
568 } 569 }
569 570
570 List<Element> sortElements(Iterable<Element> elements) => 571 List<Element> sortElements(Iterable<Element> elements) =>
571 sorted(elements, compareElements); 572 sorted(elements, compareElements);
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/dart_backend/renamer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698