| 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 library dart2js.cmdline; | 5 library dart2js.cmdline; |
| 6 | 6 |
| 7 import 'dart:async' show EventSink, Future; | 7 import 'dart:async' show EventSink, Future; |
| 8 import 'dart:convert' show UTF8, LineSplitter; | 8 import 'dart:convert' show UTF8, LineSplitter; |
| 9 import 'dart:io' show exit, File, FileMode, Platform, stdin, stderr; | 9 import 'dart:io' show exit, File, FileMode, Platform, stdin, stderr; |
| 10 | 10 |
| (...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 996 | 996 |
| 997 class _SerializedData { | 997 class _SerializedData { |
| 998 final Uri uri; | 998 final Uri uri; |
| 999 final String data; | 999 final String data; |
| 1000 | 1000 |
| 1001 _SerializedData(this.uri, this.data); | 1001 _SerializedData(this.uri, this.data); |
| 1002 } | 1002 } |
| 1003 | 1003 |
| 1004 class _CompilerOutput extends NullCompilerOutput { | 1004 class _CompilerOutput extends NullCompilerOutput { |
| 1005 final Uri uri; | 1005 final Uri uri; |
| 1006 _BufferedEventSink sink; | 1006 _BufferedOutputSink sink; |
| 1007 | 1007 |
| 1008 _CompilerOutput(this.uri); | 1008 _CompilerOutput(this.uri); |
| 1009 | 1009 |
| 1010 @override | 1010 @override |
| 1011 EventSink<String> createEventSink(String name, String extension) { | 1011 api.OutputSink createOutputSink( |
| 1012 String name, String extension, api.OutputType type) { |
| 1012 if (name == '' && extension == 'data') { | 1013 if (name == '' && extension == 'data') { |
| 1013 return sink = new _BufferedEventSink(); | 1014 return sink = new _BufferedOutputSink(); |
| 1014 } | 1015 } |
| 1015 return super.createEventSink(name, extension); | 1016 return super.createOutputSink(name, extension, type); |
| 1016 } | 1017 } |
| 1017 | 1018 |
| 1018 _SerializedData get serializedData { | 1019 _SerializedData get serializedData { |
| 1019 return new _SerializedData(uri, sink.sb.toString()); | 1020 return new _SerializedData(uri, sink.sb.toString()); |
| 1020 } | 1021 } |
| 1021 } | 1022 } |
| 1022 | 1023 |
| 1023 class _BufferedEventSink implements EventSink<String> { | 1024 class _BufferedOutputSink implements api.OutputSink { |
| 1024 StringBuffer sb = new StringBuffer(); | 1025 StringBuffer sb = new StringBuffer(); |
| 1025 | 1026 |
| 1026 @override | 1027 @override |
| 1027 void add(String event) { | 1028 void add(String event) { |
| 1028 sb.write(event); | 1029 sb.write(event); |
| 1029 } | 1030 } |
| 1030 | 1031 |
| 1031 @override | 1032 @override |
| 1032 void close() { | 1033 void close() { |
| 1033 // Do nothing. | 1034 // Do nothing. |
| 1034 } | 1035 } |
| 1035 | |
| 1036 @override | |
| 1037 void addError(errorEvent, [StackTrace stackTrace]) { | |
| 1038 // Ignore | |
| 1039 } | |
| 1040 } | 1036 } |
| OLD | NEW |