| 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 EventSink, | 8 EventSink, |
| 9 Future; | 9 Future; |
| 10 | 10 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 const List<String> INCREMENTAL_OPTIONS = const <String>[ | 47 const List<String> INCREMENTAL_OPTIONS = const <String>[ |
| 48 '--disable-type-inference', | 48 '--disable-type-inference', |
| 49 '--incremental-support', | 49 '--incremental-support', |
| 50 '--generate-code-with-compile-time-errors', | 50 '--generate-code-with-compile-time-errors', |
| 51 '--no-source-maps', // TODO(ahe): Remove this. | 51 '--no-source-maps', // TODO(ahe): Remove this. |
| 52 ]; | 52 ]; |
| 53 | 53 |
| 54 class IncrementalCompiler { | 54 class IncrementalCompiler { |
| 55 final Uri libraryRoot; | 55 final Uri libraryRoot; |
| 56 final Uri packageRoot; | 56 final Uri packageRoot; |
| 57 final Uri packageConfig; |
| 57 final CompilerInput inputProvider; | 58 final CompilerInput inputProvider; |
| 58 final CompilerDiagnostics diagnosticHandler; | 59 final CompilerDiagnostics diagnosticHandler; |
| 59 final List<String> options; | 60 final List<String> options; |
| 60 final CompilerOutput outputProvider; | 61 final CompilerOutput outputProvider; |
| 61 final Map<String, dynamic> environment; | 62 final Map<String, dynamic> environment; |
| 62 final List<String> _updates = <String>[]; | 63 final List<String> _updates = <String>[]; |
| 63 final IncrementalCompilerContext _context = new IncrementalCompilerContext(); | 64 final IncrementalCompilerContext _context = new IncrementalCompilerContext(); |
| 64 | 65 |
| 65 CompilerImpl _compiler; | 66 CompilerImpl _compiler; |
| 66 | 67 |
| 67 IncrementalCompiler({ | 68 IncrementalCompiler({ |
| 68 this.libraryRoot, | 69 this.libraryRoot, |
| 69 this.packageRoot, | 70 this.packageRoot, |
| 71 this.packageConfig, |
| 70 this.inputProvider, | 72 this.inputProvider, |
| 71 this.diagnosticHandler, | 73 this.diagnosticHandler, |
| 72 this.options, | 74 this.options, |
| 73 this.outputProvider, | 75 this.outputProvider, |
| 74 this.environment}) { | 76 this.environment}) { |
| 75 if (libraryRoot == null) { | 77 if (libraryRoot == null) { |
| 76 throw new ArgumentError('libraryRoot is null.'); | 78 throw new ArgumentError('libraryRoot is null.'); |
| 77 } | 79 } |
| 78 if (inputProvider == null) { | 80 if (inputProvider == null) { |
| 79 throw new ArgumentError('inputProvider is null.'); | 81 throw new ArgumentError('inputProvider is null.'); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 100 | 102 |
| 101 Future<CompilerImpl> _reuseCompiler( | 103 Future<CompilerImpl> _reuseCompiler( |
| 102 Future<bool> reuseLibrary(LibraryElement library)) { | 104 Future<bool> reuseLibrary(LibraryElement library)) { |
| 103 List<String> options = this.options == null | 105 List<String> options = this.options == null |
| 104 ? <String> [] : new List<String>.from(this.options); | 106 ? <String> [] : new List<String>.from(this.options); |
| 105 options.addAll(INCREMENTAL_OPTIONS); | 107 options.addAll(INCREMENTAL_OPTIONS); |
| 106 return reuseCompiler( | 108 return reuseCompiler( |
| 107 cachedCompiler: _compiler, | 109 cachedCompiler: _compiler, |
| 108 libraryRoot: libraryRoot, | 110 libraryRoot: libraryRoot, |
| 109 packageRoot: packageRoot, | 111 packageRoot: packageRoot, |
| 112 packageConfig: packageConfig, |
| 110 inputProvider: inputProvider, | 113 inputProvider: inputProvider, |
| 111 diagnosticHandler: diagnosticHandler, | 114 diagnosticHandler: diagnosticHandler, |
| 112 options: options, | 115 options: options, |
| 113 outputProvider: outputProvider, | 116 outputProvider: outputProvider, |
| 114 environment: environment, | 117 environment: environment, |
| 115 reuseLibrary: reuseLibrary); | 118 reuseLibrary: reuseLibrary); |
| 116 } | 119 } |
| 117 | 120 |
| 118 Future<String> compileUpdates( | 121 Future<String> compileUpdates( |
| 119 Map<Uri, Uri> updatedFiles, | 122 Map<Uri, Uri> updatedFiles, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 } | 167 } |
| 165 } | 168 } |
| 166 | 169 |
| 167 class IncrementalCompilationFailed { | 170 class IncrementalCompilationFailed { |
| 168 final String reason; | 171 final String reason; |
| 169 | 172 |
| 170 const IncrementalCompilationFailed(this.reason); | 173 const IncrementalCompilationFailed(this.reason); |
| 171 | 174 |
| 172 String toString() => "Can't incrementally compile program.\n\n$reason"; | 175 String toString() => "Can't incrementally compile program.\n\n$reason"; |
| 173 } | 176 } |
| OLD | NEW |