| OLD | NEW |
| 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 19 matching lines...) Expand all Loading... |
| 30 ) { | 30 ) { |
| 31 if (reviver == null) reviver = _reviver; | 31 if (reviver == null) reviver = _reviver; |
| 32 if (reviver == null) return decoder.convert(source); | 32 if (reviver == null) return decoder.convert(source); |
| 33 return new JsonDecoder(reviver).convert(source); | 33 return new JsonDecoder(reviver).convert(source); |
| 34 } | 34 } |
| 35 String encode(Object value, { | 35 String encode(Object value, { |
| 36 toEncodable(var object)} | 36 toEncodable(var object)} |
| 37 ) { | 37 ) { |
| 38 if (toEncodable == null) toEncodable = _toEncodable; | 38 if (toEncodable == null) toEncodable = _toEncodable; |
| 39 if (toEncodable == null) return encoder.convert(value); | 39 if (toEncodable == null) return encoder.convert(value); |
| 40 return new JsonEncoder(DEVC$RT.cast(toEncodable, __CastType8, __CastType6, "Com
positeCast", """line 142, column 28 of dart:convert/json.dart: """, toEncodable
is __CastType6, false)).convert(value); | 40 return new JsonEncoder(DEVC$RT.cast(toEncodable, __CastType6, __CastType4, "Com
positeCast", """line 142, column 28 of dart:convert/json.dart: """, toEncodable
is __CastType4, false)).convert(value); |
| 41 } | 41 } |
| 42 JsonEncoder get encoder { | 42 JsonEncoder get encoder { |
| 43 if (_toEncodable == null) return const JsonEncoder(); | 43 if (_toEncodable == null) return const JsonEncoder(); |
| 44 return new JsonEncoder(DEVC$RT.cast(_toEncodable, _ToEncodable, __CastType6, "C
ompositeCast", """line 147, column 28 of dart:convert/json.dart: """, _toEncodab
le is __CastType6, false)); | 44 return new JsonEncoder(DEVC$RT.cast(_toEncodable, _ToEncodable, __CastType4, "C
ompositeCast", """line 147, column 28 of dart:convert/json.dart: """, _toEncodab
le is __CastType4, false)); |
| 45 } | 45 } |
| 46 JsonDecoder get decoder { | 46 JsonDecoder get decoder { |
| 47 if (_reviver == null) return const JsonDecoder(); | 47 if (_reviver == null) return const JsonDecoder(); |
| 48 return new JsonDecoder(_reviver); | 48 return new JsonDecoder(_reviver); |
| 49 } | 49 } |
| 50 } | 50 } |
| 51 class JsonEncoder extends Converter<Object, String> {final String indent; | 51 class JsonEncoder extends Converter<Object, String> {final String indent; |
| 52 final Function _toEncodable; | 52 final Function _toEncodable; |
| 53 const JsonEncoder([Object toEncodable(Object nonSerializable)]) : this.indent =
null, this._toEncodable = toEncodable; | 53 const JsonEncoder([Object toEncodable(Object nonSerializable)]) : this.indent =
null, this._toEncodable = toEncodable; |
| 54 const JsonEncoder.withIndent(this.indent, [Object toEncodable(Object nonSeriali
zable)]) : this._toEncodable = toEncodable; | 54 const JsonEncoder.withIndent(this.indent, [Object toEncodable(Object nonSeriali
zable)]) : this._toEncodable = toEncodable; |
| 55 String convert(Object object) => _JsonStringStringifier.stringify(object, DEVC$
RT.cast(_toEncodable, Function, __CastType8, "ImplicitCast", """line 243, column
48 of dart:convert/json.dart: """, _toEncodable is __CastType8, true), indent); | 55 String convert(Object object) => _JsonStringStringifier.stringify(object, DEVC$
RT.cast(_toEncodable, Function, __CastType6, "ImplicitCast", """line 243, column
48 of dart:convert/json.dart: """, _toEncodable is __CastType6, true), indent); |
| 56 ChunkedConversionSink<Object> startChunkedConversion(Sink<String> sink) { | 56 ChunkedConversionSink<Object> startChunkedConversion(Sink<String> sink) { |
| 57 if (sink is! StringConversionSink) { | 57 if (sink is! StringConversionSink) { |
| 58 sink = new StringConversionSink.from(sink); | 58 sink = new StringConversionSink.from(sink); |
| 59 } | 59 } |
| 60 else if (sink is _Utf8EncoderSink) { | 60 else if (sink is _Utf8EncoderSink) { |
| 61 return new _JsonUtf8EncoderSink(sink._sink, _toEncodable, JsonUtf8Encoder._utf8E
ncode(indent), JsonUtf8Encoder.DEFAULT_BUFFER_SIZE); | 61 return new _JsonUtf8EncoderSink(sink._sink, _toEncodable, JsonUtf8Encoder._utf8E
ncode(indent), JsonUtf8Encoder.DEFAULT_BUFFER_SIZE); |
| 62 } | 62 } |
| 63 return new _JsonEncoderSink(DEVC$RT.cast(sink, DEVC$RT.type((Sink<String> _) { | 63 return new _JsonEncoderSink(DEVC$RT.cast(sink, DEVC$RT.type((Sink<String> _) { |
| 64 } | 64 } |
| 65 ), StringConversionSink, "ImplicitCast", """line 262, column 33 of dart:convert/
json.dart: """, sink is StringConversionSink, true), _toEncodable, indent); | 65 ), StringConversionSink, "ImplicitCast", """line 262, column 33 of dart:convert/
json.dart: """, sink is StringConversionSink, true), _toEncodable, indent); |
| 66 } | 66 } |
| 67 Stream<String> bind(Stream<Object> stream) => ((__x10) => DEVC$RT.cast(__x10, D
EVC$RT.type((DDC$async$.Stream<dynamic> _) { | 67 Stream<String> bind(Stream<Object> stream) => super.bind(stream); |
| 68 } | |
| 69 ), DEVC$RT.type((DDC$async$.Stream<String> _) { | |
| 70 } | |
| 71 ), "CompositeCast", """line 266, column 49 of dart:convert/json.dart: """, __x10
is DDC$async$.Stream<String>, false))(super.bind(stream)); | |
| 72 Converter<Object, dynamic> fuse(Converter<String, dynamic> other) { | 68 Converter<Object, dynamic> fuse(Converter<String, dynamic> other) { |
| 73 if (other is Utf8Encoder) { | 69 if (other is Utf8Encoder) { |
| 74 return new JsonUtf8Encoder(indent, DEVC$RT.cast(_toEncodable, Function, __CastTy
pe11, "CompositeCast", """line 270, column 42 of dart:convert/json.dart: """, _t
oEncodable is __CastType11, false)); | 70 return new JsonUtf8Encoder(indent, DEVC$RT.cast(_toEncodable, Function, __CastTy
pe8, "CompositeCast", """line 270, column 42 of dart:convert/json.dart: """, _to
Encodable is __CastType8, false)); |
| 75 } | 71 } |
| 76 return super.fuse(other); | 72 return super.fuse(other); |
| 77 } | 73 } |
| 78 } | 74 } |
| 79 class JsonUtf8Encoder extends Converter<Object, List<int>> {static const int DE
FAULT_BUFFER_SIZE = 256; | 75 class JsonUtf8Encoder extends Converter<Object, List<int>> {static const int DE
FAULT_BUFFER_SIZE = 256; |
| 80 final List<int> _indent; | 76 final List<int> _indent; |
| 81 final Function _toEncodable; | 77 final Function _toEncodable; |
| 82 final int _bufferSize; | 78 final int _bufferSize; |
| 83 JsonUtf8Encoder([String indent, toEncodable(Object object), int bufferSize = DE
FAULT_BUFFER_SIZE]) : _indent = _utf8Encode(indent), _toEncodable = toEncodable,
_bufferSize = bufferSize; | 79 JsonUtf8Encoder([String indent, toEncodable(Object object), int bufferSize = DE
FAULT_BUFFER_SIZE]) : _indent = _utf8Encode(indent), _toEncodable = toEncodable,
_bufferSize = bufferSize; |
| 84 static List<int> _utf8Encode(String string) { | 80 static List<int> _utf8Encode(String string) { |
| 85 if (string == null) return null; | 81 if (string == null) return null; |
| 86 if (string.isEmpty) return new Uint8List(0); | 82 if (string.isEmpty) return new Uint8List(0); |
| 87 checkAscii: { | 83 checkAscii: { |
| 88 for (int i = 0; i < string.length; i++) { | 84 for (int i = 0; i < string.length; i++) { |
| 89 if (string.codeUnitAt(i) >= 0x80) break checkAscii; | 85 if (string.codeUnitAt(i) >= 0x80) break checkAscii; |
| 90 } | 86 } |
| 91 return string.codeUnits; | 87 return string.codeUnits; |
| 92 } | 88 } |
| 93 return UTF8.encode(string); | 89 return UTF8.encode(string); |
| 94 } | 90 } |
| 95 List<int> convert(Object object) { | 91 List<int> convert(Object object) { |
| 96 List<List<int>> bytes = <List<int>> []; | 92 List<List<int>> bytes = <List<int>> []; |
| 97 void addChunk(Uint8List chunk, int start, int end) { | 93 void addChunk(Uint8List chunk, int start, int end) { |
| 98 if (start > 0 || end < chunk.length) { | 94 if (start > 0 || end < chunk.length) { |
| 99 int length = end - start; | 95 int length = end - start; |
| 100 chunk = new Uint8List.view(chunk.buffer, chunk.offsetInBytes + start, length); | 96 chunk = new Uint8List.view(chunk.buffer, chunk.offsetInBytes + start, length); |
| 101 } | 97 } |
| 102 bytes.add(chunk); | 98 bytes.add(chunk); |
| 103 } | 99 } |
| 104 _JsonUtf8Stringifier.stringify(object, _indent, DEVC$RT.cast(_toEncodable, Func
tion, __CastType11, "CompositeCast", """line 352, column 36 of dart:convert/json
.dart: """, _toEncodable is __CastType11, false), _bufferSize, addChunk); | 100 _JsonUtf8Stringifier.stringify(object, _indent, DEVC$RT.cast(_toEncodable, Func
tion, __CastType8, "CompositeCast", """line 352, column 36 of dart:convert/json.
dart: """, _toEncodable is __CastType8, false), _bufferSize, addChunk); |
| 105 if (bytes.length == 1) return bytes[0]; | 101 if (bytes.length == 1) return bytes[0]; |
| 106 int length = 0; | 102 int length = 0; |
| 107 for (int i = 0; i < bytes.length; i++) { | 103 for (int i = 0; i < bytes.length; i++) { |
| 108 length += bytes[i].length; | 104 length += bytes[i].length; |
| 109 } | 105 } |
| 110 Uint8List result = new Uint8List(length); | 106 Uint8List result = new Uint8List(length); |
| 111 for (int i = 0, offset = 0; i < bytes.length; i++) { | 107 for (int i = 0, offset = 0; i < bytes.length; i++) { |
| 112 var byteList = bytes[i]; | 108 var byteList = bytes[i]; |
| 113 int end = offset + byteList.length; | 109 int end = offset + byteList.length; |
| 114 result.setRange(offset, end, byteList); | 110 result.setRange(offset, end, byteList); |
| 115 offset = end; | 111 offset = end; |
| 116 } | 112 } |
| 117 return result; | 113 return result; |
| 118 } | 114 } |
| 119 ChunkedConversionSink<Object> startChunkedConversion(Sink<List<int>> sink) { | 115 ChunkedConversionSink<Object> startChunkedConversion(Sink<List<int>> sink) { |
| 120 ByteConversionSink byteSink; | 116 ByteConversionSink byteSink; |
| 121 if (sink is ByteConversionSink) { | 117 if (sink is ByteConversionSink) { |
| 122 byteSink = sink; | 118 byteSink = sink; |
| 123 } | 119 } |
| 124 else { | 120 else { |
| 125 byteSink = new ByteConversionSink.from(sink); | 121 byteSink = new ByteConversionSink.from(sink); |
| 126 } | 122 } |
| 127 return new _JsonUtf8EncoderSink(byteSink, _toEncodable, _indent, _bufferSize); | 123 return new _JsonUtf8EncoderSink(byteSink, _toEncodable, _indent, _bufferSize); |
| 128 } | 124 } |
| 129 Stream<List<int>> bind(Stream<Object> stream) { | 125 Stream<List<int>> bind(Stream<Object> stream) { |
| 130 return ((__x13) => DEVC$RT.cast(__x13, DEVC$RT.type((DDC$async$.Stream<dynamic>
_) { | 126 return super.bind(stream); |
| 131 } | |
| 132 ), DEVC$RT.type((DDC$async$.Stream<List<int>> _) { | |
| 133 } | |
| 134 ), "CompositeCast", """line 391, column 12 of dart:convert/json.dart: """, __x13
is DDC$async$.Stream<List<int>>, false))(super.bind(stream)); | |
| 135 } | 127 } |
| 136 Converter<Object, dynamic> fuse(Converter<List<int>, dynamic> other) { | 128 Converter<Object, dynamic> fuse(Converter<List<int>, dynamic> other) { |
| 137 return super.fuse(other); | 129 return super.fuse(other); |
| 138 } | 130 } |
| 139 } | 131 } |
| 140 class _JsonEncoderSink extends ChunkedConversionSink<Object> {final String _ind
ent; | 132 class _JsonEncoderSink extends ChunkedConversionSink<Object> {final String _ind
ent; |
| 141 final Function _toEncodable; | 133 final Function _toEncodable; |
| 142 final StringConversionSink _sink; | 134 final StringConversionSink _sink; |
| 143 bool _isDone = false; | 135 bool _isDone = false; |
| 144 _JsonEncoderSink(this._sink, this._toEncodable, this._indent); | 136 _JsonEncoderSink(this._sink, this._toEncodable, this._indent); |
| 145 void add(Object o) { | 137 void add(Object o) { |
| 146 if (_isDone) { | 138 if (_isDone) { |
| 147 throw new StateError("Only one call to add allowed"); | 139 throw new StateError("Only one call to add allowed"); |
| 148 } | 140 } |
| 149 _isDone = true; | 141 _isDone = true; |
| 150 ClosableStringSink stringSink = _sink.asStringSink(); | 142 ClosableStringSink stringSink = _sink.asStringSink(); |
| 151 _JsonStringStringifier.printOn(o, stringSink, DEVC$RT.cast(_toEncodable, Functi
on, __CastType8, "ImplicitCast", """line 425, column 51 of dart:convert/json.dar
t: """, _toEncodable is __CastType8, true), _indent); | 143 _JsonStringStringifier.printOn(o, stringSink, DEVC$RT.cast(_toEncodable, Functi
on, __CastType6, "ImplicitCast", """line 425, column 51 of dart:convert/json.dar
t: """, _toEncodable is __CastType6, true), _indent); |
| 152 stringSink.close(); | 144 stringSink.close(); |
| 153 } | 145 } |
| 154 void close() { | 146 void close() { |
| 155 } | 147 } |
| 156 } | 148 } |
| 157 class _JsonUtf8EncoderSink extends ChunkedConversionSink<Object> {final ByteCon
versionSink _sink; | 149 class _JsonUtf8EncoderSink extends ChunkedConversionSink<Object> {final ByteCon
versionSink _sink; |
| 158 final List<int> _indent; | 150 final List<int> _indent; |
| 159 final Function _toEncodable; | 151 final Function _toEncodable; |
| 160 final int _bufferSize; | 152 final int _bufferSize; |
| 161 bool _isDone = false; | 153 bool _isDone = false; |
| 162 _JsonUtf8EncoderSink(this._sink, this._toEncodable, this._indent, this._bufferS
ize); | 154 _JsonUtf8EncoderSink(this._sink, this._toEncodable, this._indent, this._bufferS
ize); |
| 163 void _addChunk(Uint8List chunk, int start, int end) { | 155 void _addChunk(Uint8List chunk, int start, int end) { |
| 164 _sink.addSlice(chunk, start, end, false); | 156 _sink.addSlice(chunk, start, end, false); |
| 165 } | 157 } |
| 166 void add(Object object) { | 158 void add(Object object) { |
| 167 if (_isDone) { | 159 if (_isDone) { |
| 168 throw new StateError("Only one call to add allowed"); | 160 throw new StateError("Only one call to add allowed"); |
| 169 } | 161 } |
| 170 _isDone = true; | 162 _isDone = true; |
| 171 _JsonUtf8Stringifier.stringify(object, _indent, DEVC$RT.cast(_toEncodable, Func
tion, __CastType11, "CompositeCast", """line 455, column 53 of dart:convert/json
.dart: """, _toEncodable is __CastType11, false), _bufferSize, _addChunk); | 163 _JsonUtf8Stringifier.stringify(object, _indent, DEVC$RT.cast(_toEncodable, Func
tion, __CastType8, "CompositeCast", """line 455, column 53 of dart:convert/json.
dart: """, _toEncodable is __CastType8, false), _bufferSize, _addChunk); |
| 172 _sink.close(); | 164 _sink.close(); |
| 173 } | 165 } |
| 174 void close() { | 166 void close() { |
| 175 if (!_isDone) { | 167 if (!_isDone) { |
| 176 _isDone = true; | 168 _isDone = true; |
| 177 _sink.close(); | 169 _sink.close(); |
| 178 } | 170 } |
| 179 } | 171 } |
| 180 } | 172 } |
| 181 class JsonDecoder extends Converter<String, Object> {final _Reviver _reviver; | 173 class JsonDecoder extends Converter<String, Object> {final _Reviver _reviver; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 195 static const int CHAR_0 = 0x30; | 187 static const int CHAR_0 = 0x30; |
| 196 static const int BACKSLASH = 0x5c; | 188 static const int BACKSLASH = 0x5c; |
| 197 static const int CHAR_b = 0x62; | 189 static const int CHAR_b = 0x62; |
| 198 static const int CHAR_f = 0x66; | 190 static const int CHAR_f = 0x66; |
| 199 static const int CHAR_n = 0x6e; | 191 static const int CHAR_n = 0x6e; |
| 200 static const int CHAR_r = 0x72; | 192 static const int CHAR_r = 0x72; |
| 201 static const int CHAR_t = 0x74; | 193 static const int CHAR_t = 0x74; |
| 202 static const int CHAR_u = 0x75; | 194 static const int CHAR_u = 0x75; |
| 203 final List _seen = new List(); | 195 final List _seen = new List(); |
| 204 final Function _toEncodable; | 196 final Function _toEncodable; |
| 205 _JsonStringifier(Object _toEncodable(Object o)) : _toEncodable = ((__x14) => DE
VC$RT.cast(__x14, dynamic, Function, "DynamicCast", """line 547, column 24 of da
rt:convert/json.dart: """, __x14 is Function, true))((_toEncodable != null) ? _t
oEncodable : _defaultToEncodable); | 197 _JsonStringifier(Object _toEncodable(Object o)) : _toEncodable = ((__x10) => DE
VC$RT.cast(__x10, dynamic, Function, "DynamicCast", """line 547, column 24 of da
rt:convert/json.dart: """, __x10 is Function, true))((_toEncodable != null) ? _t
oEncodable : _defaultToEncodable); |
| 206 void writeString(String characters); | 198 void writeString(String characters); |
| 207 void writeStringSlice(String characters, int start, int end); | 199 void writeStringSlice(String characters, int start, int end); |
| 208 void writeCharCode(int charCode); | 200 void writeCharCode(int charCode); |
| 209 void writeNumber(num number); | 201 void writeNumber(num number); |
| 210 static int hexDigit(int x) => x < 10 ? 48 + x : 87 + x; | 202 static int hexDigit(int x) => x < 10 ? 48 + x : 87 + x; |
| 211 void writeStringContent(String s) { | 203 void writeStringContent(String s) { |
| 212 int offset = 0; | 204 int offset = 0; |
| 213 final int length = s.length; | 205 final int length = s.length; |
| 214 for (int i = 0; i < length; i++) { | 206 for (int i = 0; i < length; i++) { |
| 215 int charCode = s.codeUnitAt(i); | 207 int charCode = s.codeUnitAt(i); |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 } | 378 } |
| 387 ); | 379 ); |
| 388 writeString('\n'); | 380 writeString('\n'); |
| 389 _indentLevel--; | 381 _indentLevel--; |
| 390 writeIndentation(_indentLevel); | 382 writeIndentation(_indentLevel); |
| 391 writeString('}'); | 383 writeString('}'); |
| 392 } | 384 } |
| 393 } | 385 } |
| 394 } | 386 } |
| 395 class _JsonStringStringifier extends _JsonStringifier {final StringSink _sink; | 387 class _JsonStringStringifier extends _JsonStringifier {final StringSink _sink; |
| 396 _JsonStringStringifier(this._sink, _toEncodable) : super(DEVC$RT.cast(_toEncoda
ble, dynamic, __CastType6, "CompositeCast", """line 798, column 60 of dart:conve
rt/json.dart: """, _toEncodable is __CastType6, false)); | 388 _JsonStringStringifier(this._sink, _toEncodable) : super(DEVC$RT.cast(_toEncoda
ble, dynamic, __CastType4, "CompositeCast", """line 798, column 60 of dart:conve
rt/json.dart: """, _toEncodable is __CastType4, false)); |
| 397 static String stringify(object, toEncodable(object), String indent) { | 389 static String stringify(object, toEncodable(object), String indent) { |
| 398 StringBuffer output = new StringBuffer(); | 390 StringBuffer output = new StringBuffer(); |
| 399 printOn(object, output, toEncodable, indent); | 391 printOn(object, output, toEncodable, indent); |
| 400 return output.toString(); | 392 return output.toString(); |
| 401 } | 393 } |
| 402 static void printOn(object, StringSink output, toEncodable(object), String inde
nt) { | 394 static void printOn(object, StringSink output, toEncodable(object), String inde
nt) { |
| 403 var stringifier; | 395 var stringifier; |
| 404 if (indent == null) { | 396 if (indent == null) { |
| 405 stringifier = new _JsonStringStringifier(output, toEncodable); | 397 stringifier = new _JsonStringStringifier(output, toEncodable); |
| 406 } | 398 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 425 class _JsonStringStringifierPretty extends _JsonStringStringifier with _JsonPre
ttyPrintMixin {final String _indent; | 417 class _JsonStringStringifierPretty extends _JsonStringStringifier with _JsonPre
ttyPrintMixin {final String _indent; |
| 426 _JsonStringStringifierPretty(StringSink sink, Function toEncodable, this._inden
t) : super(sink, toEncodable); | 418 _JsonStringStringifierPretty(StringSink sink, Function toEncodable, this._inden
t) : super(sink, toEncodable); |
| 427 void writeIndentation(int count) { | 419 void writeIndentation(int count) { |
| 428 for (int i = 0; i < count; i++) writeString(_indent); | 420 for (int i = 0; i < count; i++) writeString(_indent); |
| 429 } | 421 } |
| 430 } | 422 } |
| 431 class _JsonUtf8Stringifier extends _JsonStringifier {final int bufferSize; | 423 class _JsonUtf8Stringifier extends _JsonStringifier {final int bufferSize; |
| 432 final Function addChunk; | 424 final Function addChunk; |
| 433 Uint8List buffer; | 425 Uint8List buffer; |
| 434 int index = 0; | 426 int index = 0; |
| 435 _JsonUtf8Stringifier(toEncodable, int bufferSize, this.addChunk) : super(DEVC$R
T.cast(toEncodable, dynamic, __CastType6, "CompositeCast", """line 874, column 1
5 of dart:convert/json.dart: """, toEncodable is __CastType6, false)), this.buff
erSize = bufferSize, buffer = new Uint8List(bufferSize); | 427 _JsonUtf8Stringifier(toEncodable, int bufferSize, this.addChunk) : this.bufferS
ize = bufferSize, buffer = new Uint8List(bufferSize), super(DEVC$RT.cast(toEncod
able, dynamic, __CastType4, "CompositeCast", """line 876, column 15 of dart:conv
ert/json.dart: """, toEncodable is __CastType4, false)); |
| 436 static void stringify(Object object, List<int> indent, toEncodableFunction(Obje
ct o), int bufferSize, void addChunk(Uint8List chunk, int start, int end)) { | 428 static void stringify(Object object, List<int> indent, toEncodableFunction(Obje
ct o), int bufferSize, void addChunk(Uint8List chunk, int start, int end)) { |
| 437 _JsonUtf8Stringifier stringifier; | 429 _JsonUtf8Stringifier stringifier; |
| 438 if (indent != null) { | 430 if (indent != null) { |
| 439 stringifier = new _JsonUtf8StringifierPretty(toEncodableFunction, indent, buffer
Size, addChunk); | 431 stringifier = new _JsonUtf8StringifierPretty(toEncodableFunction, indent, buffer
Size, addChunk); |
| 440 } | 432 } |
| 441 else { | 433 else { |
| 442 stringifier = new _JsonUtf8Stringifier(toEncodableFunction, bufferSize, addChunk
); | 434 stringifier = new _JsonUtf8Stringifier(toEncodableFunction, bufferSize, addChunk
); |
| 443 } | 435 } |
| 444 stringifier.writeObject(object); | 436 stringifier.writeObject(object); |
| 445 stringifier.flush(); | 437 stringifier.flush(); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 void writeByte(int byte) { | 502 void writeByte(int byte) { |
| 511 assert (byte <= 0xff); if (index == buffer.length) { | 503 assert (byte <= 0xff); if (index == buffer.length) { |
| 512 addChunk(buffer, 0, index); | 504 addChunk(buffer, 0, index); |
| 513 buffer = new Uint8List(bufferSize); | 505 buffer = new Uint8List(bufferSize); |
| 514 index = 0; | 506 index = 0; |
| 515 } | 507 } |
| 516 buffer[index++] = byte; | 508 buffer[index++] = byte; |
| 517 } | 509 } |
| 518 } | 510 } |
| 519 class _JsonUtf8StringifierPretty extends _JsonUtf8Stringifier with _JsonPrettyP
rintMixin {final List<int> indent; | 511 class _JsonUtf8StringifierPretty extends _JsonUtf8Stringifier with _JsonPrettyP
rintMixin {final List<int> indent; |
| 520 _JsonUtf8StringifierPretty(toEncodableFunction, this.indent, bufferSize, addChu
nk) : super(toEncodableFunction, DEVC$RT.cast(bufferSize, dynamic, int, "Dynamic
Cast", """line 1012, column 36 of dart:convert/json.dart: """, bufferSize is int
, true), DEVC$RT.cast(addChunk, dynamic, Function, "DynamicCast", """line 1012,
column 48 of dart:convert/json.dart: """, addChunk is Function, true)); | 512 _JsonUtf8StringifierPretty(toEncodableFunction, this.indent, bufferSize, addChu
nk) : super(toEncodableFunction, DEVC$RT.cast(bufferSize, dynamic, int, "Dynamic
Cast", """line 1013, column 36 of dart:convert/json.dart: """, bufferSize is int
, true), DEVC$RT.cast(addChunk, dynamic, Function, "DynamicCast", """line 1013,
column 48 of dart:convert/json.dart: """, addChunk is Function, true)); |
| 521 void writeIndentation(int count) { | 513 void writeIndentation(int count) { |
| 522 List<int> indent = this.indent; | 514 List<int> indent = this.indent; |
| 523 int indentLength = indent.length; | 515 int indentLength = indent.length; |
| 524 if (indentLength == 1) { | 516 if (indentLength == 1) { |
| 525 int char = indent[0]; | 517 int char = indent[0]; |
| 526 while (count > 0) { | 518 while (count > 0) { |
| 527 writeByte(char); | 519 writeByte(char); |
| 528 count -= 1; | 520 count -= 1; |
| 529 } | 521 } |
| 530 return;} | 522 return;} |
| 531 while (count > 0) { | 523 while (count > 0) { |
| 532 count--; | 524 count--; |
| 533 int end = index + indentLength; | 525 int end = index + indentLength; |
| 534 if (end <= buffer.length) { | 526 if (end <= buffer.length) { |
| 535 buffer.setRange(index, end, indent); | 527 buffer.setRange(index, end, indent); |
| 536 index = end; | 528 index = end; |
| 537 } | 529 } |
| 538 else { | 530 else { |
| 539 for (int i = 0; i < indentLength; i++) { | 531 for (int i = 0; i < indentLength; i++) { |
| 540 writeByte(indent[i]); | 532 writeByte(indent[i]); |
| 541 } | 533 } |
| 542 } | 534 } |
| 543 } | 535 } |
| 544 } | 536 } |
| 545 } | 537 } |
| 546 typedef Object __CastType6(Object __u7); | 538 typedef Object __CastType4(Object __u5); |
| 547 typedef dynamic __CastType8(dynamic __u9); | 539 typedef dynamic __CastType6(dynamic __u7); |
| 548 typedef dynamic __CastType11(Object __u12); | 540 typedef dynamic __CastType8(Object __u9); |
| OLD | NEW |