OLD | NEW |
---|---|
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 dart2js.compiler_base; | 5 library dart2js.compiler_base; |
6 | 6 |
7 import 'dart:async' show EventSink, Future; | 7 import 'dart:async' show EventSink, Future; |
8 | 8 |
9 import '../compiler_new.dart' as api; | 9 import '../compiler_new.dart' as api; |
10 import 'cache_strategy.dart' show CacheStrategy; | 10 import 'cache_strategy.dart' show CacheStrategy; |
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
676 fullyEnqueueLibrary( | 676 fullyEnqueueLibrary( |
677 libraryLoader.lookupLibrary(libraryUri), enqueuer.resolution); | 677 libraryLoader.lookupLibrary(libraryUri), enqueuer.resolution); |
678 } | 678 } |
679 } | 679 } |
680 } | 680 } |
681 // Elements required by enqueueHelpers are global dependencies | 681 // Elements required by enqueueHelpers are global dependencies |
682 // that are not pulled in by a particular element. | 682 // that are not pulled in by a particular element. |
683 backend.enqueueHelpers(enqueuer.resolution); | 683 backend.enqueueHelpers(enqueuer.resolution); |
684 resolveLibraryMetadata(); | 684 resolveLibraryMetadata(); |
685 reporter.log('Resolving...'); | 685 reporter.log('Resolving...'); |
686 if (mainFunction != null && !mainFunction.isMalformed) { | |
687 mainFunction.computeType(resolution); | |
688 backend.backendClasses.listImplementation.ensureResolved(resolution); | |
Harry Terkelsen
2016/11/18 17:40:21
don't we only need to resolve List and String if m
Johnni Winther
2016/11/21 12:45:09
Moved these into the backend.
| |
689 backend.backendClasses.stringImplementation | |
690 .ensureResolved(resolution); | |
691 } | |
692 | |
686 processQueue(enqueuer.resolution, mainFunction); | 693 processQueue(enqueuer.resolution, mainFunction); |
687 enqueuer.resolution.logSummary(reporter.log); | 694 enqueuer.resolution.logSummary(reporter.log); |
688 | 695 |
689 _reporter.reportSuppressedMessagesSummary(); | 696 _reporter.reportSuppressedMessagesSummary(); |
690 | 697 |
691 if (compilationFailed) { | 698 if (compilationFailed) { |
692 if (!options.generateCodeWithCompileTimeErrors) return; | 699 if (!options.generateCodeWithCompileTimeErrors) return; |
693 if (!backend | 700 if (!backend |
694 .enableCodegenWithErrorsIfSupported(NO_LOCATION_SPANNABLE)) { | 701 .enableCodegenWithErrorsIfSupported(NO_LOCATION_SPANNABLE)) { |
695 return; | 702 return; |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
840 enqueuer.applyImpact( | 847 enqueuer.applyImpact( |
841 impactStrategy, | 848 impactStrategy, |
842 selfTask.measureSubtask( | 849 selfTask.measureSubtask( |
843 "work.run", () => work.run(this, enqueuer)), | 850 "work.run", () => work.run(this, enqueuer)), |
844 impactSource: work.element); | 851 impactSource: work.element); |
845 })); | 852 })); |
846 }); | 853 }); |
847 }); | 854 }); |
848 } | 855 } |
849 | 856 |
850 void processQueue(Enqueuer enqueuer, Element main) { | 857 void processQueue(Enqueuer enqueuer, MethodElement mainMethod) { |
851 selfTask.measureSubtask("Compiler.processQueue", () { | 858 selfTask.measureSubtask("Compiler.processQueue", () { |
852 enqueuer.applyImpact( | 859 enqueuer.applyImpact( |
853 impactStrategy, | 860 impactStrategy, |
854 enqueuer.nativeEnqueuer | 861 enqueuer.nativeEnqueuer |
855 .processNativeClasses(libraryLoader.libraries)); | 862 .processNativeClasses(libraryLoader.libraries)); |
856 if (main != null && !main.isMalformed) { | 863 if (mainMethod != null && !mainMethod.isMalformed) { |
857 FunctionElement mainMethod = main; | 864 enqueuer.applyImpact( |
858 mainMethod.computeType(resolution); | 865 impactStrategy, backend.computeMainImpact(enqueuer, mainMethod)); |
859 if (mainMethod.functionSignature.parameterCount != 0) { | |
860 // The first argument could be a list of strings. | |
861 backend.backendClasses.listImplementation.ensureResolved(resolution); | |
862 enqueuer.registerInstantiatedType( | |
863 backend.backendClasses.listImplementation.rawType); | |
864 backend.backendClasses.stringImplementation | |
865 .ensureResolved(resolution); | |
866 enqueuer.registerInstantiatedType( | |
867 backend.backendClasses.stringImplementation.rawType); | |
868 | |
869 backend.registerMainHasArguments(enqueuer); | |
870 } | |
871 enqueuer.addToWorkList(main); | |
872 } | 866 } |
873 if (options.verbose) { | 867 if (options.verbose) { |
874 progress.reset(); | 868 progress.reset(); |
875 } | 869 } |
876 emptyQueue(enqueuer); | 870 emptyQueue(enqueuer); |
877 enqueuer.queueIsClosed = true; | 871 enqueuer.queueIsClosed = true; |
878 // Notify the impact strategy impacts are no longer needed for this | 872 // Notify the impact strategy impacts are no longer needed for this |
879 // enqueuer. | 873 // enqueuer. |
880 impactStrategy.onImpactUsed(enqueuer.impactUse); | 874 impactStrategy.onImpactUsed(enqueuer.impactUse); |
881 backend.onQueueClosed(); | 875 backend.onQueueClosed(); |
(...skipping 1375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2257 _ElementScanner(this.scanner); | 2251 _ElementScanner(this.scanner); |
2258 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library); | 2252 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library); |
2259 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit); | 2253 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit); |
2260 } | 2254 } |
2261 | 2255 |
2262 class _EmptyEnvironment implements Environment { | 2256 class _EmptyEnvironment implements Environment { |
2263 const _EmptyEnvironment(); | 2257 const _EmptyEnvironment(); |
2264 | 2258 |
2265 String valueOf(String key) => null; | 2259 String valueOf(String key) => null; |
2266 } | 2260 } |
OLD | NEW |