| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 /// Transfomer that combines multiple dart script tags into a single one. | 5 /// Transfomer that combines multiple dart script tags into a single one. |
| 6 library polymer.src.build.script_compactor; | 6 library polymer.src.build.script_compactor; |
| 7 | 7 |
| 8 import 'dart:async'; | 8 import 'dart:async'; |
| 9 import 'dart:convert'; | 9 import 'dart:convert'; |
| 10 | 10 |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 Future _emitNewEntrypoint(_) { | 142 Future _emitNewEntrypoint(_) { |
| 143 if (entryLibraries.isEmpty) { | 143 if (entryLibraries.isEmpty) { |
| 144 // We didn't find code, nothing to do. | 144 // We didn't find code, nothing to do. |
| 145 transform.addOutput(transform.primaryInput); | 145 transform.addOutput(transform.primaryInput); |
| 146 return null; | 146 return null; |
| 147 } | 147 } |
| 148 | 148 |
| 149 return _initResolver() | 149 return _initResolver() |
| 150 .then(_extractUsesOfMirrors) | 150 .then(_extractUsesOfMirrors) |
| 151 .then(_emitFiles) | 151 .then(_emitFiles) |
| 152 .whenComplete(() => resolver.release()); | 152 .whenComplete(() { |
| 153 if (resolver != null) resolver.release(); |
| 154 }); |
| 153 } | 155 } |
| 154 | 156 |
| 155 /// Load a resolver that computes information for every library in | 157 /// Load a resolver that computes information for every library in |
| 156 /// [entryLibraries], then use it to initialize the [recorder] (for import | 158 /// [entryLibraries], then use it to initialize the [recorder] (for import |
| 157 /// resolution) and to resolve specific elements (for analyzing the user's | 159 /// resolution) and to resolve specific elements (for analyzing the user's |
| 158 /// code). | 160 /// code). |
| 159 Future _initResolver() => resolvers.get(transform, entryLibraries).then((r) { | 161 Future _initResolver() => resolvers.get(transform, entryLibraries).then((r) { |
| 160 resolver = r; | 162 resolver = r; |
| 161 types = new _ResolvedTypes(resolver); | 163 types = new _ResolvedTypes(resolver); |
| 162 }); | 164 }); |
| (...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 688 for (var c in combinators) { | 690 for (var c in combinators) { |
| 689 if (c is ShowElementCombinator) { | 691 if (c is ShowElementCombinator) { |
| 690 var show = c.shownNames.toSet(); | 692 var show = c.shownNames.toSet(); |
| 691 elements.retainWhere((e) => show.contains(e.displayName)); | 693 elements.retainWhere((e) => show.contains(e.displayName)); |
| 692 } else if (c is HideElementCombinator) { | 694 } else if (c is HideElementCombinator) { |
| 693 var hide = c.hiddenNames.toSet(); | 695 var hide = c.hiddenNames.toSet(); |
| 694 elements.removeWhere((e) => hide.contains(e.displayName)); | 696 elements.removeWhere((e) => hide.contains(e.displayName)); |
| 695 } | 697 } |
| 696 } | 698 } |
| 697 } | 699 } |
| OLD | NEW |