| 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 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 memberNodes[elementAsts[element].ast] = members; | 442 memberNodes[elementAsts[element].ast] = members; |
| 443 } | 443 } |
| 444 } | 444 } |
| 445 | 445 |
| 446 if (useMirrorHelperLibrary) { | 446 if (useMirrorHelperLibrary) { |
| 447 mirrorRenamer.addRenames(renames, topLevelNodes, collector); | 447 mirrorRenamer.addRenames(renames, topLevelNodes, collector); |
| 448 } | 448 } |
| 449 | 449 |
| 450 final unparser = new EmitterUnparser(renames); | 450 final unparser = new EmitterUnparser(renames); |
| 451 emitCode(unparser, imports, topLevelNodes, memberNodes); | 451 emitCode(unparser, imports, topLevelNodes, memberNodes); |
| 452 compiler.assembledCode = unparser.result; | 452 String assembledCode = unparser.result; |
| 453 compiler.outputProvider('', 'dart') |
| 454 ..add(assembledCode) |
| 455 ..close(); |
| 456 compiler.assembledCode = assembledCode; |
| 453 | 457 |
| 454 // Output verbose info about size ratio of resulting bundle to all | 458 // Output verbose info about size ratio of resulting bundle to all |
| 455 // referenced non-platform sources. | 459 // referenced non-platform sources. |
| 456 logResultBundleSizeInfo(topLevelElements); | 460 logResultBundleSizeInfo(topLevelElements); |
| 457 } | 461 } |
| 458 | 462 |
| 459 void logResultBundleSizeInfo(Set<Element> topLevelElements) { | 463 void logResultBundleSizeInfo(Set<Element> topLevelElements) { |
| 460 Iterable<LibraryElement> referencedLibraries = | 464 Iterable<LibraryElement> referencedLibraries = |
| 461 compiler.libraries.values.where(isUserLibrary); | 465 compiler.libraries.values.where(isUserLibrary); |
| 462 // Sum total size of scripts in each referenced library. | 466 // Sum total size of scripts in each referenced library. |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 } | 592 } |
| 589 | 593 |
| 590 compareElements(e0, e1) { | 594 compareElements(e0, e1) { |
| 591 int result = compareBy((e) => e.getLibrary().canonicalUri.toString())(e0, e1); | 595 int result = compareBy((e) => e.getLibrary().canonicalUri.toString())(e0, e1); |
| 592 if (result != 0) return result; | 596 if (result != 0) return result; |
| 593 return compareBy((e) => e.position().charOffset)(e0, e1); | 597 return compareBy((e) => e.position().charOffset)(e0, e1); |
| 594 } | 598 } |
| 595 | 599 |
| 596 List<Element> sortElements(Iterable<Element> elements) => | 600 List<Element> sortElements(Iterable<Element> elements) => |
| 597 sorted(elements, compareElements); | 601 sorted(elements, compareElements); |
| OLD | NEW |