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 463 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 |