| 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 dart2js_incremental; | 5 library dart2js_incremental; |
| 6 | 6 |
| 7 import 'dart:async' show | 7 import 'dart:async' show |
| 8 Future; | 8 Future; |
| 9 | 9 |
| 10 import 'dart:profiler' show | 10 import 'dart:profiler' show |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 final Uri libraryRoot; | 40 final Uri libraryRoot; |
| 41 final Uri packageRoot; | 41 final Uri packageRoot; |
| 42 final CompilerInputProvider inputProvider; | 42 final CompilerInputProvider inputProvider; |
| 43 final DiagnosticHandler diagnosticHandler; | 43 final DiagnosticHandler diagnosticHandler; |
| 44 final List<String> options; | 44 final List<String> options; |
| 45 final CompilerOutputProvider outputProvider; | 45 final CompilerOutputProvider outputProvider; |
| 46 final Map<String, dynamic> environment; | 46 final Map<String, dynamic> environment; |
| 47 | 47 |
| 48 Compiler _compiler; | 48 Compiler _compiler; |
| 49 | 49 |
| 50 bool get compilerWasCancelled => _compiler.compilerWasCancelled; |
| 51 |
| 50 IncrementalCompiler({ | 52 IncrementalCompiler({ |
| 51 this.libraryRoot, | 53 this.libraryRoot, |
| 52 this.packageRoot, | 54 this.packageRoot, |
| 53 this.inputProvider, | 55 this.inputProvider, |
| 54 this.diagnosticHandler, | 56 this.diagnosticHandler, |
| 55 this.options, | 57 this.options, |
| 56 this.outputProvider, | 58 this.outputProvider, |
| 57 this.environment}) { | 59 this.environment}) { |
| 58 if (libraryRoot == null) { | 60 if (libraryRoot == null) { |
| 59 throw new ArgumentError('libraryRoot is null.'); | 61 throw new ArgumentError('libraryRoot is null.'); |
| 60 } | 62 } |
| 61 if (inputProvider == null) { | 63 if (inputProvider == null) { |
| 62 throw new ArgumentError('inputProvider is null.'); | 64 throw new ArgumentError('inputProvider is null.'); |
| 63 } | 65 } |
| 64 if (diagnosticHandler == null) { | 66 if (diagnosticHandler == null) { |
| 65 throw new ArgumentError('diagnosticHandler is null.'); | 67 throw new ArgumentError('diagnosticHandler is null.'); |
| 66 } | 68 } |
| 67 } | 69 } |
| 68 | 70 |
| 69 Future<bool> compile(Uri script) { | 71 Future<bool> compile(Uri script) { |
| 70 List<String> options = new List<String>.from(this.options); | 72 List<String> options = this.options == null |
| 73 ? <String> [] : new List<String>.from(this.options); |
| 71 options.addAll(INCREMENTAL_OPTIONS); | 74 options.addAll(INCREMENTAL_OPTIONS); |
| 72 Future<Compiler> future = reuseCompiler( | 75 Future<Compiler> future = reuseCompiler( |
| 73 cachedCompiler: _compiler, | 76 cachedCompiler: _compiler, |
| 74 libraryRoot: libraryRoot, | 77 libraryRoot: libraryRoot, |
| 75 packageRoot: packageRoot, | 78 packageRoot: packageRoot, |
| 76 inputProvider: inputProvider, | 79 inputProvider: inputProvider, |
| 77 diagnosticHandler: diagnosticHandler, | 80 diagnosticHandler: diagnosticHandler, |
| 78 options: options, | 81 options: options, |
| 79 outputProvider: outputProvider, | 82 outputProvider: outputProvider, |
| 80 environment: environment); | 83 environment: environment); |
| 81 return future.then((Compiler compiler) { | 84 return future.then((Compiler compiler) { |
| 82 _compiler = compiler; | 85 _compiler = compiler; |
| 83 return compiler.run(script); | 86 return compiler.run(script); |
| 84 }); | 87 }); |
| 85 } | 88 } |
| 86 } | 89 } |
| OLD | NEW |