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

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

Issue 959073002: Fix new line breaks on } (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 9 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 Latin1Codec LATIN1 = const Latin1Codec(); 2 const Latin1Codec LATIN1 = const Latin1Codec();
3 const int _LATIN1_MASK = 0xFF; 3 const int _LATIN1_MASK = 0xFF;
4 class Latin1Codec extends Encoding {final bool _allowInvalid; 4 class Latin1Codec extends Encoding {final bool _allowInvalid;
5 const Latin1Codec({ 5 const Latin1Codec({
6 bool allowInvalid : false} 6 bool allowInvalid : false}
7 ) : _allowInvalid = allowInvalid; 7 ) : _allowInvalid = allowInvalid;
8 String get name => "iso-8859-1"; 8 String get name => "iso-8859-1";
9 String decode(List<int> bytes, { 9 String decode(List<int> bytes, {
10 bool allowInvalid} 10 bool allowInvalid}
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 } 44 }
45 void add(List<int> source) { 45 void add(List<int> source) {
46 addSlice(source, 0, source.length, false); 46 addSlice(source, 0, source.length, false);
47 } 47 }
48 void _addSliceToSink(List<int> source, int start, int end, bool isLast) { 48 void _addSliceToSink(List<int> source, int start, int end, bool isLast) {
49 _sink.add(new String.fromCharCodes(source, start, end)); 49 _sink.add(new String.fromCharCodes(source, start, end));
50 if (isLast) close(); 50 if (isLast) close();
51 } 51 }
52 void addSlice(List<int> source, int start, int end, bool isLast) { 52 void addSlice(List<int> source, int start, int end, bool isLast) {
53 RangeError.checkValidRange(start, end, source.length); 53 RangeError.checkValidRange(start, end, source.length);
54 for (int i = start; 54 for (int i = start; i < end; i++) {
55 i < end;
56 i++) {
57 int char = source[i]; 55 int char = source[i];
58 if (char > _LATIN1_MASK || char < 0) { 56 if (char > _LATIN1_MASK || char < 0) {
59 throw new FormatException("Source contains non-Latin-1 characters."); 57 throw new FormatException("Source contains non-Latin-1 characters.");
60 } 58 }
61 } 59 }
62 if (start < end) { 60 if (start < end) {
63 _addSliceToSink(source, start, end, isLast); 61 _addSliceToSink(source, start, end, isLast);
64 } 62 }
65 if (isLast) { 63 if (isLast) {
66 close(); 64 close();
67 } 65 }
68 } 66 }
69 } 67 }
70 class _Latin1AllowInvalidDecoderSink extends _Latin1DecoderSink {_Latin1AllowIn validDecoderSink(StringConversionSink sink) : super(sink); 68 class _Latin1AllowInvalidDecoderSink extends _Latin1DecoderSink {_Latin1AllowIn validDecoderSink(StringConversionSink sink) : super(sink);
71 void addSlice(List<int> source, int start, int end, bool isLast) { 69 void addSlice(List<int> source, int start, int end, bool isLast) {
72 RangeError.checkValidRange(start, end, source.length); 70 RangeError.checkValidRange(start, end, source.length);
73 for (int i = start; 71 for (int i = start; i < end; i++) {
74 i < end;
75 i++) {
76 int char = source[i]; 72 int char = source[i];
77 if (char > _LATIN1_MASK || char < 0) { 73 if (char > _LATIN1_MASK || char < 0) {
78 if (i > start) _addSliceToSink(source, start, i, false); 74 if (i > start) _addSliceToSink(source, start, i, false);
79 _addSliceToSink(((__x26) => DDC$RT.cast(__x26, DDC$RT.type((List<dynamic> _) { 75 _addSliceToSink(((__x26) => DDC$RT.cast(__x26, DDC$RT.type((List<dynamic> _) {
80 } 76 }
81 ), DDC$RT.type((List<int> _) { 77 ), DDC$RT.type((List<int> _) {
82 } 78 }
83 ), "CastLiteral", """line 161, column 25 of dart:convert/latin1.dart: """, __x26 is List<int>, false))(const [0xFFFD]), 0, 1, false); 79 ), "CastLiteral", """line 161, column 25 of dart:convert/latin1.dart: """, __x26 is List<int>, false))(const [0xFFFD]), 0, 1, false);
84 start = i + 1; 80 start = i + 1;
85 } 81 }
86 } 82 }
87 if (start < end) { 83 if (start < end) {
88 _addSliceToSink(source, start, end, isLast); 84 _addSliceToSink(source, start, end, isLast);
89 } 85 }
90 if (isLast) { 86 if (isLast) {
91 close(); 87 close();
92 } 88 }
93 } 89 }
94 } 90 }
OLDNEW
« no previous file with comments | « test/dart_codegen/expect/convert/json.dart ('k') | test/dart_codegen/expect/convert/string_conversion.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698