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, |
11 DeferredConstantValue, | 11 DeferredConstantValue, |
12 StringConstantValue; | 12 StringConstantValue; |
13 | 13 |
14 import 'dart2jslib.dart' show | 14 import 'dart2jslib.dart' show |
15 Backend, | 15 Backend, |
16 Compiler, | 16 Compiler, |
17 CompilerTask, | 17 CompilerTask, |
18 invariant, | 18 invariant, |
19 MessageKind; | 19 MessageKind; |
20 | 20 |
21 import 'dart_backend/dart_backend.dart' show | 21 import 'dart_backend/dart_backend.dart' show |
22 DartBackend; | 22 DartBackend; |
23 | 23 |
24 import 'js_backend/js_backend.dart' show | 24 import 'js_backend/js_backend.dart' show |
25 JavaScriptBackend; | 25 JavaScriptBackend; |
26 | 26 |
27 import 'elements/elements.dart' show | 27 import 'elements/elements.dart' show |
| 28 AccessorElement, |
28 AstElement, | 29 AstElement, |
29 ClassElement, | 30 ClassElement, |
30 Element, | 31 Element, |
31 ElementKind, | 32 ElementKind, |
32 Elements, | 33 Elements, |
33 FunctionElement, | 34 FunctionElement, |
34 LibraryElement, | 35 LibraryElement, |
35 MetadataAnnotation, | 36 MetadataAnnotation, |
36 PrefixElement, | 37 PrefixElement, |
37 ScopeContainerElement, | 38 ScopeContainerElement, |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 // agree. | 228 // agree. |
228 return imports.every((Import import) => import.isDeferred); | 229 return imports.every((Import import) => import.isDeferred); |
229 } | 230 } |
230 | 231 |
231 /// Returns a [Link] of every [Import] that imports [element] into [library]. | 232 /// Returns a [Link] of every [Import] that imports [element] into [library]. |
232 Link<Import> _getImports(Element element, LibraryElement library) { | 233 Link<Import> _getImports(Element element, LibraryElement library) { |
233 if (element.isClassMember) { | 234 if (element.isClassMember) { |
234 element = element.enclosingClass; | 235 element = element.enclosingClass; |
235 } | 236 } |
236 if (element.isAccessor) { | 237 if (element.isAccessor) { |
237 element = (element as FunctionElement).abstractField; | 238 element = (element as AccessorElement).abstractField; |
238 } | 239 } |
239 return library.getImportsFor(element); | 240 return library.getImportsFor(element); |
240 } | 241 } |
241 | 242 |
242 /// Finds all elements and constants that [element] depends directly on. | 243 /// Finds all elements and constants that [element] depends directly on. |
243 /// (not the transitive closure.) | 244 /// (not the transitive closure.) |
244 /// | 245 /// |
245 /// Adds the results to [elements] and [constants]. | 246 /// Adds the results to [elements] and [constants]. |
246 void _collectAllElementsAndConstantsResolvedFrom( | 247 void _collectAllElementsAndConstantsResolvedFrom( |
247 Element element, | 248 Element element, |
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
860 _importingLibrary = importingLibrary; | 861 _importingLibrary = importingLibrary; |
861 | 862 |
862 String get importingLibraryName { | 863 String get importingLibraryName { |
863 String libraryName = _importingLibrary.getLibraryName(); | 864 String libraryName = _importingLibrary.getLibraryName(); |
864 return libraryName == "" | 865 return libraryName == "" |
865 ? "<unnamed>" | 866 ? "<unnamed>" |
866 : libraryName; | 867 : libraryName; |
867 } | 868 } |
868 | 869 |
869 } | 870 } |
OLD | NEW |