| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library deferred_load; | 5 library deferred_load; |
| 6 | 6 |
| 7 import 'constants/expressions.dart'; | 7 import 'constants/expressions.dart'; |
| 8 import 'constants/values.dart' show | 8 import 'constants/values.dart' show |
| 9 ConstantValue, | 9 ConstantValue, |
| 10 ConstructedConstantValue, | 10 ConstructedConstantValue, |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 /// | 206 /// |
| 207 /// For example, if we have two deferred libraries `A` and `B` that both | 207 /// For example, if we have two deferred libraries `A` and `B` that both |
| 208 /// import a library `C`, then even though elements from `A` and `C` end up in | 208 /// import a library `C`, then even though elements from `A` and `C` end up in |
| 209 /// different output units, there is a non-deferred path between `A` and `C`. | 209 /// different output units, there is a non-deferred path between `A` and `C`. |
| 210 bool hasOnlyNonDeferredImportPaths(Element from, Element to) { | 210 bool hasOnlyNonDeferredImportPaths(Element from, Element to) { |
| 211 OutputUnit outputUnitFrom = outputUnitForElement(from); | 211 OutputUnit outputUnitFrom = outputUnitForElement(from); |
| 212 OutputUnit outputUnitTo = outputUnitForElement(to); | 212 OutputUnit outputUnitTo = outputUnitForElement(to); |
| 213 return outputUnitTo.imports.containsAll(outputUnitFrom.imports); | 213 return outputUnitTo.imports.containsAll(outputUnitFrom.imports); |
| 214 } | 214 } |
| 215 | 215 |
| 216 bool isFromMainOutputUnit(Element element) { | |
| 217 return outputUnitForElement(element) == mainOutputUnit; | |
| 218 } | |
| 219 | |
| 220 void registerConstantDeferredUse(DeferredConstantValue constant, | 216 void registerConstantDeferredUse(DeferredConstantValue constant, |
| 221 PrefixElement prefix) { | 217 PrefixElement prefix) { |
| 222 OutputUnit outputUnit = new OutputUnit(); | 218 OutputUnit outputUnit = new OutputUnit(); |
| 223 outputUnit.imports.add(prefix.deferredImport); | 219 outputUnit.imports.add(prefix.deferredImport); |
| 224 _constantToOutputUnit[constant] = outputUnit; | 220 _constantToOutputUnit[constant] = outputUnit; |
| 225 } | 221 } |
| 226 | 222 |
| 227 /// Answers whether [element] is explicitly deferred when referred to from | 223 /// Answers whether [element] is explicitly deferred when referred to from |
| 228 /// [library]. | 224 /// [library]. |
| 229 bool _isExplicitlyDeferred(Element element, LibraryElement library) { | 225 bool _isExplicitlyDeferred(Element element, LibraryElement library) { |
| (...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 893 _importingLibrary = importingLibrary; | 889 _importingLibrary = importingLibrary; |
| 894 | 890 |
| 895 String get importingLibraryName { | 891 String get importingLibraryName { |
| 896 String libraryName = _importingLibrary.getLibraryName(); | 892 String libraryName = _importingLibrary.getLibraryName(); |
| 897 return libraryName == "" | 893 return libraryName == "" |
| 898 ? "<unnamed>" | 894 ? "<unnamed>" |
| 899 : libraryName; | 895 : libraryName; |
| 900 } | 896 } |
| 901 | 897 |
| 902 } | 898 } |
| OLD | NEW |