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

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

Issue 1021273004: Allow arity checks on dynamic function types (Closed) Base URL: https://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 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 } 53 }
54 JsonDecoder get decoder { 54 JsonDecoder get decoder {
55 if (_reviver == null) return const JsonDecoder(); 55 if (_reviver == null) return const JsonDecoder();
56 return new JsonDecoder(_reviver); 56 return new JsonDecoder(_reviver);
57 } 57 }
58 } 58 }
59 class JsonEncoder extends Converter<Object, String> {final String indent; 59 class JsonEncoder extends Converter<Object, String> {final String indent;
60 final Function _toEncodable; 60 final Function _toEncodable;
61 const JsonEncoder([Object toEncodable(Object nonSerializable)]) : this.indent = null, this._toEncodable = toEncodable; 61 const JsonEncoder([Object toEncodable(Object nonSerializable)]) : this.indent = null, this._toEncodable = toEncodable;
62 const JsonEncoder.withIndent(this.indent, [Object toEncodable(Object nonSeriali zable)]) : this._toEncodable = toEncodable; 62 const JsonEncoder.withIndent(this.indent, [Object toEncodable(Object nonSeriali zable)]) : this._toEncodable = toEncodable;
63 String convert(Object object) => _JsonStringStringifier.stringify(object, DEVC$ RT.cast(_toEncodable, Function, __t9, "CastGeneral", """line 243, column 48 of d art:convert/json.dart: """, _toEncodable is __t9, false), indent); 63 String convert(Object object) => _JsonStringStringifier.stringify(object, DEVC$ RT.cast(_toEncodable, Function, __t9, "CastGeneral", """line 243, column 48 of d art:convert/json.dart: """, _toEncodable is __t9, true), indent);
64 ChunkedConversionSink<Object> startChunkedConversion(Sink<String> sink) { 64 ChunkedConversionSink<Object> startChunkedConversion(Sink<String> sink) {
65 if (sink is! StringConversionSink) { 65 if (sink is! StringConversionSink) {
66 sink = new StringConversionSink.from(sink); 66 sink = new StringConversionSink.from(sink);
67 } 67 }
68 else if (sink is _Utf8EncoderSink) { 68 else if (sink is _Utf8EncoderSink) {
69 return new _JsonUtf8EncoderSink(sink._sink, _toEncodable, JsonUtf8Encoder._utf8E ncode(indent), JsonUtf8Encoder.DEFAULT_BUFFER_SIZE); 69 return new _JsonUtf8EncoderSink(sink._sink, _toEncodable, JsonUtf8Encoder._utf8E ncode(indent), JsonUtf8Encoder.DEFAULT_BUFFER_SIZE);
70 } 70 }
71 return new _JsonEncoderSink(DEVC$RT.cast(sink, DEVC$RT.type((Sink<String> _) { 71 return new _JsonEncoderSink(DEVC$RT.cast(sink, DEVC$RT.type((Sink<String> _) {
72 } 72 }
73 ), StringConversionSink, "CastGeneral", """line 262, column 33 of dart:convert/j son.dart: """, sink is StringConversionSink, true), _toEncodable, indent); 73 ), StringConversionSink, "CastGeneral", """line 262, column 33 of dart:convert/j son.dart: """, sink is StringConversionSink, true), _toEncodable, indent);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 final Function _toEncodable; 153 final Function _toEncodable;
154 final StringConversionSink _sink; 154 final StringConversionSink _sink;
155 bool _isDone = false; 155 bool _isDone = false;
156 _JsonEncoderSink(this._sink, this._toEncodable, this._indent); 156 _JsonEncoderSink(this._sink, this._toEncodable, this._indent);
157 void add(Object o) { 157 void add(Object o) {
158 if (_isDone) { 158 if (_isDone) {
159 throw new StateError("Only one call to add allowed"); 159 throw new StateError("Only one call to add allowed");
160 } 160 }
161 _isDone = true; 161 _isDone = true;
162 ClosableStringSink stringSink = _sink.asStringSink(); 162 ClosableStringSink stringSink = _sink.asStringSink();
163 _JsonStringStringifier.printOn(o, stringSink, DEVC$RT.cast(_toEncodable, Functi on, __t9, "CastGeneral", """line 425, column 51 of dart:convert/json.dart: """, _toEncodable is __t9, false), _indent); 163 _JsonStringStringifier.printOn(o, stringSink, DEVC$RT.cast(_toEncodable, Functi on, __t9, "CastGeneral", """line 425, column 51 of dart:convert/json.dart: """, _toEncodable is __t9, true), _indent);
164 stringSink.close(); 164 stringSink.close();
165 } 165 }
166 void close() { 166 void close() {
167 } 167 }
168 } 168 }
169 class _JsonUtf8EncoderSink extends ChunkedConversionSink<Object> {final ByteCon versionSink _sink; 169 class _JsonUtf8EncoderSink extends ChunkedConversionSink<Object> {final ByteCon versionSink _sink;
170 final List<int> _indent; 170 final List<int> _indent;
171 final Function _toEncodable; 171 final Function _toEncodable;
172 final int _bufferSize; 172 final int _bufferSize;
173 bool _isDone = false; 173 bool _isDone = false;
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 } 561 }
562 } 562 }
563 } 563 }
564 } 564 }
565 } 565 }
566 typedef Object __t7(Object __u8); 566 typedef Object __t7(Object __u8);
567 typedef dynamic __t9(dynamic __u10); 567 typedef dynamic __t9(dynamic __u10);
568 typedef dynamic __t13(Object __u14); 568 typedef dynamic __t13(Object __u14);
569 typedef void __t21(String __u22, Object __u23); 569 typedef void __t21(String __u22, Object __u23);
570 typedef dynamic __t24(String __u25, dynamic __u26); 570 typedef dynamic __t24(String __u25, dynamic __u26);
OLDNEW
« lib/src/checker/rules.dart ('K') | « test/dart_codegen/expect/async/zone.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698