| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 throw new ArgumentError('libraryRoot is null.'); | 68 throw new ArgumentError('libraryRoot is null.'); |
| 69 } | 69 } |
| 70 if (inputProvider == null) { | 70 if (inputProvider == null) { |
| 71 throw new ArgumentError('inputProvider is null.'); | 71 throw new ArgumentError('inputProvider is null.'); |
| 72 } | 72 } |
| 73 if (diagnosticHandler == null) { | 73 if (diagnosticHandler == null) { |
| 74 throw new ArgumentError('diagnosticHandler is null.'); | 74 throw new ArgumentError('diagnosticHandler is null.'); |
| 75 } | 75 } |
| 76 } | 76 } |
| 77 | 77 |
| 78 LibraryElement get mainApp => _compiler.mainApp; |
| 79 |
| 80 Compiler get compiler => _compiler; |
| 81 |
| 78 Future<bool> compile(Uri script) { | 82 Future<bool> compile(Uri script) { |
| 79 return _reuseCompiler(null).then((Compiler compiler) { | 83 return _reuseCompiler(null).then((Compiler compiler) { |
| 80 _compiler = compiler; | 84 _compiler = compiler; |
| 81 return compiler.run(script); | 85 return compiler.run(script); |
| 82 }); | 86 }); |
| 83 } | 87 } |
| 84 | 88 |
| 85 Future<Compiler> _reuseCompiler( | 89 Future<Compiler> _reuseCompiler( |
| 86 Future<bool> reuseLibrary(LibraryElement library)) { | 90 Future<bool> reuseLibrary(LibraryElement library)) { |
| 87 List<String> options = this.options == null | 91 List<String> options = this.options == null |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 $dart_unsafe_eval.patch(#); | 144 $dart_unsafe_eval.patch(#); |
| 141 return main(args); | 145 return main(args); |
| 142 }""", updates); | 146 }""", updates); |
| 143 | 147 |
| 144 | 148 |
| 145 jsAst.Printer printer = new jsAst.Printer(_compiler, null); | 149 jsAst.Printer printer = new jsAst.Printer(_compiler, null); |
| 146 printer.blockOutWithoutBraces(mainRunner); | 150 printer.blockOutWithoutBraces(mainRunner); |
| 147 return printer.outBuffer.getText(); | 151 return printer.outBuffer.getText(); |
| 148 } | 152 } |
| 149 } | 153 } |
| OLD | NEW |