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

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

Issue 1695873002: Add comment to linesplitter.bind. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 months 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 51
52 List<String> convert(String data) => split(data).toList(); 52 List<String> convert(String data) => split(data).toList();
53 53
54 StringConversionSink startChunkedConversion(Sink<String> sink) { 54 StringConversionSink startChunkedConversion(Sink<String> sink) {
55 if (sink is! StringConversionSink) { 55 if (sink is! StringConversionSink) {
56 sink = new StringConversionSink.from(sink); 56 sink = new StringConversionSink.from(sink);
57 } 57 }
58 return new _LineSplitterSink(sink); 58 return new _LineSplitterSink(sink);
59 } 59 }
60 60
61 // Override the base-class' bind, to provide a better type.
61 Stream<String> bind(Stream<String> stream) => super.bind(stream); 62 Stream<String> bind(Stream<String> stream) => super.bind(stream);
62 } 63 }
63 64
64 // TODO(floitsch): deal with utf8. 65 // TODO(floitsch): deal with utf8.
65 class _LineSplitterSink extends StringConversionSinkBase { 66 class _LineSplitterSink extends StringConversionSinkBase {
66 final StringConversionSink _sink; 67 final StringConversionSink _sink;
67 68
68 /// The carry-over from the previous chunk. 69 /// The carry-over from the previous chunk.
69 /// 70 ///
70 /// If the previous slice ended in a line without a line terminator, 71 /// If the previous slice ended in a line without a line terminator,
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 _sink.add(lines.substring(sliceStart, i)); 130 _sink.add(lines.substring(sliceStart, i));
130 sliceStart = i + 1; 131 sliceStart = i + 1;
131 } 132 }
132 if (sliceStart < end) { 133 if (sliceStart < end) {
133 _carry = lines.substring(sliceStart, end); 134 _carry = lines.substring(sliceStart, end);
134 } else { 135 } else {
135 _skipLeadingLF = (char == _CR); 136 _skipLeadingLF = (char == _CR);
136 } 137 }
137 } 138 }
138 } 139 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698