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 EventSink, | 8 EventSink, |
9 Future; | 9 Future; |
10 | 10 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 }); | 143 }); |
144 } | 144 } |
145 | 145 |
146 String allUpdates() { | 146 String allUpdates() { |
147 jsAst.Node updates = jsAst.js.escapedString(_updates.join("")); | 147 jsAst.Node updates = jsAst.js.escapedString(_updates.join("")); |
148 | 148 |
149 JavaScriptBackend backend = _compiler.backend; | 149 JavaScriptBackend backend = _compiler.backend; |
150 | 150 |
151 jsAst.FunctionDeclaration mainRunner = jsAst.js.statement(r""" | 151 jsAst.FunctionDeclaration mainRunner = jsAst.js.statement(r""" |
152 function dartMainRunner(main, args) { | 152 function dartMainRunner(main, args) { |
153 #helper.patch(#updates); | 153 #helper.patch(#updates + "\n//# sourceURL=initial_patch.js\n"); |
154 return main(args); | 154 return main(args); |
155 }""", {'updates': updates, 'helper': backend.namer.accessIncrementalHelper}); | 155 }""", {'updates': updates, 'helper': backend.namer.accessIncrementalHelper}); |
156 | 156 |
157 jsAst.Printer printer = new jsAst.Printer(_compiler, null); | 157 jsAst.Printer printer = new jsAst.Printer(_compiler, null); |
158 printer.blockOutWithoutBraces(mainRunner); | 158 printer.blockOutWithoutBraces(mainRunner); |
159 return printer.outBuffer.getText(); | 159 return printer.outBuffer.getText(); |
160 } | 160 } |
161 } | 161 } |
162 | 162 |
163 class IncrementalCompilationFailed { | 163 class IncrementalCompilationFailed { |
164 final String reason; | 164 final String reason; |
165 | 165 |
166 const IncrementalCompilationFailed(this.reason); | 166 const IncrementalCompilationFailed(this.reason); |
167 | 167 |
168 String toString() => "Can't incrementally compile program.\n\n$reason"; | 168 String toString() => "Can't incrementally compile program.\n\n$reason"; |
169 } | 169 } |
OLD | NEW |