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 fletchc_incremental; | 5 library fletchc_incremental; |
6 | 6 |
7 import 'dart:async' show | 7 import 'dart:async' show |
8 EventSink, | 8 EventSink, |
9 Future; | 9 Future; |
10 | 10 |
11 import 'dart:developer' show | 11 import 'dart:developer' show |
12 UserTag; | 12 UserTag; |
13 | 13 |
14 import 'package:compiler/src/apiimpl.dart' show | 14 import 'package:compiler/src/apiimpl.dart' show |
15 Compiler; | 15 CompilerImpl; |
16 | 16 |
17 import 'package:compiler/compiler_new.dart' show | 17 import 'package:compiler/compiler_new.dart' show |
18 CompilerDiagnostics, | 18 CompilerDiagnostics, |
19 CompilerInput, | 19 CompilerInput, |
20 CompilerOutput, | 20 CompilerOutput, |
21 Diagnostic; | 21 Diagnostic; |
22 | 22 |
23 import 'package:compiler/src/elements/elements.dart' show | 23 import 'package:compiler/src/elements/elements.dart' show |
24 ClassElement, | 24 ClassElement, |
25 ConstructorElement, | 25 ConstructorElement, |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 } | 136 } |
137 | 137 |
138 LibraryElement get mainApp => _compiler.mainApp; | 138 LibraryElement get mainApp => _compiler.mainApp; |
139 | 139 |
140 FletchCompilerImplementation get compiler => _compiler; | 140 FletchCompilerImplementation get compiler => _compiler; |
141 | 141 |
142 /// Perform a full compile of [script]. This will reset the incremental | 142 /// Perform a full compile of [script]. This will reset the incremental |
143 /// compiler. | 143 /// compiler. |
144 Future<bool> compile(Uri script) { | 144 Future<bool> compile(Uri script) { |
145 _compiler = null; | 145 _compiler = null; |
146 return _reuseCompiler(null).then((Compiler compiler) { | 146 return _reuseCompiler(null).then((CompilerImpl compiler) { |
147 _compiler = compiler; | 147 _compiler = compiler; |
148 return compiler.run(script); | 148 return compiler.run(script); |
149 }); | 149 }); |
150 } | 150 } |
151 | 151 |
152 Future<Compiler> _reuseCompiler( | 152 Future<CompilerImpl> _reuseCompiler( |
153 Future<bool> reuseLibrary(LibraryElement library)) { | 153 Future<bool> reuseLibrary(LibraryElement library)) { |
154 List<String> options = this.options == null | 154 List<String> options = this.options == null |
155 ? <String> [] : new List<String>.from(this.options); | 155 ? <String> [] : new List<String>.from(this.options); |
156 options.addAll(INCREMENTAL_OPTIONS); | 156 options.addAll(INCREMENTAL_OPTIONS); |
157 return reuseCompiler( | 157 return reuseCompiler( |
158 cachedCompiler: _compiler, | 158 cachedCompiler: _compiler, |
159 libraryRoot: libraryRoot, | 159 libraryRoot: libraryRoot, |
160 patchRoot: patchRoot, | 160 patchRoot: patchRoot, |
161 packageConfig: packageConfig, | 161 packageConfig: packageConfig, |
162 nativesJson: nativesJson, | 162 nativesJson: nativesJson, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 Uri updatedFile = updatedFiles[uri]; | 195 Uri updatedFile = updatedFiles[uri]; |
196 return inputProvider.readFromUri(updatedFile == null ? uri : updatedFile); | 196 return inputProvider.readFromUri(updatedFile == null ? uri : updatedFile); |
197 } | 197 } |
198 LibraryUpdater updater = new LibraryUpdater( | 198 LibraryUpdater updater = new LibraryUpdater( |
199 _compiler, | 199 _compiler, |
200 mappingInputProvider, | 200 mappingInputProvider, |
201 logTime, | 201 logTime, |
202 logVerbose, | 202 logVerbose, |
203 _context); | 203 _context); |
204 _context.registerUriWithUpdates(updatedFiles.keys); | 204 _context.registerUriWithUpdates(updatedFiles.keys); |
205 return _reuseCompiler(updater.reuseLibrary).then((Compiler compiler) async { | 205 return _reuseCompiler(updater.reuseLibrary).then( |
| 206 (CompilerImpl compiler) async { |
206 _compiler = compiler; | 207 _compiler = compiler; |
207 FletchDelta delta = await updater.computeUpdateFletch(currentSystem); | 208 FletchDelta delta = await updater.computeUpdateFletch(currentSystem); |
208 _checkCompilationFailed(); | 209 _checkCompilationFailed(); |
209 return delta; | 210 return delta; |
210 }); | 211 }); |
211 } | 212 } |
212 | 213 |
213 FletchDelta computeInitialDelta() { | 214 FletchDelta computeInitialDelta() { |
214 FletchBackend backend = _compiler.backend; | 215 FletchBackend backend = _compiler.backend; |
215 return backend.computeDelta(); | 216 return backend.computeDelta(); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 | 295 |
295 case "production": | 296 case "production": |
296 return IncrementalMode.production; | 297 return IncrementalMode.production; |
297 | 298 |
298 case "experimental": | 299 case "experimental": |
299 return IncrementalMode.experimental; | 300 return IncrementalMode.experimental; |
300 | 301 |
301 } | 302 } |
302 return null; | 303 return null; |
303 } | 304 } |
OLD | NEW |