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 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
763 ? previousDeferredImport | 763 ? previousDeferredImport |
764 : import; | 764 : import; |
765 compiler.reportError(failingImport.prefix, | 765 compiler.reportError(failingImport.prefix, |
766 MessageKind.DEFERRED_LIBRARY_DUPLICATE_PREFIX); | 766 MessageKind.DEFERRED_LIBRARY_DUPLICATE_PREFIX); |
767 } | 767 } |
768 usedPrefixes.add(prefix); | 768 usedPrefixes.add(prefix); |
769 } | 769 } |
770 } | 770 } |
771 }); | 771 }); |
772 } | 772 } |
773 Backend backend = compiler.backend; | 773 if (isProgramSplit) { |
774 if (isProgramSplit && backend is JavaScriptBackend) { | 774 isProgramSplit = compiler.backend.registerDeferredLoading( |
775 backend.registerCheckDeferredIsLoaded(compiler.globalDependencies); | 775 lastDeferred, compiler.globalDependencies); |
776 } | |
777 if (isProgramSplit && backend is DartBackend) { | |
778 // TODO(sigurdm): Implement deferred loading for dart2dart. | |
779 compiler.reportWarning( | |
780 lastDeferred, | |
781 MessageKind.DEFERRED_LIBRARY_DART_2_DART); | |
782 isProgramSplit = false; | |
783 } | 776 } |
784 } | 777 } |
785 | 778 |
786 /// If [send] is a static send with a deferred element, returns the | 779 /// If [send] is a static send with a deferred element, returns the |
787 /// [PrefixElement] that the first prefix of the send resolves to. | 780 /// [PrefixElement] that the first prefix of the send resolves to. |
788 /// Otherwise returns null. | 781 /// Otherwise returns null. |
789 /// | 782 /// |
790 /// Precondition: send must be static. | 783 /// Precondition: send must be static. |
791 /// | 784 /// |
792 /// Example: | 785 /// Example: |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
890 _importingLibrary = importingLibrary; | 883 _importingLibrary = importingLibrary; |
891 | 884 |
892 String get importingLibraryName { | 885 String get importingLibraryName { |
893 String libraryName = _importingLibrary.getLibraryName(); | 886 String libraryName = _importingLibrary.getLibraryName(); |
894 return libraryName == "" | 887 return libraryName == "" |
895 ? "<unnamed>" | 888 ? "<unnamed>" |
896 : libraryName; | 889 : libraryName; |
897 } | 890 } |
898 | 891 |
899 } | 892 } |
OLD | NEW |