OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 part of fletchc_incremental; | 5 part of fletchc_incremental; |
6 | 6 |
7 /// Do not call this method directly. It will be made private. | 7 /// Do not call this method directly. It will be made private. |
8 // TODO(ahe): Make this method private. | 8 // TODO(ahe): Make this method private. |
9 Future<Compiler> reuseCompiler( | 9 Future<CompilerImpl> reuseCompiler( |
10 {CompilerDiagnostics diagnosticHandler, | 10 {CompilerDiagnostics diagnosticHandler, |
11 CompilerInput inputProvider, | 11 CompilerInput inputProvider, |
12 CompilerOutput outputProvider, | 12 CompilerOutput outputProvider, |
13 List<String> options: const [], | 13 List<String> options: const [], |
14 Compiler cachedCompiler, | 14 CompilerImpl cachedCompiler, |
15 Uri libraryRoot, | 15 Uri libraryRoot, |
16 Uri patchRoot, | 16 Uri patchRoot, |
17 Uri nativesJson, | 17 Uri nativesJson, |
18 Uri packageConfig, | 18 Uri packageConfig, |
19 Uri fletchVm, | 19 Uri fletchVm, |
20 bool packagesAreImmutable: false, | 20 bool packagesAreImmutable: false, |
21 Map<String, dynamic> environment, | 21 Map<String, dynamic> environment, |
22 Future<bool> reuseLibrary(LibraryElement library), | 22 Future<bool> reuseLibrary(LibraryElement library), |
23 List<Category> categories}) async { | 23 List<Category> categories}) async { |
24 UserTag oldTag = new UserTag('_reuseCompiler').makeCurrent(); | 24 UserTag oldTag = new UserTag('_reuseCompiler').makeCurrent(); |
25 // if (libraryRoot == null) { | 25 // if (libraryRoot == null) { |
26 // throw 'Missing libraryRoot'; | 26 // throw 'Missing libraryRoot'; |
27 // } | 27 // } |
28 if (inputProvider == null) { | 28 if (inputProvider == null) { |
29 throw 'Missing inputProvider'; | 29 throw 'Missing inputProvider'; |
30 } | 30 } |
31 if (diagnosticHandler == null) { | 31 if (diagnosticHandler == null) { |
32 throw 'Missing diagnosticHandler'; | 32 throw 'Missing diagnosticHandler'; |
33 } | 33 } |
34 if (outputProvider == null) { | 34 if (outputProvider == null) { |
35 outputProvider = new OutputProvider(); | 35 outputProvider = new OutputProvider(); |
36 } | 36 } |
37 if (environment == null) { | 37 if (environment == null) { |
38 environment = {}; | 38 environment = {}; |
39 } | 39 } |
40 Compiler compiler = cachedCompiler; | 40 CompilerImpl compiler = cachedCompiler; |
41 if (compiler == null || | 41 if (compiler == null || |
42 (libraryRoot != null && compiler.libraryRoot != libraryRoot) || | 42 (libraryRoot != null && compiler.libraryRoot != libraryRoot) || |
43 !compiler.hasIncrementalSupport || | 43 !compiler.hasIncrementalSupport || |
44 compiler.hasCrashed || | 44 compiler.hasCrashed || |
45 compiler.enqueuer.resolution.hasEnqueuedReflectiveElements || | 45 compiler.enqueuer.resolution.hasEnqueuedReflectiveElements || |
46 compiler.deferredLoadTask.isProgramSplit) { | 46 compiler.deferredLoadTask.isProgramSplit) { |
47 if (compiler != null && compiler.hasIncrementalSupport) { | 47 if (compiler != null && compiler.hasIncrementalSupport) { |
48 if (compiler.hasCrashed) { | 48 if (compiler.hasCrashed) { |
49 throw new IncrementalCompilationFailed( | 49 throw new IncrementalCompilationFailed( |
50 "Unable to reuse compiler due to crash"); | 50 "Unable to reuse compiler due to crash"); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 throw 'addError($errorEvent, $stackTrace)'; | 122 throw 'addError($errorEvent, $stackTrace)'; |
123 } | 123 } |
124 | 124 |
125 void close() { | 125 void close() { |
126 if (data != null) { | 126 if (data != null) { |
127 onClose(data.join()); | 127 onClose(data.join()); |
128 data = null; | 128 data = null; |
129 } | 129 } |
130 } | 130 } |
131 } | 131 } |
OLD | NEW |