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 Future; | 8 Future; |
9 | 9 |
10 import 'dart:profiler' show | 10 import 'dart:profiler' show |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 throw new ArgumentError('inputProvider is null.'); | 62 throw new ArgumentError('inputProvider is null.'); |
63 } | 63 } |
64 if (diagnosticHandler == null) { | 64 if (diagnosticHandler == null) { |
65 throw new ArgumentError('diagnosticHandler is null.'); | 65 throw new ArgumentError('diagnosticHandler is null.'); |
66 } | 66 } |
67 } | 67 } |
68 | 68 |
69 Future<bool> compile(Uri script) { | 69 Future<bool> compile(Uri script) { |
70 List<String> options = new List<String>.from(this.options); | 70 List<String> options = new List<String>.from(this.options); |
71 options.addAll(INCREMENTAL_OPTIONS); | 71 options.addAll(INCREMENTAL_OPTIONS); |
72 _compiler = reuseCompiler( | 72 Future<Compiler> future = reuseCompiler( |
73 cachedCompiler: _compiler, | 73 cachedCompiler: _compiler, |
74 libraryRoot: libraryRoot, | 74 libraryRoot: libraryRoot, |
75 packageRoot: packageRoot, | 75 packageRoot: packageRoot, |
76 inputProvider: inputProvider, | 76 inputProvider: inputProvider, |
77 diagnosticHandler: diagnosticHandler, | 77 diagnosticHandler: diagnosticHandler, |
78 options: options, | 78 options: options, |
79 outputProvider: outputProvider, | 79 outputProvider: outputProvider, |
80 environment: environment); | 80 environment: environment); |
81 return _compiler.run(script); | 81 return future.then((Compiler compiler) { |
| 82 _compiler = compiler; |
| 83 return compiler.run(script); |
| 84 }); |
82 } | 85 } |
83 } | 86 } |
OLD | NEW |