| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 trydart.poi; | 5 library trydart.poi; |
| 6 | 6 |
| 7 import 'dart:async' show | 7 import 'dart:async' show |
| 8 Completer, | 8 Completer, |
| 9 Future; | 9 Future; |
| 10 | 10 |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 ]; | 390 ]; |
| 391 | 391 |
| 392 if (!isCompiler) { | 392 if (!isCompiler) { |
| 393 options.add('--analyze-only'); | 393 options.add('--analyze-only'); |
| 394 } | 394 } |
| 395 | 395 |
| 396 if (enableMinification) { | 396 if (enableMinification) { |
| 397 options.add('--minify'); | 397 options.add('--minify'); |
| 398 } | 398 } |
| 399 | 399 |
| 400 LibraryUpdater updater = | 400 LibraryUpdater updater; |
| 401 new LibraryUpdater( | 401 |
| 402 cachedCompiler, inputProvider, script, printWallClock, printVerbose); | |
| 403 Future<bool> reuseLibrary(LibraryElement library) { | 402 Future<bool> reuseLibrary(LibraryElement library) { |
| 404 return poiTask.measure(() => updater.reuseLibrary(library)); | 403 return poiTask.measure(() => updater.reuseLibrary(library)); |
| 405 } | 404 } |
| 406 | 405 |
| 407 return reuseCompiler( | 406 Future<Compiler> invokeReuseCompiler() { |
| 408 diagnosticHandler: handler, | 407 updater = new LibraryUpdater( |
| 409 inputProvider: inputProvider, | 408 cachedCompiler, inputProvider, script, printWallClock, printVerbose); |
| 410 options: options, | 409 return reuseCompiler( |
| 411 cachedCompiler: cachedCompiler, | 410 diagnosticHandler: handler, |
| 412 libraryRoot: libraryRoot, | 411 inputProvider: inputProvider, |
| 413 packageRoot: packageRoot, | 412 options: options, |
| 414 packagesAreImmutable: true, | 413 cachedCompiler: cachedCompiler, |
| 415 reuseLibrary: reuseLibrary).then((Compiler newCompiler) { | 414 libraryRoot: libraryRoot, |
| 415 packageRoot: packageRoot, |
| 416 packagesAreImmutable: true, |
| 417 reuseLibrary: reuseLibrary); |
| 418 } |
| 419 |
| 420 return invokeReuseCompiler().then((Compiler newCompiler) { |
| 421 // TODO(ahe): Move this "then" block to [reuseCompiler]. |
| 422 if (updater.failed) { |
| 423 cachedCompiler = null; |
| 424 return invokeReuseCompiler(); |
| 425 } else { |
| 426 return newCompiler; |
| 427 } |
| 428 }).then((Compiler newCompiler) { |
| 416 if (!isCompiler) { | 429 if (!isCompiler) { |
| 417 newCompiler.enqueuerFilter = new ScriptOnlyFilter(script); | 430 newCompiler.enqueuerFilter = new ScriptOnlyFilter(script); |
| 418 } | 431 } |
| 419 return runPoiInternal(newCompiler, sw, updater, position); | 432 return runPoiInternal(newCompiler, sw, updater, position); |
| 420 }); | 433 }); |
| 421 } | 434 } |
| 422 | 435 |
| 423 Future<Element> runPoiInternal( | 436 Future<Element> runPoiInternal( |
| 424 Compiler newCompiler, | 437 Compiler newCompiler, |
| 425 Stopwatch sw, | 438 Stopwatch sw, |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 783 | 796 |
| 784 modelx.ImportScope importScope(modelx.LibraryElementX element) { | 797 modelx.ImportScope importScope(modelx.LibraryElementX element) { |
| 785 return element.importScope; | 798 return element.importScope; |
| 786 } | 799 } |
| 787 | 800 |
| 788 class PoiTask extends CompilerTask { | 801 class PoiTask extends CompilerTask { |
| 789 PoiTask(Compiler compiler) : super(compiler); | 802 PoiTask(Compiler compiler) : super(compiler); |
| 790 | 803 |
| 791 String get name => 'POI'; | 804 String get name => 'POI'; |
| 792 } | 805 } |
| OLD | NEW |