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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 } | 250 } |
251 enqueuer = backend.makeEnqueuer(); | 251 enqueuer = backend.makeEnqueuer(); |
252 | 252 |
253 if (options.dumpInfo && options.useStartupEmitter) { | 253 if (options.dumpInfo && options.useStartupEmitter) { |
254 throw new ArgumentError( | 254 throw new ArgumentError( |
255 '--dump-info is not supported with the fast startup emitter'); | 255 '--dump-info is not supported with the fast startup emitter'); |
256 } | 256 } |
257 | 257 |
258 tasks = [ | 258 tasks = [ |
259 dietParser = | 259 dietParser = |
260 new DietParserTask(options, idGenerator, backend, reporter, measurer), | 260 new DietParserTask(idGenerator, backend, reporter, measurer), |
261 scanner = createScannerTask(), | 261 scanner = createScannerTask(), |
262 serialization = new SerializationTask(this), | 262 serialization = new SerializationTask(this), |
263 libraryLoader = new LibraryLoaderTask( | 263 libraryLoader = new LibraryLoaderTask( |
264 resolvedUriTranslator, | 264 resolvedUriTranslator, |
265 options.compileOnly | 265 options.compileOnly |
266 ? new _NoScriptLoader(this) | 266 ? new _NoScriptLoader(this) |
267 : new _ScriptLoader(this), | 267 : new _ScriptLoader(this), |
268 new _ElementScanner(scanner), | 268 new _ElementScanner(scanner), |
269 serialization, | 269 serialization, |
270 this, | 270 this, |
271 environment, | 271 environment, |
272 reporter, | 272 reporter, |
273 measurer), | 273 measurer), |
274 parser = new ParserTask(this, options), | 274 parser = new ParserTask(this), |
275 patchParser = new PatchParserTask(this, options), | 275 patchParser = new PatchParserTask(this), |
276 resolver = createResolverTask(), | 276 resolver = createResolverTask(), |
277 closureToClassMapper = new closureMapping.ClosureTask(this), | 277 closureToClassMapper = new closureMapping.ClosureTask(this), |
278 checker = new TypeCheckerTask(this), | 278 checker = new TypeCheckerTask(this), |
279 globalInference = new GlobalTypeInferenceTask(this), | 279 globalInference = new GlobalTypeInferenceTask(this), |
280 constants = backend.constantCompilerTask, | 280 constants = backend.constantCompilerTask, |
281 deferredLoadTask = new DeferredLoadTask(this), | 281 deferredLoadTask = new DeferredLoadTask(this), |
282 mirrorUsageAnalyzerTask = new MirrorUsageAnalyzerTask(this), | 282 mirrorUsageAnalyzerTask = new MirrorUsageAnalyzerTask(this), |
283 // [enqueuer] is created earlier because it contains the resolution world | 283 // [enqueuer] is created earlier because it contains the resolution world |
284 // objects needed by other tasks. | 284 // objects needed by other tasks. |
285 enqueuer, | 285 enqueuer, |
286 dumpInfoTask = new DumpInfoTask(this), | 286 dumpInfoTask = new DumpInfoTask(this), |
287 selfTask = new GenericTask('self', measurer), | 287 selfTask = new GenericTask('self', measurer), |
288 ]; | 288 ]; |
289 if (options.resolveOnly) { | 289 if (options.resolveOnly) { |
290 serialization.supportSerialization = true; | 290 serialization.supportSerialization = true; |
291 } | 291 } |
292 | 292 |
293 _parsingContext = | 293 _parsingContext = |
294 new ParsingContext(reporter, options, parser, patchParser, backend); | 294 new ParsingContext(reporter, parser, patchParser, backend); |
295 | 295 |
296 tasks.addAll(backend.tasks); | 296 tasks.addAll(backend.tasks); |
297 } | 297 } |
298 | 298 |
299 /// The world currently being computed by resolution. This forms a basis for | 299 /// The world currently being computed by resolution. This forms a basis for |
300 /// the [inferenceWorld] and later the [closedWorld]. | 300 /// the [inferenceWorld] and later the [closedWorld]. |
301 OpenWorld get openWorld => _world; | 301 OpenWorld get openWorld => _world; |
302 | 302 |
303 /// The closed world after resolution but currently refined by inference. | 303 /// The closed world after resolution but currently refined by inference. |
304 ClosedWorldRefiner get inferenceWorld => _world; | 304 ClosedWorldRefiner get inferenceWorld => _world; |
(...skipping 1943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2248 _ElementScanner(this.scanner); | 2248 _ElementScanner(this.scanner); |
2249 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library); | 2249 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library); |
2250 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit); | 2250 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit); |
2251 } | 2251 } |
2252 | 2252 |
2253 class _EmptyEnvironment implements Environment { | 2253 class _EmptyEnvironment implements Environment { |
2254 const _EmptyEnvironment(); | 2254 const _EmptyEnvironment(); |
2255 | 2255 |
2256 String valueOf(String key) => null; | 2256 String valueOf(String key) => null; |
2257 } | 2257 } |
OLD | NEW |