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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 import 'tracer.dart' show Tracer; | 70 import 'tracer.dart' show Tracer; |
71 import 'tree/tree.dart' show Node, TypeAnnotation; | 71 import 'tree/tree.dart' show Node, TypeAnnotation; |
72 import 'typechecker.dart' show TypeCheckerTask; | 72 import 'typechecker.dart' show TypeCheckerTask; |
73 import 'types/types.dart' show GlobalTypeInferenceTask; | 73 import 'types/types.dart' show GlobalTypeInferenceTask; |
74 import 'types/masks.dart' show CommonMasks; | 74 import 'types/masks.dart' show CommonMasks; |
75 import 'universe/selector.dart' show Selector; | 75 import 'universe/selector.dart' show Selector; |
76 import 'universe/universe.dart' show ResolutionUniverse, CodegenUniverse; | 76 import 'universe/universe.dart' show ResolutionUniverse, CodegenUniverse; |
77 import 'universe/use.dart' show StaticUse; | 77 import 'universe/use.dart' show StaticUse; |
78 import 'universe/world_impact.dart' show ImpactStrategy, WorldImpact; | 78 import 'universe/world_impact.dart' show ImpactStrategy, WorldImpact; |
79 import 'util/util.dart' show Link, Setlet; | 79 import 'util/util.dart' show Link, Setlet; |
80 import 'world.dart' show ClosedWorld, InferenceWorld, World; | 80 import 'world.dart' show ClosedWorld, InferenceWorld, OpenWorld, WorldImpl; |
81 | 81 |
82 typedef Backend MakeBackendFuncion(Compiler compiler); | 82 typedef Backend MakeBackendFuncion(Compiler compiler); |
83 | 83 |
84 typedef CompilerDiagnosticReporter MakeReporterFunction( | 84 typedef CompilerDiagnosticReporter MakeReporterFunction( |
85 Compiler compiler, CompilerOptions options); | 85 Compiler compiler, CompilerOptions options); |
86 | 86 |
87 abstract class Compiler implements LibraryLoaderListener { | 87 abstract class Compiler implements LibraryLoaderListener { |
88 Measurer get measurer; | 88 Measurer get measurer; |
89 | 89 |
90 final IdGenerator idGenerator = new IdGenerator(); | 90 final IdGenerator idGenerator = new IdGenerator(); |
91 World _world; | 91 WorldImpl _world; |
92 Types types; | 92 Types types; |
93 _CompilerCoreTypes _coreTypes; | 93 _CompilerCoreTypes _coreTypes; |
94 CompilerDiagnosticReporter _reporter; | 94 CompilerDiagnosticReporter _reporter; |
95 _CompilerResolution _resolution; | 95 _CompilerResolution _resolution; |
96 ParsingContext _parsingContext; | 96 ParsingContext _parsingContext; |
97 | 97 |
98 final CacheStrategy cacheStrategy; | 98 final CacheStrategy cacheStrategy; |
99 | 99 |
100 ImpactStrategy impactStrategy = const ImpactStrategy(); | 100 ImpactStrategy impactStrategy = const ImpactStrategy(); |
101 | 101 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 {CompilerOptions options, | 218 {CompilerOptions options, |
219 api.CompilerOutput outputProvider, | 219 api.CompilerOutput outputProvider, |
220 this.environment: const _EmptyEnvironment(), | 220 this.environment: const _EmptyEnvironment(), |
221 MakeBackendFuncion makeBackend, | 221 MakeBackendFuncion makeBackend, |
222 MakeReporterFunction makeReporter}) | 222 MakeReporterFunction makeReporter}) |
223 : this.options = options, | 223 : this.options = options, |
224 this.cacheStrategy = new CacheStrategy(options.hasIncrementalSupport), | 224 this.cacheStrategy = new CacheStrategy(options.hasIncrementalSupport), |
225 this.userOutputProvider = outputProvider == null | 225 this.userOutputProvider = outputProvider == null |
226 ? const NullCompilerOutput() | 226 ? const NullCompilerOutput() |
227 : outputProvider { | 227 : outputProvider { |
228 _world = new World(this); | 228 _world = new WorldImpl(this); |
229 if (makeReporter != null) { | 229 if (makeReporter != null) { |
230 _reporter = makeReporter(this, options); | 230 _reporter = makeReporter(this, options); |
231 } else { | 231 } else { |
232 _reporter = new CompilerDiagnosticReporter(this, options); | 232 _reporter = new CompilerDiagnosticReporter(this, options); |
233 } | 233 } |
234 _resolution = new _CompilerResolution(this); | 234 _resolution = new _CompilerResolution(this); |
235 // TODO(johnniwinther): Initialize core types in [initializeCoreClasses] and | 235 // TODO(johnniwinther): Initialize core types in [initializeCoreClasses] and |
236 // make its field final. | 236 // make its field final. |
237 _coreTypes = new _CompilerCoreTypes(_resolution, reporter); | 237 _coreTypes = new _CompilerCoreTypes(_resolution, reporter); |
238 types = new Types(_resolution); | 238 types = new Types(_resolution); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 } | 297 } |
298 | 298 |
299 _parsingContext = | 299 _parsingContext = |
300 new ParsingContext(reporter, options, parser, patchParser, backend); | 300 new ParsingContext(reporter, options, parser, patchParser, backend); |
301 | 301 |
302 tasks.addAll(backend.tasks); | 302 tasks.addAll(backend.tasks); |
303 } | 303 } |
304 | 304 |
305 /// The world currently being computed by resolution. This forms a basis for | 305 /// The world currently being computed by resolution. This forms a basis for |
306 /// the [inferenceWorld] and later the [closedWorld]. | 306 /// the [inferenceWorld] and later the [closedWorld]. |
307 World get openWorld => _world; | 307 OpenWorld get openWorld => _world; |
308 | 308 |
309 /// The closed world after resolution but currently refined by inference. | 309 /// The closed world after resolution but currently refined by inference. |
310 InferenceWorld get inferenceWorld => _world; | 310 InferenceWorld get inferenceWorld => _world; |
311 | 311 |
312 /// The closed world after resolution and inference. | 312 /// The closed world after resolution and inference. |
313 ClosedWorld get closedWorld => _world; | 313 ClosedWorld get closedWorld => _world; |
314 | 314 |
315 /// Creates the scanner task. | 315 /// Creates the scanner task. |
316 /// | 316 /// |
317 /// Override this to mock the scanner for testing. | 317 /// Override this to mock the scanner for testing. |
(...skipping 1921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2239 _ElementScanner(this.scanner); | 2239 _ElementScanner(this.scanner); |
2240 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library); | 2240 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library); |
2241 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit); | 2241 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit); |
2242 } | 2242 } |
2243 | 2243 |
2244 class _EmptyEnvironment implements Environment { | 2244 class _EmptyEnvironment implements Environment { |
2245 const _EmptyEnvironment(); | 2245 const _EmptyEnvironment(); |
2246 | 2246 |
2247 String valueOf(String key) => null; | 2247 String valueOf(String key) => null; |
2248 } | 2248 } |
OLD | NEW |