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 Future; | 7 import 'dart:async' show Future; |
8 | 8 |
9 import '../compiler_new.dart' as api; | 9 import '../compiler_new.dart' as api; |
10 import 'backend_strategy.dart'; | 10 import 'backend_strategy.dart'; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
110 | 110 |
111 /// Output provider from user of Compiler API. | 111 /// Output provider from user of Compiler API. |
112 api.CompilerOutput userOutputProvider; | 112 api.CompilerOutput userOutputProvider; |
113 | 113 |
114 List<Uri> librariesToAnalyzeWhenRun; | 114 List<Uri> librariesToAnalyzeWhenRun; |
115 | 115 |
116 ResolvedUriTranslator get resolvedUriTranslator; | 116 ResolvedUriTranslator get resolvedUriTranslator; |
117 | 117 |
118 Uri mainLibraryUri; | 118 Uri mainLibraryUri; |
119 | 119 |
120 ClosedWorld backendClosedWorldForTesting; | |
121 | |
120 DiagnosticReporter get reporter => _reporter; | 122 DiagnosticReporter get reporter => _reporter; |
121 Resolution get resolution => _resolution; | 123 Resolution get resolution => _resolution; |
122 ParsingContext get parsingContext => _parsingContext; | 124 ParsingContext get parsingContext => _parsingContext; |
123 | 125 |
124 // TODO(zarah): Remove this map and incorporate compile-time errors | 126 // TODO(zarah): Remove this map and incorporate compile-time errors |
125 // in the model. | 127 // in the model. |
126 /// Tracks elements with compile-time errors. | 128 /// Tracks elements with compile-time errors. |
127 final Map<Entity, List<DiagnosticMessage>> elementsWithCompileTimeErrors = | 129 final Map<Entity, List<DiagnosticMessage>> elementsWithCompileTimeErrors = |
128 new Map<Entity, List<DiagnosticMessage>>(); | 130 new Map<Entity, List<DiagnosticMessage>>(); |
129 | 131 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
218 : new _ScriptLoader(this), | 220 : new _ScriptLoader(this), |
219 new _ElementScanner(scanner), | 221 new _ElementScanner(scanner), |
220 serialization, | 222 serialization, |
221 resolvePatchUri, | 223 resolvePatchUri, |
222 patchParser, | 224 patchParser, |
223 environment, | 225 environment, |
224 reporter, | 226 reporter, |
225 measurer), | 227 measurer), |
226 parser = new ParserTask(this), | 228 parser = new ParserTask(this), |
227 resolver = createResolverTask(), | 229 resolver = createResolverTask(), |
228 closureDataLookup = backendStrategy.createClosureConversionTask(this), | 230 closureDataLookup = backendStrategy.createClosureConversionTask(this), |
Emily Fortuna
2017/06/19 17:44:41
oh, do we not need this to be part of the task lis
| |
229 checker = new TypeCheckerTask(this), | 231 checker = new TypeCheckerTask(this), |
230 globalInference = new GlobalTypeInferenceTask(this), | 232 globalInference = new GlobalTypeInferenceTask(this), |
231 constants = backend.constantCompilerTask, | 233 constants = backend.constantCompilerTask, |
232 deferredLoadTask = new DeferredLoadTask(this), | 234 deferredLoadTask = new DeferredLoadTask(this), |
233 mirrorUsageAnalyzerTask = new MirrorUsageAnalyzerTask(this), | 235 mirrorUsageAnalyzerTask = new MirrorUsageAnalyzerTask(this), |
234 // [enqueuer] is created earlier because it contains the resolution world | 236 // [enqueuer] is created earlier because it contains the resolution world |
235 // objects needed by other tasks. | 237 // objects needed by other tasks. |
236 enqueuer, | 238 enqueuer, |
237 dumpInfoTask = new DumpInfoTask(this), | 239 dumpInfoTask = new DumpInfoTask(this), |
238 selfTask = new GenericTask('self', measurer), | 240 selfTask = new GenericTask('self', measurer), |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
593 '', 'data', api.OutputType.serializationData), | 595 '', 'data', api.OutputType.serializationData), |
594 libraryLoader.libraries.where((LibraryEntity library) { | 596 libraryLoader.libraries.where((LibraryEntity library) { |
595 return !serialization.isDeserialized(library); | 597 return !serialization.isDeserialized(library); |
596 })); | 598 })); |
597 } | 599 } |
598 if (options.analyzeOnly) return; | 600 if (options.analyzeOnly) return; |
599 assert(mainFunction != null); | 601 assert(mainFunction != null); |
600 | 602 |
601 ClosedWorldRefiner closedWorldRefiner = closeResolution(mainFunction); | 603 ClosedWorldRefiner closedWorldRefiner = closeResolution(mainFunction); |
602 ClosedWorld closedWorld = closedWorldRefiner.closedWorld; | 604 ClosedWorld closedWorld = closedWorldRefiner.closedWorld; |
605 backendClosedWorldForTesting = closedWorld; | |
603 mainFunction = closedWorld.elementEnvironment.mainFunction; | 606 mainFunction = closedWorld.elementEnvironment.mainFunction; |
604 | 607 |
605 reporter.log('Inferring types...'); | 608 reporter.log('Inferring types...'); |
606 globalInference.runGlobalTypeInference( | 609 globalInference.runGlobalTypeInference( |
607 mainFunction, closedWorld, closedWorldRefiner); | 610 mainFunction, closedWorld, closedWorldRefiner); |
608 | 611 |
609 if (stopAfterTypeInference) return; | 612 if (stopAfterTypeInference) return; |
610 | 613 |
611 backend.onTypeInferenceComplete(globalInference.results); | 614 backend.onTypeInferenceComplete(globalInference.results); |
612 | 615 |
(...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1594 _ElementScanner(this.scanner); | 1597 _ElementScanner(this.scanner); |
1595 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library); | 1598 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library); |
1596 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit); | 1599 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit); |
1597 } | 1600 } |
1598 | 1601 |
1599 class _EmptyEnvironment implements Environment { | 1602 class _EmptyEnvironment implements Environment { |
1600 const _EmptyEnvironment(); | 1603 const _EmptyEnvironment(); |
1601 | 1604 |
1602 String valueOf(String key) => null; | 1605 String valueOf(String key) => null; |
1603 } | 1606 } |
OLD | NEW |