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 dart2js_incremental; | 5 part of dart2js_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 packageRoot, | 16 Uri packageRoot, |
17 bool packagesAreImmutable: false, | 17 bool packagesAreImmutable: false, |
18 Map<String, dynamic> environment, | 18 Map<String, dynamic> environment, |
19 Future<bool> reuseLibrary(LibraryElement library)}) { | 19 Future<bool> reuseLibrary(LibraryElement library)}) { |
20 UserTag oldTag = new UserTag('_reuseCompiler').makeCurrent(); | 20 UserTag oldTag = new UserTag('_reuseCompiler').makeCurrent(); |
21 if (libraryRoot == null) { | 21 if (libraryRoot == null) { |
22 throw 'Missing libraryRoot'; | 22 throw 'Missing libraryRoot'; |
23 } | 23 } |
24 if (inputProvider == null) { | 24 if (inputProvider == null) { |
25 throw 'Missing inputProvider'; | 25 throw 'Missing inputProvider'; |
26 } | 26 } |
27 if (diagnosticHandler == null) { | 27 if (diagnosticHandler == null) { |
28 throw 'Missing diagnosticHandler'; | 28 throw 'Missing diagnosticHandler'; |
29 } | 29 } |
30 if (outputProvider == null) { | 30 if (outputProvider == null) { |
31 outputProvider = const NullCompilerOutput(); | 31 outputProvider = const NullCompilerOutput(); |
32 } | 32 } |
33 if (environment == null) { | 33 if (environment == null) { |
34 environment = {}; | 34 environment = {}; |
35 } | 35 } |
36 Compiler compiler = cachedCompiler; | 36 CompilerImpl compiler = cachedCompiler; |
37 if (compiler == null || | 37 if (compiler == null || |
38 compiler.libraryRoot != libraryRoot || | 38 compiler.libraryRoot != libraryRoot || |
39 !compiler.hasIncrementalSupport || | 39 !compiler.hasIncrementalSupport || |
40 compiler.hasCrashed || | 40 compiler.hasCrashed || |
41 compiler.enqueuer.resolution.hasEnqueuedReflectiveElements || | 41 compiler.enqueuer.resolution.hasEnqueuedReflectiveElements || |
42 compiler.deferredLoadTask.isProgramSplit) { | 42 compiler.deferredLoadTask.isProgramSplit) { |
43 if (compiler != null && compiler.hasIncrementalSupport) { | 43 if (compiler != null && compiler.hasIncrementalSupport) { |
44 print('***FLUSH***'); | 44 print('***FLUSH***'); |
45 if (compiler.hasCrashed) { | 45 if (compiler.hasCrashed) { |
46 print('Unable to reuse compiler due to crash.'); | 46 print('Unable to reuse compiler due to crash.'); |
47 } else if (compiler.enqueuer.resolution.hasEnqueuedReflectiveElements) { | 47 } else if (compiler.enqueuer.resolution.hasEnqueuedReflectiveElements) { |
48 print('Unable to reuse compiler due to dart:mirrors.'); | 48 print('Unable to reuse compiler due to dart:mirrors.'); |
49 } else if (compiler.deferredLoadTask.isProgramSplit) { | 49 } else if (compiler.deferredLoadTask.isProgramSplit) { |
50 print('Unable to reuse compiler due to deferred loading.'); | 50 print('Unable to reuse compiler due to deferred loading.'); |
51 } else { | 51 } else { |
52 print('Unable to reuse compiler.'); | 52 print('Unable to reuse compiler.'); |
53 } | 53 } |
54 } | 54 } |
55 oldTag.makeCurrent(); | 55 oldTag.makeCurrent(); |
56 compiler = new Compiler( | 56 compiler = new CompilerImpl( |
57 inputProvider, | 57 inputProvider, |
58 outputProvider, | 58 outputProvider, |
59 diagnosticHandler, | 59 diagnosticHandler, |
60 libraryRoot, | 60 libraryRoot, |
61 packageRoot, | 61 packageRoot, |
62 options, | 62 options, |
63 environment, | 63 environment, |
64 null, | 64 null, |
65 null); | 65 null); |
66 JavaScriptBackend backend = compiler.backend; | 66 JavaScriptBackend backend = compiler.backend; |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 final Map<String, String> output = new Map<String, String>(); | 189 final Map<String, String> output = new Map<String, String>(); |
190 | 190 |
191 EventSink<String> createEventSink(String name, String extension) { | 191 EventSink<String> createEventSink(String name, String extension) { |
192 return new StringEventSink((String data) { | 192 return new StringEventSink((String data) { |
193 output['$name.$extension'] = data; | 193 output['$name.$extension'] = data; |
194 }); | 194 }); |
195 } | 195 } |
196 | 196 |
197 String operator[] (String key) => output[key]; | 197 String operator[] (String key) => output[key]; |
198 } | 198 } |
OLD | NEW |