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 'dart2jslib.dart' show | 7 import 'dart2jslib.dart' show |
8 Backend, | 8 Backend, |
9 Compiler, | 9 Compiler, |
10 CompilerTask, | 10 CompilerTask, |
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 } | 680 } |
681 for (OutputUnit outputUnit in _constantToOutputUnit.values) { | 681 for (OutputUnit outputUnit in _constantToOutputUnit.values) { |
682 allOutputUnits.add(outputUnit); | 682 allOutputUnits.add(outputUnit); |
683 } | 683 } |
684 | 684 |
685 _assignNamesToOutputUnits(allOutputUnits); | 685 _assignNamesToOutputUnits(allOutputUnits); |
686 }); | 686 }); |
687 } | 687 } |
688 | 688 |
689 void ensureMetadataResolved(Compiler compiler) { | 689 void ensureMetadataResolved(Compiler compiler) { |
| 690 if (compiler.mainApp == null) return; |
690 _allDeferredImports[_fakeMainImport] = compiler.mainApp; | 691 _allDeferredImports[_fakeMainImport] = compiler.mainApp; |
691 var lastDeferred; | 692 var lastDeferred; |
692 // When detecting duplicate prefixes of deferred libraries there are 4 | 693 // When detecting duplicate prefixes of deferred libraries there are 4 |
693 // cases of duplicate prefixes: | 694 // cases of duplicate prefixes: |
694 // 1. | 695 // 1. |
695 // import "lib.dart" deferred as a; | 696 // import "lib.dart" deferred as a; |
696 // import "lib2.dart" deferred as a; | 697 // import "lib2.dart" deferred as a; |
697 // 2. | 698 // 2. |
698 // import "lib.dart" deferred as a; | 699 // import "lib.dart" deferred as a; |
699 // import "lib2.dart" as a; | 700 // import "lib2.dart" as a; |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 Element maybePrefix = elements[identifier]; | 811 Element maybePrefix = elements[identifier]; |
811 if (maybePrefix != null && maybePrefix.isPrefix) { | 812 if (maybePrefix != null && maybePrefix.isPrefix) { |
812 PrefixElement prefixElement = maybePrefix; | 813 PrefixElement prefixElement = maybePrefix; |
813 if (prefixElement.isDeferred) { | 814 if (prefixElement.isDeferred) { |
814 return prefixElement; | 815 return prefixElement; |
815 } | 816 } |
816 } | 817 } |
817 return null; | 818 return null; |
818 } | 819 } |
819 } | 820 } |
OLD | NEW |