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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 | 279 |
280 for (Element dependency in treeElements.allElements) { | 280 for (Element dependency in treeElements.allElements) { |
281 if (dependency.isLocal && !dependency.isFunction) continue; | 281 if (dependency.isLocal && !dependency.isFunction) continue; |
282 if (dependency.isErroneous) continue; | 282 if (dependency.isErroneous) continue; |
283 if (dependency.isTypeVariable) continue; | 283 if (dependency.isTypeVariable) continue; |
284 | 284 |
285 elements.add(dependency); | 285 elements.add(dependency); |
286 } | 286 } |
287 treeElements.forEachConstantNode((Node node, _) { | 287 treeElements.forEachConstantNode((Node node, _) { |
288 // Explicitly depend on the backend constants. | 288 // Explicitly depend on the backend constants. |
289 constants.add( | 289 ConstantValue value = |
290 backend.constants.getConstantValueForNode(node, treeElements)); | 290 backend.constants.getConstantValueForNode(node, treeElements); |
| 291 if (value != null) { |
| 292 // TODO(johnniwinther): Assert that all constants have values when |
| 293 // these are directly evaluated. |
| 294 constants.add(value); |
| 295 } |
291 }); | 296 }); |
292 elements.addAll(treeElements.otherDependencies); | 297 elements.addAll(treeElements.otherDependencies); |
293 } | 298 } |
294 | 299 |
295 // TODO(sigurdm): How is metadata on a patch-class handled? | 300 // TODO(sigurdm): How is metadata on a patch-class handled? |
296 for (MetadataAnnotation metadata in element.metadata) { | 301 for (MetadataAnnotation metadata in element.metadata) { |
297 ConstantValue constant = | 302 ConstantValue constant = |
298 backend.constants.getConstantValueForMetadata(metadata); | 303 backend.constants.getConstantValueForMetadata(metadata); |
299 if (constant != null) { | 304 if (constant != null) { |
300 constants.add(constant); | 305 constants.add(constant); |
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
890 _importingLibrary = importingLibrary; | 895 _importingLibrary = importingLibrary; |
891 | 896 |
892 String get importingLibraryName { | 897 String get importingLibraryName { |
893 String libraryName = _importingLibrary.getLibraryName(); | 898 String libraryName = _importingLibrary.getLibraryName(); |
894 return libraryName == "" | 899 return libraryName == "" |
895 ? "<unnamed>" | 900 ? "<unnamed>" |
896 : libraryName; | 901 : libraryName; |
897 } | 902 } |
898 | 903 |
899 } | 904 } |
OLD | NEW |