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

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

Issue 1038213003: Downward inference (Closed) Base URL: git@github.com:dart-lang/dart-dev-compiler.git@master
Patch Set: Implement named arguments, some fixes Created 5 years, 8 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 class JsonUnsupportedObjectError extends Error {final unsupportedObject; 2 class JsonUnsupportedObjectError extends Error {final unsupportedObject;
3 final cause; 3 final cause;
4 JsonUnsupportedObjectError(this.unsupportedObject, { 4 JsonUnsupportedObjectError(this.unsupportedObject, {
5 this.cause} 5 this.cause}
6 ); 6 );
7 String toString() { 7 String toString() {
8 if (cause != null) { 8 if (cause != null) {
9 return "Converting object to an encodable object failed."; 9 return "Converting object to an encodable object failed.";
10 } 10 }
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 if (string.isEmpty) return new Uint8List(0); 94 if (string.isEmpty) return new Uint8List(0);
95 checkAscii: { 95 checkAscii: {
96 for (int i = 0; i < string.length; i++) { 96 for (int i = 0; i < string.length; i++) {
97 if (string.codeUnitAt(i) >= 0x80) break checkAscii; 97 if (string.codeUnitAt(i) >= 0x80) break checkAscii;
98 } 98 }
99 return string.codeUnits; 99 return string.codeUnits;
100 } 100 }
101 return UTF8.encode(string); 101 return UTF8.encode(string);
102 } 102 }
103 List<int> convert(Object object) { 103 List<int> convert(Object object) {
104 List<List<int>> bytes = ((__x15) => DEVC$RT.cast(__x15, DEVC$RT.type((List<dynam ic> _) { 104 List<List<int>> bytes = <List<int>> [];
105 }
106 ), DEVC$RT.type((List<List<int>> _) {
107 }
108 ), "InferableLiteral", """line 338, column 29 of dart:convert/json.dart: """, __ x15 is List<List<int>>, false))([]);
109 void addChunk(Uint8List chunk, int start, int end) { 105 void addChunk(Uint8List chunk, int start, int end) {
110 if (start > 0 || end < chunk.length) { 106 if (start > 0 || end < chunk.length) {
111 int length = end - start; 107 int length = end - start;
112 chunk = new Uint8List.view(chunk.buffer, chunk.offsetInBytes + start, length); 108 chunk = new Uint8List.view(chunk.buffer, chunk.offsetInBytes + start, length);
113 } 109 }
114 bytes.add(chunk); 110 bytes.add(chunk);
115 } 111 }
116 _JsonUtf8Stringifier.stringify(object, _indent, DEVC$RT.cast(_toEncodable, Func tion, __t13, "CompositeCast", """line 352, column 36 of dart:convert/json.dart: """, _toEncodable is __t13, false), _bufferSize, addChunk); 112 _JsonUtf8Stringifier.stringify(object, _indent, DEVC$RT.cast(_toEncodable, Func tion, __t13, "CompositeCast", """line 352, column 36 of dart:convert/json.dart: """, _toEncodable is __t13, false), _bufferSize, addChunk);
117 if (bytes.length == 1) return bytes[0]; 113 if (bytes.length == 1) return bytes[0];
118 int length = 0; 114 int length = 0;
(...skipping 13 matching lines...) Expand all
132 ByteConversionSink byteSink; 128 ByteConversionSink byteSink;
133 if (sink is ByteConversionSink) { 129 if (sink is ByteConversionSink) {
134 byteSink = sink; 130 byteSink = sink;
135 } 131 }
136 else { 132 else {
137 byteSink = new ByteConversionSink.from(sink); 133 byteSink = new ByteConversionSink.from(sink);
138 } 134 }
139 return new _JsonUtf8EncoderSink(byteSink, _toEncodable, _indent, _bufferSize); 135 return new _JsonUtf8EncoderSink(byteSink, _toEncodable, _indent, _bufferSize);
140 } 136 }
141 Stream<List<int>> bind(Stream<Object> stream) { 137 Stream<List<int>> bind(Stream<Object> stream) {
142 return ((__x16) => DEVC$RT.cast(__x16, DEVC$RT.type((DDC$async$.Stream<dynamic> _) { 138 return ((__x15) => DEVC$RT.cast(__x15, DEVC$RT.type((DDC$async$.Stream<dynamic> _) {
143 } 139 }
144 ), DEVC$RT.type((DDC$async$.Stream<List<int>> _) { 140 ), DEVC$RT.type((DDC$async$.Stream<List<int>> _) {
145 } 141 }
146 ), "CompositeCast", """line 391, column 12 of dart:convert/json.dart: """, __x16 is DDC$async$.Stream<List<int>>, false))(super.bind(stream)); 142 ), "CompositeCast", """line 391, column 12 of dart:convert/json.dart: """, __x15 is DDC$async$.Stream<List<int>>, false))(super.bind(stream));
147 } 143 }
148 Converter<Object, dynamic> fuse(Converter<List<int>, dynamic> other) { 144 Converter<Object, dynamic> fuse(Converter<List<int>, dynamic> other) {
149 return super.fuse(other); 145 return super.fuse(other);
150 } 146 }
151 } 147 }
152 class _JsonEncoderSink extends ChunkedConversionSink<Object> {final String _ind ent; 148 class _JsonEncoderSink extends ChunkedConversionSink<Object> {final String _ind ent;
153 final Function _toEncodable; 149 final Function _toEncodable;
154 final StringConversionSink _sink; 150 final StringConversionSink _sink;
155 bool _isDone = false; 151 bool _isDone = false;
156 _JsonEncoderSink(this._sink, this._toEncodable, this._indent); 152 _JsonEncoderSink(this._sink, this._toEncodable, this._indent);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 static const int CHAR_0 = 0x30; 203 static const int CHAR_0 = 0x30;
208 static const int BACKSLASH = 0x5c; 204 static const int BACKSLASH = 0x5c;
209 static const int CHAR_b = 0x62; 205 static const int CHAR_b = 0x62;
210 static const int CHAR_f = 0x66; 206 static const int CHAR_f = 0x66;
211 static const int CHAR_n = 0x6e; 207 static const int CHAR_n = 0x6e;
212 static const int CHAR_r = 0x72; 208 static const int CHAR_r = 0x72;
213 static const int CHAR_t = 0x74; 209 static const int CHAR_t = 0x74;
214 static const int CHAR_u = 0x75; 210 static const int CHAR_u = 0x75;
215 final List _seen = new List(); 211 final List _seen = new List();
216 final Function _toEncodable; 212 final Function _toEncodable;
217 _JsonStringifier(Object _toEncodable(Object o)) : _toEncodable = ((__x17) => DE VC$RT.cast(__x17, dynamic, Function, "DynamicCast", """line 547, column 24 of da rt:convert/json.dart: """, __x17 is Function, true))((_toEncodable != null) ? _t oEncodable : _defaultToEncodable); 213 _JsonStringifier(Object _toEncodable(Object o)) : _toEncodable = ((__x16) => DE VC$RT.cast(__x16, dynamic, Function, "DynamicCast", """line 547, column 24 of da rt:convert/json.dart: """, __x16 is Function, true))((_toEncodable != null) ? _t oEncodable : _defaultToEncodable);
218 void writeString(String characters); 214 void writeString(String characters);
219 void writeStringSlice(String characters, int start, int end); 215 void writeStringSlice(String characters, int start, int end);
220 void writeCharCode(int charCode); 216 void writeCharCode(int charCode);
221 void writeNumber(num number); 217 void writeNumber(num number);
222 static int hexDigit(int x) => x < 10 ? 48 + x : 87 + x; 218 static int hexDigit(int x) => x < 10 ? 48 + x : 87 + x;
223 void writeStringContent(String s) { 219 void writeStringContent(String s) {
224 int offset = 0; 220 int offset = 0;
225 final int length = s.length; 221 final int length = s.length;
226 for (int i = 0; i < length; i++) { 222 for (int i = 0; i < length; i++) {
227 int charCode = s.codeUnitAt(i); 223 int charCode = s.codeUnitAt(i);
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 for (int i = 1; i < list.length; i++) { 333 for (int i = 1; i < list.length; i++) {
338 writeString(','); 334 writeString(',');
339 writeObject(list[i]); 335 writeObject(list[i]);
340 } 336 }
341 } 337 }
342 writeString(']'); 338 writeString(']');
343 } 339 }
344 void writeMap(Map<String, Object> map) { 340 void writeMap(Map<String, Object> map) {
345 writeString('{'); 341 writeString('{');
346 String separator = '"'; 342 String separator = '"';
347 map.forEach(((__x26) => DEVC$RT.wrap((dynamic f(String __u18, dynamic __u19)) { 343 map.forEach(((__x25) => DEVC$RT.wrap((dynamic f(String __u17, dynamic __u18)) {
348 dynamic c(String x0, dynamic x1) => f(x0, x1); 344 dynamic c(String x0, dynamic x1) => f(x0, x1);
349 return f == null ? null : c; 345 return f == null ? null : c;
350 } 346 }
351 , __x26, __t23, __t20, "WrapLiteral", """line 721, column 17 of dart:convert/jso n.dart: """, __x26 is __t20))((String key, value) { 347 , __x25, __t22, __t19, "WrapLiteral", """line 721, column 17 of dart:convert/jso n.dart: """, __x25 is __t19))((String key, value) {
352 writeString(separator); 348 writeString(separator);
353 separator = ',"'; 349 separator = ',"';
354 writeStringContent(key); 350 writeStringContent(key);
355 writeString('":'); 351 writeString('":');
356 writeObject(value); 352 writeObject(value);
357 } 353 }
358 )); 354 ));
359 writeString('}'); 355 writeString('}');
360 } 356 }
361 } 357 }
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 for (int i = 0; i < indentLength; i++) { 551 for (int i = 0; i < indentLength; i++) {
556 writeByte(indent[i]); 552 writeByte(indent[i]);
557 } 553 }
558 } 554 }
559 } 555 }
560 } 556 }
561 } 557 }
562 typedef Object __t7(Object __u8); 558 typedef Object __t7(Object __u8);
563 typedef dynamic __t9(dynamic __u10); 559 typedef dynamic __t9(dynamic __u10);
564 typedef dynamic __t13(Object __u14); 560 typedef dynamic __t13(Object __u14);
565 typedef void __t20(String __u21, Object __u22); 561 typedef void __t19(String __u20, Object __u21);
566 typedef dynamic __t23(String __u24, dynamic __u25); 562 typedef dynamic __t22(String __u23, dynamic __u24);
OLDNEW
« no previous file with comments | « test/dart_codegen/expect/collection/splay_tree.dart ('k') | test/dart_codegen/expect/convert/latin1.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698