| 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<Compiler> reuseCompiler( |
| 10 {DiagnosticHandler diagnosticHandler, | 10 {DiagnosticHandler diagnosticHandler, |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 print('Unable to reuse compiler due to cancel.'); | 49 print('Unable to reuse compiler due to cancel.'); |
| 50 } else if (compiler.enqueuer.resolution.hasEnqueuedReflectiveElements) { | 50 } else if (compiler.enqueuer.resolution.hasEnqueuedReflectiveElements) { |
| 51 print('Unable to reuse compiler due to dart:mirrors.'); | 51 print('Unable to reuse compiler due to dart:mirrors.'); |
| 52 } else if (compiler.deferredLoadTask.isProgramSplit) { | 52 } else if (compiler.deferredLoadTask.isProgramSplit) { |
| 53 print('Unable to reuse compiler due to deferred loading.'); | 53 print('Unable to reuse compiler due to deferred loading.'); |
| 54 } else { | 54 } else { |
| 55 print('Unable to reuse compiler.'); | 55 print('Unable to reuse compiler.'); |
| 56 } | 56 } |
| 57 } | 57 } |
| 58 oldTag.makeCurrent(); | 58 oldTag.makeCurrent(); |
| 59 return new Future.value( | 59 compiler = new Compiler( |
| 60 new Compiler( | 60 inputProvider, |
| 61 inputProvider, | 61 outputProvider, |
| 62 outputProvider, | 62 diagnosticHandler, |
| 63 diagnosticHandler, | 63 libraryRoot, |
| 64 libraryRoot, | 64 packageRoot, |
| 65 packageRoot, | 65 options, |
| 66 options, | 66 environment); |
| 67 environment)); | 67 JavaScriptBackend backend = compiler.backend; |
| 68 // Much like a scout, an incremental compiler is always prepared. For |
| 69 // mixins, at least. |
| 70 backend.emitter.oldEmitter.needsMixinSupport = true; |
| 71 return new Future.value(compiler); |
| 68 } else { | 72 } else { |
| 69 for (final task in compiler.tasks) { | 73 for (final task in compiler.tasks) { |
| 70 if (task.watch != null) { | 74 if (task.watch != null) { |
| 71 task.watch.reset(); | 75 task.watch.reset(); |
| 72 } | 76 } |
| 73 } | 77 } |
| 74 compiler | 78 compiler |
| 75 ..outputProvider = outputProvider | 79 ..outputProvider = outputProvider |
| 76 ..provider = inputProvider | 80 ..provider = inputProvider |
| 77 ..handler = diagnosticHandler | 81 ..handler = diagnosticHandler |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 library.isPlatformLibrary || | 153 library.isPlatformLibrary || |
| 150 (packagesAreImmutable && library.isPackageLibrary)); | 154 (packagesAreImmutable && library.isPackageLibrary)); |
| 151 }; | 155 }; |
| 152 } | 156 } |
| 153 return compiler.libraryLoader.resetAsync(reuseLibrary).then((_) { | 157 return compiler.libraryLoader.resetAsync(reuseLibrary).then((_) { |
| 154 oldTag.makeCurrent(); | 158 oldTag.makeCurrent(); |
| 155 return compiler; | 159 return compiler; |
| 156 }); | 160 }); |
| 157 } | 161 } |
| 158 } | 162 } |
| OLD | NEW |