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/tasks.dart' show CompilerTask; | 7 import 'common/tasks.dart' show CompilerTask; |
8 import 'common.dart'; | 8 import 'common.dart'; |
9 import 'compiler.dart' show Compiler; | 9 import 'compiler.dart' show Compiler; |
10 import 'constants/expressions.dart' show ConstantExpression; | 10 import 'constants/expressions.dart' show ConstantExpression; |
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
807 _assignNamesToOutputUnits(allOutputUnits); | 807 _assignNamesToOutputUnits(allOutputUnits); |
808 })); | 808 })); |
809 // Notify the impact strategy impacts are no longer needed for deferred | 809 // Notify the impact strategy impacts are no longer needed for deferred |
810 // load. | 810 // load. |
811 compiler.impactStrategy.onImpactUsed(IMPACT_USE); | 811 compiler.impactStrategy.onImpactUsed(IMPACT_USE); |
812 } | 812 } |
813 | 813 |
814 void beforeResolution(LibraryEntity mainLibrary) { | 814 void beforeResolution(LibraryEntity mainLibrary) { |
815 if (mainLibrary == null) return; | 815 if (mainLibrary == null) return; |
816 // TODO(johnniwinther): Support deferred load for kernel based elements. | 816 // TODO(johnniwinther): Support deferred load for kernel based elements. |
817 if (compiler.options.loadFromDill) return; | 817 if (compiler.options.previewDart2) return; |
818 _allDeferredImports[_fakeMainImport] = mainLibrary; | 818 _allDeferredImports[_fakeMainImport] = mainLibrary; |
819 var lastDeferred; | 819 var lastDeferred; |
820 // When detecting duplicate prefixes of deferred libraries there are 4 | 820 // When detecting duplicate prefixes of deferred libraries there are 4 |
821 // cases of duplicate prefixes: | 821 // cases of duplicate prefixes: |
822 // 1. | 822 // 1. |
823 // import "lib.dart" deferred as a; | 823 // import "lib.dart" deferred as a; |
824 // import "lib2.dart" deferred as a; | 824 // import "lib2.dart" deferred as a; |
825 // 2. | 825 // 2. |
826 // import "lib.dart" deferred as a; | 826 // import "lib.dart" deferred as a; |
827 // import "lib2.dart" as a; | 827 // import "lib2.dart" as a; |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1122 | 1122 |
1123 bool operator ==(other) { | 1123 bool operator ==(other) { |
1124 if (other is! _DeclaredDeferredImport) return false; | 1124 if (other is! _DeclaredDeferredImport) return false; |
1125 return declaration == other.declaration; | 1125 return declaration == other.declaration; |
1126 } | 1126 } |
1127 | 1127 |
1128 int get hashCode => declaration.hashCode * 17; | 1128 int get hashCode => declaration.hashCode * 17; |
1129 | 1129 |
1130 String toString() => '$declaration'; | 1130 String toString() => '$declaration'; |
1131 } | 1131 } |
OLD | NEW |