| 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 | 7 import 'dart:async' show |
| 8 EventSink, | 8 EventSink, |
| 9 Future; | 9 Future; |
| 10 | 10 |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 backend = new dart_backend.DartBackend(this, options.strips, | 394 backend = new dart_backend.DartBackend(this, options.strips, |
| 395 multiFile: options.dart2dartMultiFile); | 395 multiFile: options.dart2dartMultiFile); |
| 396 if (options.dumpInfo) { | 396 if (options.dumpInfo) { |
| 397 throw new ArgumentError('--dump-info is not supported for dart2dart.'); | 397 throw new ArgumentError('--dump-info is not supported for dart2dart.'); |
| 398 } | 398 } |
| 399 } | 399 } |
| 400 | 400 |
| 401 tasks = [ | 401 tasks = [ |
| 402 dietParser = new DietParserTask( | 402 dietParser = new DietParserTask( |
| 403 this, enableConditionalDirectives: options.enableConditionalDirectives
), | 403 this, enableConditionalDirectives: options.enableConditionalDirectives
), |
| 404 scanner = new ScannerTask(this), | 404 scanner = createScannerTask(), |
| 405 serialization = new SerializationTask(this), | 405 serialization = new SerializationTask(this), |
| 406 libraryLoader = new LibraryLoaderTask(this, | 406 libraryLoader = new LibraryLoaderTask(this, |
| 407 new _ResolvedUriTranslator(this), | 407 new _ResolvedUriTranslator(this), |
| 408 new _ScriptLoader(this), | 408 new _ScriptLoader(this), |
| 409 new _ElementScanner(scanner), | 409 new _ElementScanner(scanner), |
| 410 this.serialization, | 410 this.serialization, |
| 411 this, | 411 this, |
| 412 environment), | 412 environment), |
| 413 parser = new ParserTask(this, | 413 parser = new ParserTask(this, |
| 414 enableConditionalDirectives: options.enableConditionalDirectives), | 414 enableConditionalDirectives: options.enableConditionalDirectives), |
| 415 patchParser = new PatchParserTask( | 415 patchParser = new PatchParserTask( |
| 416 this, enableConditionalDirectives: options.enableConditionalDirectives
), | 416 this, enableConditionalDirectives: options.enableConditionalDirectives
), |
| 417 resolver = new ResolverTask(this, backend.constantCompilerTask), | 417 resolver = createResolverTask(), |
| 418 closureToClassMapper = new closureMapping.ClosureTask(this), | 418 closureToClassMapper = new closureMapping.ClosureTask(this), |
| 419 checker = new TypeCheckerTask(this), | 419 checker = new TypeCheckerTask(this), |
| 420 typesTask = new ti.TypesTask(this), | 420 typesTask = new ti.TypesTask(this), |
| 421 constants = backend.constantCompilerTask, | 421 constants = backend.constantCompilerTask, |
| 422 deferredLoadTask = new DeferredLoadTask(this), | 422 deferredLoadTask = new DeferredLoadTask(this), |
| 423 mirrorUsageAnalyzerTask = new MirrorUsageAnalyzerTask(this), | 423 mirrorUsageAnalyzerTask = new MirrorUsageAnalyzerTask(this), |
| 424 enqueuer = new EnqueueTask(this), | 424 enqueuer = new EnqueueTask(this), |
| 425 dumpInfoTask = new DumpInfoTask(this), | 425 dumpInfoTask = new DumpInfoTask(this), |
| 426 reuseLibraryTask = new GenericTask('Reuse library', this), | 426 reuseLibraryTask = new GenericTask('Reuse library', this), |
| 427 ]; | 427 ]; |
| 428 | 428 |
| 429 tasks.addAll(backend.tasks); | 429 tasks.addAll(backend.tasks); |
| 430 } | 430 } |
| 431 | 431 |
| 432 /// Creates the scanner task. |
| 433 /// |
| 434 /// Override this to mock the scanner for testing. |
| 435 ScannerTask createScannerTask() => new ScannerTask(this); |
| 436 |
| 437 /// Creates the resolver task. |
| 438 /// |
| 439 /// Override this to mock the resolver for testing. |
| 440 ResolverTask createResolverTask() { |
| 441 return new ResolverTask(this, backend.constantCompilerTask); |
| 442 } |
| 443 |
| 432 Universe get resolverWorld => enqueuer.resolution.universe; | 444 Universe get resolverWorld => enqueuer.resolution.universe; |
| 433 Universe get codegenWorld => enqueuer.codegen.universe; | 445 Universe get codegenWorld => enqueuer.codegen.universe; |
| 434 | 446 |
| 435 bool get analyzeAll => options.analyzeAll || compileAll; | 447 bool get analyzeAll => options.analyzeAll || compileAll; |
| 436 | 448 |
| 437 bool get compileAll => false; | 449 bool get compileAll => false; |
| 438 | 450 |
| 439 bool get disableTypeInference => | 451 bool get disableTypeInference => |
| 440 options.disableTypeInference || compilationFailed; | 452 options.disableTypeInference || compilationFailed; |
| 441 | 453 |
| (...skipping 1683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2125 _ElementScanner(this.scanner); | 2137 _ElementScanner(this.scanner); |
| 2126 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library); | 2138 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library); |
| 2127 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit); | 2139 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit); |
| 2128 } | 2140 } |
| 2129 | 2141 |
| 2130 class _EmptyEnvironment implements Environment { | 2142 class _EmptyEnvironment implements Environment { |
| 2131 const _EmptyEnvironment(); | 2143 const _EmptyEnvironment(); |
| 2132 | 2144 |
| 2133 String valueOf(String key) => null; | 2145 String valueOf(String key) => null; |
| 2134 } | 2146 } |
| OLD | NEW |