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 'common.dart'; | 7 import 'common.dart'; |
8 import 'common/backend_api.dart' show Backend; | 8 import 'common/backend_api.dart' show Backend; |
9 import 'common/tasks.dart' show CompilerTask; | 9 import 'common/tasks.dart' show CompilerTask; |
10 import 'compiler.dart' show Compiler; | 10 import 'compiler.dart' show Compiler; |
(...skipping 12 matching lines...) Expand all Loading... |
23 Element, | 23 Element, |
24 ElementKind, | 24 ElementKind, |
25 Elements, | 25 Elements, |
26 ExportElement, | 26 ExportElement, |
27 FunctionElement, | 27 FunctionElement, |
28 ImportElement, | 28 ImportElement, |
29 LibraryElement, | 29 LibraryElement, |
30 LocalFunctionElement, | 30 LocalFunctionElement, |
31 MetadataAnnotation, | 31 MetadataAnnotation, |
32 PrefixElement, | 32 PrefixElement, |
| 33 ResolvedAstKind, |
33 ScopeContainerElement, | 34 ScopeContainerElement, |
34 TypedefElement; | 35 TypedefElement; |
35 import 'js_backend/js_backend.dart' show JavaScriptBackend; | 36 import 'js_backend/js_backend.dart' show JavaScriptBackend; |
36 import 'resolution/resolution.dart' show AnalyzableElementX; | 37 import 'resolution/resolution.dart' show AnalyzableElementX; |
37 import 'resolution/tree_elements.dart' show TreeElements; | 38 import 'resolution/tree_elements.dart' show TreeElements; |
38 import 'tree/tree.dart' as ast; | 39 import 'tree/tree.dart' as ast; |
39 import 'tree/tree.dart' | 40 import 'tree/tree.dart' |
40 show | 41 show |
41 Import, | 42 Import, |
42 LibraryTag, | 43 LibraryTag, |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 break; | 331 break; |
331 case TypeUseKind.CHECKED_MODE_CHECK: | 332 case TypeUseKind.CHECKED_MODE_CHECK: |
332 if (compiler.options.enableTypeAssertions) { | 333 if (compiler.options.enableTypeAssertions) { |
333 collectTypeDependencies(type); | 334 collectTypeDependencies(type); |
334 } | 335 } |
335 break; | 336 break; |
336 } | 337 } |
337 }), | 338 }), |
338 IMPACT_USE); | 339 IMPACT_USE); |
339 | 340 |
| 341 if (analyzableElement.resolvedAst.kind != ResolvedAstKind.PARSED) { |
| 342 return; |
| 343 } |
| 344 |
340 TreeElements treeElements = analyzableElement.resolvedAst.elements; | 345 TreeElements treeElements = analyzableElement.resolvedAst.elements; |
341 assert(treeElements != null); | 346 assert(treeElements != null); |
342 | 347 |
343 treeElements.forEachConstantNode((Node node, _) { | 348 treeElements.forEachConstantNode((Node node, _) { |
344 // Explicitly depend on the backend constants. | 349 // Explicitly depend on the backend constants. |
345 ConstantValue value = | 350 ConstantValue value = |
346 backend.constants.getConstantValueForNode(node, treeElements); | 351 backend.constants.getConstantValueForNode(node, treeElements); |
347 if (value != null) { | 352 if (value != null) { |
348 // TODO(johnniwinther): Assert that all constants have values when | 353 // TODO(johnniwinther): Assert that all constants have values when |
349 // these are directly evaluated. | 354 // these are directly evaluated. |
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
988 return result; | 993 return result; |
989 } | 994 } |
990 | 995 |
991 bool operator ==(other) { | 996 bool operator ==(other) { |
992 if (other is! _DeclaredDeferredImport) return false; | 997 if (other is! _DeclaredDeferredImport) return false; |
993 return declaration == other.declaration; | 998 return declaration == other.declaration; |
994 } | 999 } |
995 | 1000 |
996 int get hashCode => declaration.hashCode * 17; | 1001 int get hashCode => declaration.hashCode * 17; |
997 } | 1002 } |
OLD | NEW |