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

Side by Side Diff: test/dart_codegen/expect/convert/ascii.dart

Issue 1112403004: SDK fixes (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Formatting fix Created 5 years, 7 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
OLDNEW
1 part of dart.convert; 1 part of dart.convert;
2 const AsciiCodec ASCII = const AsciiCodec(); 2 const AsciiCodec ASCII = const AsciiCodec();
3 const int _ASCII_MASK = 0x7F; 3 const int _ASCII_MASK = 0x7F;
4 class AsciiCodec extends Encoding {final bool _allowInvalid; 4 class AsciiCodec extends Encoding {final bool _allowInvalid;
5 const AsciiCodec({ 5 const AsciiCodec({
6 bool allowInvalid : false} 6 bool allowInvalid : false}
7 ) : _allowInvalid = allowInvalid; 7 ) : _allowInvalid = allowInvalid;
8 String get name => "us-ascii"; 8 String get name => "us-ascii";
9 String decode(List<int> bytes, { 9 String decode(List<int> bytes, {
10 bool allowInvalid} 10 bool allowInvalid}
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 ), "CompositeCast", """line 96, column 12 of dart:convert/ascii.dart: """, resul t is List<int>, false); 42 ), "CompositeCast", """line 96, column 12 of dart:convert/ascii.dart: """, resul t is List<int>, false);
43 } 43 }
44 StringConversionSink startChunkedConversion(Sink<List<int>> sink) { 44 StringConversionSink startChunkedConversion(Sink<List<int>> sink) {
45 if (sink is! ByteConversionSink) { 45 if (sink is! ByteConversionSink) {
46 sink = new ByteConversionSink.from(sink); 46 sink = new ByteConversionSink.from(sink);
47 } 47 }
48 return new _UnicodeSubsetEncoderSink(_subsetMask, DEVC$RT.cast(sink, DEVC$RT.ty pe((Sink<List<int>> _) { 48 return new _UnicodeSubsetEncoderSink(_subsetMask, DEVC$RT.cast(sink, DEVC$RT.ty pe((Sink<List<int>> _) {
49 } 49 }
50 ), ByteConversionSink, "ImplicitCast", """line 109, column 55 of dart:convert/as cii.dart: """, sink is ByteConversionSink, true)); 50 ), ByteConversionSink, "ImplicitCast", """line 109, column 55 of dart:convert/as cii.dart: """, sink is ByteConversionSink, true));
51 } 51 }
52 Stream<List<int>> bind(Stream<String> stream) => ((__x0) => DEVC$RT.cast(__x0, DEVC$RT.type((DDC$async$.Stream<dynamic> _) { 52 Stream<List<int>> bind(Stream<String> stream) => super.bind(stream);
53 }
54 ), DEVC$RT.type((DDC$async$.Stream<List<int>> _) {
55 }
56 ), "CompositeCast", """line 113, column 52 of dart:convert/ascii.dart: """, __x0 is DDC$async$.Stream<List<int>>, false))(super.bind(stream));
57 } 53 }
58 class AsciiEncoder extends _UnicodeSubsetEncoder {const AsciiEncoder() : super( _ASCII_MASK); 54 class AsciiEncoder extends _UnicodeSubsetEncoder {const AsciiEncoder() : super( _ASCII_MASK);
59 } 55 }
60 class _UnicodeSubsetEncoderSink extends StringConversionSinkBase {final ByteCon versionSink _sink; 56 class _UnicodeSubsetEncoderSink extends StringConversionSinkBase {final ByteCon versionSink _sink;
61 final int _subsetMask; 57 final int _subsetMask;
62 _UnicodeSubsetEncoderSink(this._subsetMask, this._sink); 58 _UnicodeSubsetEncoderSink(this._subsetMask, this._sink);
63 void close() { 59 void close() {
64 _sink.close(); 60 _sink.close();
65 } 61 }
66 void addSlice(String source, int start, int end, bool isLast) { 62 void addSlice(String source, int start, int end, bool isLast) {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 String _convertInvalid(List<int> bytes, int start, int end) { 95 String _convertInvalid(List<int> bytes, int start, int end) {
100 StringBuffer buffer = new StringBuffer(); 96 StringBuffer buffer = new StringBuffer();
101 for (int i = start; i < end; i++) { 97 for (int i = start; i < end; i++) {
102 int value = bytes[i]; 98 int value = bytes[i];
103 if ((value & ~_subsetMask) != 0) value = 0xFFFD; 99 if ((value & ~_subsetMask) != 0) value = 0xFFFD;
104 buffer.writeCharCode(value); 100 buffer.writeCharCode(value);
105 } 101 }
106 return buffer.toString(); 102 return buffer.toString();
107 } 103 }
108 ByteConversionSink startChunkedConversion(Sink<String> sink); 104 ByteConversionSink startChunkedConversion(Sink<String> sink);
109 Stream<String> bind(Stream<List<int>> stream) => ((__x1) => DEVC$RT.cast(__x1, DEVC$RT.type((DDC$async$.Stream<dynamic> _) { 105 Stream<String> bind(Stream<List<int>> stream) => super.bind(stream);
110 }
111 ), DEVC$RT.type((DDC$async$.Stream<String> _) {
112 }
113 ), "CompositeCast", """line 221, column 52 of dart:convert/ascii.dart: """, __x1 is DDC$async$.Stream<String>, false))(super.bind(stream));
114 } 106 }
115 class AsciiDecoder extends _UnicodeSubsetDecoder {const AsciiDecoder({ 107 class AsciiDecoder extends _UnicodeSubsetDecoder {const AsciiDecoder({
116 bool allowInvalid : false} 108 bool allowInvalid : false}
117 ) : super(allowInvalid, _ASCII_MASK); 109 ) : super(allowInvalid, _ASCII_MASK);
118 ByteConversionSink startChunkedConversion(Sink<String> sink) { 110 ByteConversionSink startChunkedConversion(Sink<String> sink) {
119 StringConversionSink stringSink; 111 StringConversionSink stringSink;
120 if (sink is StringConversionSink) { 112 if (sink is StringConversionSink) {
121 stringSink = sink; 113 stringSink = sink;
122 } 114 }
123 else { 115 else {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 RangeError.checkValidRange(start, end, length); 166 RangeError.checkValidRange(start, end, length);
175 if (start < end) { 167 if (start < end) {
176 if (start != 0 || end != length) { 168 if (start != 0 || end != length) {
177 source = source.sublist(start, end); 169 source = source.sublist(start, end);
178 } 170 }
179 add(source); 171 add(source);
180 } 172 }
181 if (isLast) close(); 173 if (isLast) close();
182 } 174 }
183 } 175 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698