Chromium Code Reviews| 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/values.dart' show | 7 import 'constants/values.dart' show |
| 8 ConstantValue, | 8 ConstantValue, |
| 9 ConstructedConstantValue, | 9 ConstructedConstantValue, |
| 10 DeferredConstantValue, | 10 DeferredConstantValue, |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 273 | 273 |
| 274 assert(treeElements != null); | 274 assert(treeElements != null); |
| 275 | 275 |
| 276 for (Element dependency in treeElements.allElements) { | 276 for (Element dependency in treeElements.allElements) { |
| 277 if (dependency.isLocal && !dependency.isFunction) continue; | 277 if (dependency.isLocal && !dependency.isFunction) continue; |
| 278 if (dependency.isErroneous) continue; | 278 if (dependency.isErroneous) continue; |
| 279 if (dependency.isTypeVariable) continue; | 279 if (dependency.isTypeVariable) continue; |
| 280 | 280 |
| 281 elements.add(dependency); | 281 elements.add(dependency); |
| 282 } | 282 } |
| 283 | |
| 284 treeElements.forEachType((n, t) { | |
| 285 registerTypeArgumentsAsDependencies(type) { | |
|
floitsch
2015/07/17 09:22:25
Especially for nested functions I want to have a r
Siggi Cherem (dart-lang)
2015/07/17 15:34:48
Done.
| |
| 286 var dependency = type.element; | |
|
floitsch
2015/07/17 09:22:25
We usually don't use "var".
Siggi Cherem (dart-lang)
2015/07/17 15:34:49
Done.
| |
| 287 if (dependency == null || dependency.isTypeVariable) return; | |
| 288 elements.add(dependency); | |
| 289 if (type is GenericType) { | |
| 290 type.typeArguments.forEach(registerTypeArgumentsAsDependencies); | |
| 291 } | |
| 292 } | |
| 293 if (n is NewExpression) registerTypeArgumentsAsDependencies(t); | |
| 294 }); | |
| 295 | |
| 283 treeElements.forEachConstantNode((Node node, _) { | 296 treeElements.forEachConstantNode((Node node, _) { |
| 284 // Explicitly depend on the backend constants. | 297 // Explicitly depend on the backend constants. |
| 285 ConstantValue value = | 298 ConstantValue value = |
| 286 backend.constants.getConstantValueForNode(node, treeElements); | 299 backend.constants.getConstantValueForNode(node, treeElements); |
| 287 if (value != null) { | 300 if (value != null) { |
| 288 // TODO(johnniwinther): Assert that all constants have values when | 301 // TODO(johnniwinther): Assert that all constants have values when |
| 289 // these are directly evaluated. | 302 // these are directly evaluated. |
| 290 constants.add(value); | 303 constants.add(value); |
| 291 } | 304 } |
| 292 }); | 305 }); |
| (...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 884 _importingLibrary = importingLibrary; | 897 _importingLibrary = importingLibrary; |
| 885 | 898 |
| 886 String get importingLibraryName { | 899 String get importingLibraryName { |
| 887 String libraryName = _importingLibrary.getLibraryName(); | 900 String libraryName = _importingLibrary.getLibraryName(); |
| 888 return libraryName == "" | 901 return libraryName == "" |
| 889 ? "<unnamed>" | 902 ? "<unnamed>" |
| 890 : libraryName; | 903 : libraryName; |
| 891 } | 904 } |
| 892 | 905 |
| 893 } | 906 } |
| OLD | NEW |