| 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 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Loading... |
| 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); |
| OLD | NEW |