Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: sdk/lib/convert/line_splitter.dart

Issue 2529393002: Make core libraries use generic method syntax. (Closed)
Patch Set: Merge to head Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 part of dart.convert; 5 part of dart.convert;
6 6
7 // Character constants. 7 // Character constants.
8 const int _LF = 10; 8 const int _LF = 10;
9 const int _CR = 13; 9 const int _CR = 13;
10 10
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 return lines; 76 return lines;
77 } 77 }
78 78
79 StringConversionSink startChunkedConversion(Sink<String> sink) { 79 StringConversionSink startChunkedConversion(Sink<String> sink) {
80 if (sink is! StringConversionSink) { 80 if (sink is! StringConversionSink) {
81 sink = new StringConversionSink.from(sink); 81 sink = new StringConversionSink.from(sink);
82 } 82 }
83 return new _LineSplitterSink(sink); 83 return new _LineSplitterSink(sink);
84 } 84 }
85 85
86 Stream/*<String>*/ bind(Stream/*<String>*/ stream) { 86 Stream<String> bind(Stream<String> stream) {
87 return new Stream<String>.eventTransformed( 87 return new Stream<String>.eventTransformed(
88 stream, 88 stream,
89 (EventSink<String> sink) => new _LineSplitterEventSink(sink)); 89 (EventSink<String> sink) => new _LineSplitterEventSink(sink));
90 } 90 }
91 } 91 }
92 92
93 // TODO(floitsch): deal with utf8. 93 // TODO(floitsch): deal with utf8.
94 class _LineSplitterSink extends StringConversionSinkBase { 94 class _LineSplitterSink extends StringConversionSinkBase {
95 final StringConversionSink _sink; 95 final StringConversionSink _sink;
96 96
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 final EventSink<String> _eventSink; 171 final EventSink<String> _eventSink;
172 172
173 _LineSplitterEventSink(EventSink<String> eventSink) 173 _LineSplitterEventSink(EventSink<String> eventSink)
174 : _eventSink = eventSink, 174 : _eventSink = eventSink,
175 super(new StringConversionSink.from(eventSink)); 175 super(new StringConversionSink.from(eventSink));
176 176
177 void addError(Object o, [StackTrace stackTrace]) { 177 void addError(Object o, [StackTrace stackTrace]) {
178 _eventSink.addError(o, stackTrace); 178 _eventSink.addError(o, stackTrace);
179 } 179 }
180 } 180 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698