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

Unified Diff: test/dart_codegen/expect/convert/line_splitter.dart

Issue 963593002: Disable formatting and add new-lines to make tests faster. (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
Index: test/dart_codegen/expect/convert/line_splitter.dart
diff --git a/test/dart_codegen/expect/convert/line_splitter.dart b/test/dart_codegen/expect/convert/line_splitter.dart
index a66df2f1d56aff694e350a9a677e7a358c2e7a37..9865d99ca76e20a91d26621e3e9597f0631280c8 100644
--- a/test/dart_codegen/expect/convert/line_splitter.dart
+++ b/test/dart_codegen/expect/convert/line_splitter.dart
@@ -1,71 +1,71 @@
part of dart.convert;
-
-class LineSplitter extends Converter<String, List<String>> {
- const LineSplitter();
- List<String> convert(String data) {
- var lines = new List<String>();
- _LineSplitterSink._addSlice(data, 0, data.length, true, lines.add);
- return lines;
+ class LineSplitter extends Converter<String, List<String>> {const LineSplitter();
+ List<String> convert(String data) {
+ var lines = new List<String>();
+ _LineSplitterSink._addSlice(data, 0, data.length, true, lines.add);
+ return lines;
}
- StringConversionSink startChunkedConversion(Sink<String> sink) {
- if (sink is! StringConversionSink) {
- sink = new StringConversionSink.from(sink);
+ StringConversionSink startChunkedConversion(Sink<String> sink) {
+ if (sink is! StringConversionSink) {
+ sink = new StringConversionSink.from(sink);
}
- return new _LineSplitterSink(sink);
+ return new _LineSplitterSink(sink);
}
}
-class _LineSplitterSink extends StringConversionSinkBase {
- static const int _LF = 10;
- static const int _CR = 13;
- final StringConversionSink _sink;
- String _carry;
- _LineSplitterSink(this._sink);
- void addSlice(String chunk, int start, int end, bool isLast) {
- if (_carry != null) {
- chunk = _carry + chunk.substring(start, end);
- start = 0;
- end = chunk.length;
- _carry = null;
- }
- _carry = _addSlice(chunk, start, end, isLast, _sink.add);
- if (isLast) _sink.close();
- }
- void close() {
- addSlice('', 0, 0, true);
+ class _LineSplitterSink extends StringConversionSinkBase {static const int _LF = 10;
+ static const int _CR = 13;
+ final StringConversionSink _sink;
+ String _carry;
+ _LineSplitterSink(this._sink);
+ void addSlice(String chunk, int start, int end, bool isLast) {
+if (_carry != null) {
+ chunk = _carry + chunk.substring(start, end);
+ start = 0;
+ end = chunk.length;
+ _carry = null;
}
- static String _addSlice(
- String chunk, int start, int end, bool isLast, void adder(String val)) {
- int pos = start;
- while (pos < end) {
- int skip = 0;
- int char = chunk.codeUnitAt(pos);
- if (char == _LF) {
- skip = 1;
- } else if (char == _CR) {
- skip = 1;
- if (pos + 1 < end) {
- if (chunk.codeUnitAt(pos + 1) == _LF) {
- skip = 2;
- }
- } else if (!isLast) {
- return chunk.substring(start, end);
+ _carry = _addSlice(chunk, start, end, isLast, _sink.add);
+ if (isLast) _sink.close();
+}
+ void close() {
+addSlice('', 0, 0, true);
+}
+ static String _addSlice(String chunk, int start, int end, bool isLast, void adder(String val)) {
+int pos = start;
+ while (pos < end) {
+ int skip = 0;
+ int char = chunk.codeUnitAt(pos);
+ if (char == _LF) {
+ skip = 1;
+ }
+ else if (char == _CR) {
+ skip = 1;
+ if (pos + 1 < end) {
+ if (chunk.codeUnitAt(pos + 1) == _LF) {
+ skip = 2;
}
}
- if (skip > 0) {
- adder(chunk.substring(start, pos));
- start = pos = pos + skip;
- } else {
- pos++;
+ else if (!isLast) {
+ return chunk.substring(start, end);
}
}
- if (pos != start) {
- var carry = chunk.substring(start, pos);
- if (isLast) {
- adder(carry);
- } else {
- return carry;
- }
+ if (skip > 0) {
+ adder(chunk.substring(start, pos));
+ start = pos = pos + skip;
+ }
+ else {
+ pos++;
}
- return null;
}
+ if (pos != start) {
+ var carry = chunk.substring(start, pos);
+ if (isLast) {
+ adder(carry);
+ }
+ else {
+ return carry;
+ }
+ }
+ return null;
+}
}

Powered by Google App Engine
This is Rietveld 408576698