OLD | NEW |
1 // Copyright (c) 2012, 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 library dart2js; | 5 library dart2js; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:collection' show Queue, LinkedHashMap; | 8 import 'dart:collection' show Queue, LinkedHashMap; |
9 import 'dart:io'; | 9 import 'dart:io'; |
10 import 'dart:uri'; | 10 import 'dart:uri'; |
11 import 'dart:utf'; | 11 import 'dart:utf'; |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 } | 286 } |
287 IOSink output = | 287 IOSink output = |
288 new File(uriPathToNative(uri.path)).openWrite(); | 288 new File(uriPathToNative(uri.path)).openWrite(); |
289 | 289 |
290 CountingSink sink; | 290 CountingSink sink; |
291 | 291 |
292 onDone() { | 292 onDone() { |
293 if (sourceMapFileName != null) { | 293 if (sourceMapFileName != null) { |
294 String sourceMapTag = '//@ sourceMappingURL=$sourceMapFileName\n'; | 294 String sourceMapTag = '//@ sourceMappingURL=$sourceMapFileName\n'; |
295 sink.count += sourceMapTag.length; | 295 sink.count += sourceMapTag.length; |
296 output.addString(sourceMapTag); | 296 output.write(sourceMapTag); |
297 } | 297 } |
298 output.close(); | 298 output.close(); |
299 if (isPrimaryOutput) { | 299 if (isPrimaryOutput) { |
300 charactersWritten += sink.count; | 300 charactersWritten += sink.count; |
301 } | 301 } |
302 } | 302 } |
303 | 303 |
304 var controller = new StreamController<String>(); | 304 var controller = new StreamController<String>(); |
305 controller.stream.listen(output.addString, onDone: onDone); | 305 controller.stream.listen(output.write, onDone: onDone); |
306 sink = new CountingSink(controller); | 306 sink = new CountingSink(controller); |
307 return sink; | 307 return sink; |
308 } | 308 } |
309 | 309 |
310 api.compile(uri, libraryRoot, packageRoot, | 310 api.compile(uri, libraryRoot, packageRoot, |
311 inputProvider.readStringFromUri, handler, | 311 inputProvider.readStringFromUri, handler, |
312 options, outputProvider) | 312 options, outputProvider) |
313 .then(compilationDone); | 313 .then(compilationDone); |
314 } | 314 } |
315 | 315 |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 } catch (ignored) { | 491 } catch (ignored) { |
492 print('Internal error: error while printing exception'); | 492 print('Internal error: error while printing exception'); |
493 } | 493 } |
494 try { | 494 try { |
495 print(trace); | 495 print(trace); |
496 } finally { | 496 } finally { |
497 exit(253); // 253 is recognized as a crash by our test scripts. | 497 exit(253); // 253 is recognized as a crash by our test scripts. |
498 } | 498 } |
499 } | 499 } |
500 } | 500 } |
OLD | NEW |