| OLD | NEW |
| 1 dart_library.library('dart/convert', null, /* Imports */[ | 1 dart_library.library('dart/convert', null, /* Imports */[ |
| 2 "dart_runtime/dart", | 2 "dart_runtime/dart", |
| 3 'dart/core', | 3 'dart/core', |
| 4 'dart/async', | 4 'dart/async', |
| 5 'dart/typed_data', | 5 'dart/typed_data', |
| 6 'dart/_internal', | 6 'dart/_internal', |
| 7 'dart/collection' | 7 'dart/collection' |
| 8 ], /* Lazy imports */[ | 8 ], /* Lazy imports */[ |
| 9 ], function(exports, dart, core, async, typed_data, _internal, collection) { | 9 ], function(exports, dart, core, async, typed_data, _internal, collection) { |
| 10 'use strict'; | 10 'use strict'; |
| 11 let dartx = dart.dartx; | 11 let dartx = dart.dartx; |
| 12 let Codec$ = dart.generic(function(S, T) { | 12 let Codec$ = dart.generic(function(S, T) { |
| 13 class Codec extends core.Object { | 13 class Codec extends core.Object { |
| 14 Codec() { | 14 Codec() { |
| 15 } | 15 } |
| 16 encode(input) { | 16 encode(input) { |
| 17 dart.as(input, S); | 17 dart.as(input, S); |
| 18 return this.encoder.convert(input); | 18 return dart.dcall(this.encoder.convert, input); |
| 19 } | 19 } |
| 20 decode(encoded) { | 20 decode(encoded) { |
| 21 dart.as(encoded, T); | 21 dart.as(encoded, T); |
| 22 return this.decoder.convert(encoded); | 22 return dart.dcall(this.decoder.convert, encoded); |
| 23 } | 23 } |
| 24 fuse(other) { | 24 fuse(other) { |
| 25 dart.as(other, Codec$(T, dart.dynamic)); | 25 dart.as(other, Codec$(T, dart.dynamic)); |
| 26 return new (_FusedCodec$(S, T, dart.dynamic))(this, other); | 26 return new (_FusedCodec$(S, T, dart.dynamic))(this, other); |
| 27 } | 27 } |
| 28 get inverted() { | 28 get inverted() { |
| 29 return new (_InvertedCodec$(T, S))(this); | 29 return new (_InvertedCodec$(T, S))(this); |
| 30 } | 30 } |
| 31 } | 31 } |
| 32 dart.setSignature(Codec, { | 32 dart.setSignature(Codec, { |
| 33 constructors: () => ({Codec: [Codec$(S, T), []]}), | 33 constructors: () => ({Codec: [Codec$(S, T), []]}), |
| 34 methods: () => ({ | 34 methods: () => ({ |
| 35 encode: [T, [S]], | 35 encode: [T, [S]], |
| 36 decode: [S, [T]], | 36 decode: [S, [T]], |
| 37 fuse: [Codec$(S, dart.dynamic), [Codec$(T, dart.dynamic)]] | 37 fuse: [Codec$(S, dart.dynamic), [Codec$(T, dart.dynamic)]] |
| 38 }) | 38 }) |
| 39 }); | 39 }); |
| 40 return Codec; | 40 return Codec; |
| 41 }); | 41 }); |
| 42 let Codec = Codec$(); | 42 let Codec = Codec$(); |
| 43 class Encoding extends Codec$(core.String, core.List$(core.int)) { | 43 class Encoding extends Codec$(core.String, core.List$(core.int)) { |
| 44 Encoding() { | 44 Encoding() { |
| 45 super.Codec(); | 45 super.Codec(); |
| 46 } | 46 } |
| 47 decodeStream(byteStream) { | 47 decodeStream(byteStream) { |
| 48 return byteStream.transform(this.decoder).fold(new core.StringBuffer(), da
rt.fn((buffer, string) => ((() => { | 48 return dart.as(dart.dcall(dart.dcall(dart.dcall(byteStream.transform, this
.decoder).fold, new core.StringBuffer(), dart.fn((buffer, string) => ((() => { |
| 49 dart.dsend(buffer, 'write', string); | 49 dart.dsend(buffer, 'write', string); |
| 50 return buffer; | 50 return buffer; |
| 51 })()))).then(dart.fn(buffer => dart.toString(buffer), core.String, [dart.d
ynamic])); | 51 })()))).then, dart.fn(buffer => dart.dsend(buffer, 'toString'))), async.Fu
ture$(core.String)); |
| 52 } | 52 } |
| 53 static getByName(name) { | 53 static getByName(name) { |
| 54 if (name == null) | 54 if (name == null) |
| 55 return null; | 55 return null; |
| 56 name = name[dartx.toLowerCase](); | 56 name = dart.dcall(name[dartx.toLowerCase]); |
| 57 return Encoding._nameToEncoding.get(name); | 57 return Encoding._nameToEncoding.get(name); |
| 58 } | 58 } |
| 59 } | 59 } |
| 60 dart.setSignature(Encoding, { | 60 dart.setSignature(Encoding, { |
| 61 constructors: () => ({Encoding: [Encoding, []]}), | 61 constructors: () => ({Encoding: [Encoding, []]}), |
| 62 methods: () => ({decodeStream: [async.Future$(core.String), [async.Stream$(c
ore.List$(core.int))]]}), | 62 methods: () => ({decodeStream: [async.Future$(core.String), [async.Stream$(c
ore.List$(core.int))]]}), |
| 63 statics: () => ({getByName: [Encoding, [core.String]]}), | 63 statics: () => ({getByName: [Encoding, [core.String]]}), |
| 64 names: ['getByName'] | 64 names: ['getByName'] |
| 65 }); | 65 }); |
| 66 let _allowInvalid = Symbol('_allowInvalid'); | 66 let _allowInvalid = Symbol('_allowInvalid'); |
| 67 class AsciiCodec extends Encoding { | 67 class AsciiCodec extends Encoding { |
| 68 AsciiCodec(opts) { | 68 AsciiCodec(opts) { |
| 69 let allowInvalid = opts && 'allowInvalid' in opts ? opts.allowInvalid : fa
lse; | 69 let allowInvalid = opts && 'allowInvalid' in opts ? opts.allowInvalid : fa
lse; |
| 70 this[_allowInvalid] = allowInvalid; | 70 this[_allowInvalid] = allowInvalid; |
| 71 super.Encoding(); | 71 super.Encoding(); |
| 72 } | 72 } |
| 73 get name() { | 73 get name() { |
| 74 return "us-ascii"; | 74 return "us-ascii"; |
| 75 } | 75 } |
| 76 decode(bytes, opts) { | 76 decode(bytes, opts) { |
| 77 let allowInvalid = opts && 'allowInvalid' in opts ? opts.allowInvalid : nu
ll; | 77 let allowInvalid = opts && 'allowInvalid' in opts ? opts.allowInvalid : nu
ll; |
| 78 if (allowInvalid == null) | 78 if (allowInvalid == null) |
| 79 allowInvalid = this[_allowInvalid]; | 79 allowInvalid = this[_allowInvalid]; |
| 80 if (dart.notNull(allowInvalid)) { | 80 if (dart.notNull(allowInvalid)) { |
| 81 return dart.const(new AsciiDecoder({allowInvalid: true})).convert(bytes)
; | 81 return dart.dcall(dart.const(new AsciiDecoder({allowInvalid: true})).con
vert, bytes); |
| 82 } else { | 82 } else { |
| 83 return dart.const(new AsciiDecoder({allowInvalid: false})).convert(bytes
); | 83 return dart.dcall(dart.const(new AsciiDecoder({allowInvalid: false})).co
nvert, bytes); |
| 84 } | 84 } |
| 85 } | 85 } |
| 86 get encoder() { | 86 get encoder() { |
| 87 return dart.const(new AsciiEncoder()); | 87 return dart.const(new AsciiEncoder()); |
| 88 } | 88 } |
| 89 get decoder() { | 89 get decoder() { |
| 90 return dart.notNull(this[_allowInvalid]) ? dart.const(new AsciiDecoder({al
lowInvalid: true})) : dart.const(new AsciiDecoder({allowInvalid: false})); | 90 return dart.notNull(this[_allowInvalid]) ? dart.const(new AsciiDecoder({al
lowInvalid: true})) : dart.const(new AsciiDecoder({allowInvalid: false})); |
| 91 } | 91 } |
| 92 } | 92 } |
| 93 dart.setSignature(AsciiCodec, { | 93 dart.setSignature(AsciiCodec, { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 _UnicodeSubsetEncoder(subsetMask) { | 130 _UnicodeSubsetEncoder(subsetMask) { |
| 131 this[_subsetMask] = subsetMask; | 131 this[_subsetMask] = subsetMask; |
| 132 super.Converter(); | 132 super.Converter(); |
| 133 } | 133 } |
| 134 convert(string, start, end) { | 134 convert(string, start, end) { |
| 135 if (start === void 0) | 135 if (start === void 0) |
| 136 start = 0; | 136 start = 0; |
| 137 if (end === void 0) | 137 if (end === void 0) |
| 138 end = null; | 138 end = null; |
| 139 let stringLength = string[dartx.length]; | 139 let stringLength = string[dartx.length]; |
| 140 core.RangeError.checkValidRange(start, end, stringLength); | 140 dart.dcall(core.RangeError.checkValidRange, start, end, stringLength); |
| 141 if (end == null) | 141 if (end == null) |
| 142 end = stringLength; | 142 end = stringLength; |
| 143 let length = dart.notNull(end) - dart.notNull(start); | 143 let length = dart.notNull(end) - dart.notNull(start); |
| 144 let result = typed_data.Uint8List.new(length); | 144 let result = typed_data.Uint8List.new(length); |
| 145 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull(i
) + 1) { | 145 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull(i
) + 1) { |
| 146 let codeUnit = string[dartx.codeUnitAt](dart.notNull(start) + dart.notNu
ll(i)); | 146 let codeUnit = dart.dcall(string[dartx.codeUnitAt], dart.notNull(start)
+ dart.notNull(i)); |
| 147 if ((dart.notNull(codeUnit) & ~dart.notNull(this[_subsetMask])) != 0) { | 147 if (!dart.equals(dart.dsend(codeUnit, '&', ~dart.notNull(this[_subsetMas
k])), 0)) { |
| 148 dart.throw(new core.ArgumentError("String contains invalid characters.
")); | 148 dart.throw(new core.ArgumentError("String contains invalid characters.
")); |
| 149 } | 149 } |
| 150 result[dartx.set](i, codeUnit); | 150 result[dartx.set](i, codeUnit); |
| 151 } | 151 } |
| 152 return dart.as(result, core.List$(core.int)); | 152 return dart.as(result, core.List$(core.int)); |
| 153 } | 153 } |
| 154 startChunkedConversion(sink) { | 154 startChunkedConversion(sink) { |
| 155 if (!dart.is(sink, ByteConversionSink)) { | 155 if (!dart.is(sink, ByteConversionSink)) { |
| 156 sink = ByteConversionSink.from(sink); | 156 sink = ByteConversionSink.from(sink); |
| 157 } | 157 } |
| 158 return new _UnicodeSubsetEncoderSink(this[_subsetMask], dart.as(sink, Byte
ConversionSink)); | 158 return new _UnicodeSubsetEncoderSink(this[_subsetMask], dart.as(sink, Byte
ConversionSink)); |
| 159 } | 159 } |
| 160 bind(stream) { | 160 bind(stream) { |
| 161 return super.bind(stream); | 161 return dart.dcall(super.bind, stream); |
| 162 } | 162 } |
| 163 } | 163 } |
| 164 dart.setSignature(_UnicodeSubsetEncoder, { | 164 dart.setSignature(_UnicodeSubsetEncoder, { |
| 165 constructors: () => ({_UnicodeSubsetEncoder: [_UnicodeSubsetEncoder, [core.i
nt]]}), | 165 constructors: () => ({_UnicodeSubsetEncoder: [_UnicodeSubsetEncoder, [core.i
nt]]}), |
| 166 methods: () => ({ | 166 methods: () => ({ |
| 167 convert: [core.List$(core.int), [core.String], [core.int, core.int]], | 167 convert: [core.List$(core.int), [core.String], [core.int, core.int]], |
| 168 startChunkedConversion: [StringConversionSink, [core.Sink$(core.List$(core
.int))]], | 168 startChunkedConversion: [StringConversionSink, [core.Sink$(core.List$(core
.int))]], |
| 169 bind: [async.Stream$(core.List$(core.int)), [async.Stream$(core.String)]] | 169 bind: [async.Stream$(core.List$(core.int)), [async.Stream$(core.String)]] |
| 170 }) | 170 }) |
| 171 }); | 171 }); |
| 172 class AsciiEncoder extends _UnicodeSubsetEncoder { | 172 class AsciiEncoder extends _UnicodeSubsetEncoder { |
| 173 AsciiEncoder() { | 173 AsciiEncoder() { |
| 174 super._UnicodeSubsetEncoder(_ASCII_MASK); | 174 super._UnicodeSubsetEncoder(_ASCII_MASK); |
| 175 } | 175 } |
| 176 } | 176 } |
| 177 dart.setSignature(AsciiEncoder, { | 177 dart.setSignature(AsciiEncoder, { |
| 178 constructors: () => ({AsciiEncoder: [AsciiEncoder, []]}) | 178 constructors: () => ({AsciiEncoder: [AsciiEncoder, []]}) |
| 179 }); | 179 }); |
| 180 class StringConversionSinkMixin extends core.Object { | 180 class StringConversionSinkMixin extends core.Object { |
| 181 add(str) { | 181 add(str) { |
| 182 return this.addSlice(str, 0, str[dartx.length], false); | 182 return dart.dcall(this.addSlice, str, 0, str[dartx.length], false); |
| 183 } | 183 } |
| 184 asUtf8Sink(allowMalformed) { | 184 asUtf8Sink(allowMalformed) { |
| 185 return new _Utf8ConversionSink(this, allowMalformed); | 185 return new _Utf8ConversionSink(this, allowMalformed); |
| 186 } | 186 } |
| 187 asStringSink() { | 187 asStringSink() { |
| 188 return new _StringConversionSinkAsStringSinkAdapter(this); | 188 return new _StringConversionSinkAsStringSinkAdapter(this); |
| 189 } | 189 } |
| 190 } | 190 } |
| 191 StringConversionSinkMixin[dart.implements] = () => [StringConversionSink]; | 191 StringConversionSinkMixin[dart.implements] = () => [StringConversionSink]; |
| 192 dart.setSignature(StringConversionSinkMixin, { | 192 dart.setSignature(StringConversionSinkMixin, { |
| 193 methods: () => ({ | 193 methods: () => ({ |
| 194 add: [dart.void, [core.String]], | 194 add: [dart.void, [core.String]], |
| 195 asUtf8Sink: [ByteConversionSink, [core.bool]], | 195 asUtf8Sink: [ByteConversionSink, [core.bool]], |
| 196 asStringSink: [ClosableStringSink, []] | 196 asStringSink: [ClosableStringSink, []] |
| 197 }) | 197 }) |
| 198 }); | 198 }); |
| 199 class StringConversionSinkBase extends StringConversionSinkMixin {} | 199 class StringConversionSinkBase extends StringConversionSinkMixin {} |
| 200 let _sink = Symbol('_sink'); | 200 let _sink = Symbol('_sink'); |
| 201 class _UnicodeSubsetEncoderSink extends StringConversionSinkBase { | 201 class _UnicodeSubsetEncoderSink extends StringConversionSinkBase { |
| 202 _UnicodeSubsetEncoderSink(subsetMask, sink) { | 202 _UnicodeSubsetEncoderSink(subsetMask, sink) { |
| 203 this[_subsetMask] = subsetMask; | 203 this[_subsetMask] = subsetMask; |
| 204 this[_sink] = sink; | 204 this[_sink] = sink; |
| 205 } | 205 } |
| 206 close() { | 206 close() { |
| 207 this[_sink].close(); | 207 dart.dcall(this[_sink].close); |
| 208 } | 208 } |
| 209 addSlice(source, start, end, isLast) { | 209 addSlice(source, start, end, isLast) { |
| 210 core.RangeError.checkValidRange(start, end, source[dartx.length]); | 210 dart.dcall(core.RangeError.checkValidRange, start, end, source[dartx.lengt
h]); |
| 211 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { | 211 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { |
| 212 let codeUnit = source[dartx.codeUnitAt](i); | 212 let codeUnit = dart.dcall(source[dartx.codeUnitAt], i); |
| 213 if ((dart.notNull(codeUnit) & ~dart.notNull(this[_subsetMask])) != 0) { | 213 if ((dart.notNull(codeUnit) & ~dart.notNull(this[_subsetMask])) != 0) { |
| 214 dart.throw(new core.ArgumentError(`Source contains invalid character w
ith code point: ${codeUnit}.`)); | 214 dart.throw(new core.ArgumentError(`Source contains invalid character w
ith code point: ${codeUnit}.`)); |
| 215 } | 215 } |
| 216 } | 216 } |
| 217 this[_sink].add(source[dartx.codeUnits][dartx.sublist](start, end)); | 217 dart.dcall(this[_sink].add, dart.dcall(source[dartx.codeUnits][dartx.subli
st], start, end)); |
| 218 if (dart.notNull(isLast)) { | 218 if (dart.notNull(isLast)) { |
| 219 this.close(); | 219 dart.dcall(this.close); |
| 220 } | 220 } |
| 221 } | 221 } |
| 222 } | 222 } |
| 223 dart.setSignature(_UnicodeSubsetEncoderSink, { | 223 dart.setSignature(_UnicodeSubsetEncoderSink, { |
| 224 constructors: () => ({_UnicodeSubsetEncoderSink: [_UnicodeSubsetEncoderSink,
[core.int, ByteConversionSink]]}), | 224 constructors: () => ({_UnicodeSubsetEncoderSink: [_UnicodeSubsetEncoderSink,
[core.int, ByteConversionSink]]}), |
| 225 methods: () => ({ | 225 methods: () => ({ |
| 226 close: [dart.void, []], | 226 close: [dart.void, []], |
| 227 addSlice: [dart.void, [core.String, core.int, core.int, core.bool]] | 227 addSlice: [dart.void, [core.String, core.int, core.int, core.bool]] |
| 228 }) | 228 }) |
| 229 }); | 229 }); |
| 230 let _convertInvalid = Symbol('_convertInvalid'); | 230 let _convertInvalid = Symbol('_convertInvalid'); |
| 231 class _UnicodeSubsetDecoder extends Converter$(core.List$(core.int), core.Stri
ng) { | 231 class _UnicodeSubsetDecoder extends Converter$(core.List$(core.int), core.Stri
ng) { |
| 232 _UnicodeSubsetDecoder(allowInvalid, subsetMask) { | 232 _UnicodeSubsetDecoder(allowInvalid, subsetMask) { |
| 233 this[_allowInvalid] = allowInvalid; | 233 this[_allowInvalid] = allowInvalid; |
| 234 this[_subsetMask] = subsetMask; | 234 this[_subsetMask] = subsetMask; |
| 235 super.Converter(); | 235 super.Converter(); |
| 236 } | 236 } |
| 237 convert(bytes, start, end) { | 237 convert(bytes, start, end) { |
| 238 if (start === void 0) | 238 if (start === void 0) |
| 239 start = 0; | 239 start = 0; |
| 240 if (end === void 0) | 240 if (end === void 0) |
| 241 end = null; | 241 end = null; |
| 242 let byteCount = bytes[dartx.length]; | 242 let byteCount = bytes[dartx.length]; |
| 243 core.RangeError.checkValidRange(start, end, byteCount); | 243 dart.dcall(core.RangeError.checkValidRange, start, end, byteCount); |
| 244 if (end == null) | 244 if (end == null) |
| 245 end = byteCount; | 245 end = byteCount; |
| 246 let length = dart.notNull(end) - dart.notNull(start); | 246 let length = dart.notNull(end) - dart.notNull(start); |
| 247 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { | 247 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { |
| 248 let byte = bytes[dartx.get](i); | 248 let byte = bytes[dartx.get](i); |
| 249 if ((dart.notNull(byte) & ~dart.notNull(this[_subsetMask])) != 0) { | 249 if ((dart.notNull(byte) & ~dart.notNull(this[_subsetMask])) != 0) { |
| 250 if (!dart.notNull(this[_allowInvalid])) { | 250 if (!dart.notNull(this[_allowInvalid])) { |
| 251 dart.throw(new core.FormatException(`Invalid value in input: ${byte}
`)); | 251 dart.throw(new core.FormatException(`Invalid value in input: ${byte}
`)); |
| 252 } | 252 } |
| 253 return this[_convertInvalid](bytes, start, end); | 253 return dart.dcall(this[_convertInvalid], bytes, start, end); |
| 254 } | 254 } |
| 255 } | 255 } |
| 256 return core.String.fromCharCodes(bytes, start, end); | 256 return core.String.fromCharCodes(bytes, start, end); |
| 257 } | 257 } |
| 258 [_convertInvalid](bytes, start, end) { | 258 [_convertInvalid](bytes, start, end) { |
| 259 let buffer = new core.StringBuffer(); | 259 let buffer = new core.StringBuffer(); |
| 260 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { | 260 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { |
| 261 let value = bytes[dartx.get](i); | 261 let value = bytes[dartx.get](i); |
| 262 if ((dart.notNull(value) & ~dart.notNull(this[_subsetMask])) != 0) | 262 if ((dart.notNull(value) & ~dart.notNull(this[_subsetMask])) != 0) |
| 263 value = 65533; | 263 value = 65533; |
| 264 buffer.writeCharCode(value); | 264 dart.dcall(buffer.writeCharCode, value); |
| 265 } | 265 } |
| 266 return dart.toString(buffer); | 266 return dart.dcall(buffer.toString); |
| 267 } | 267 } |
| 268 bind(stream) { | 268 bind(stream) { |
| 269 return super.bind(stream); | 269 return dart.dcall(super.bind, stream); |
| 270 } | 270 } |
| 271 } | 271 } |
| 272 dart.setSignature(_UnicodeSubsetDecoder, { | 272 dart.setSignature(_UnicodeSubsetDecoder, { |
| 273 constructors: () => ({_UnicodeSubsetDecoder: [_UnicodeSubsetDecoder, [core.b
ool, core.int]]}), | 273 constructors: () => ({_UnicodeSubsetDecoder: [_UnicodeSubsetDecoder, [core.b
ool, core.int]]}), |
| 274 methods: () => ({ | 274 methods: () => ({ |
| 275 convert: [core.String, [core.List$(core.int)], [core.int, core.int]], | 275 convert: [core.String, [core.List$(core.int)], [core.int, core.int]], |
| 276 [_convertInvalid]: [core.String, [core.List$(core.int), core.int, core.int
]], | 276 [_convertInvalid]: [core.String, [core.List$(core.int), core.int, core.int
]], |
| 277 bind: [async.Stream$(core.String), [async.Stream$(core.List$(core.int))]] | 277 bind: [async.Stream$(core.String), [async.Stream$(core.List$(core.int))]] |
| 278 }) | 278 }) |
| 279 }); | 279 }); |
| 280 class AsciiDecoder extends _UnicodeSubsetDecoder { | 280 class AsciiDecoder extends _UnicodeSubsetDecoder { |
| 281 AsciiDecoder(opts) { | 281 AsciiDecoder(opts) { |
| 282 let allowInvalid = opts && 'allowInvalid' in opts ? opts.allowInvalid : fa
lse; | 282 let allowInvalid = opts && 'allowInvalid' in opts ? opts.allowInvalid : fa
lse; |
| 283 super._UnicodeSubsetDecoder(allowInvalid, _ASCII_MASK); | 283 super._UnicodeSubsetDecoder(allowInvalid, _ASCII_MASK); |
| 284 } | 284 } |
| 285 startChunkedConversion(sink) { | 285 startChunkedConversion(sink) { |
| 286 let stringSink = null; | 286 let stringSink = null; |
| 287 if (dart.is(sink, StringConversionSink)) { | 287 if (dart.is(sink, StringConversionSink)) { |
| 288 stringSink = sink; | 288 stringSink = sink; |
| 289 } else { | 289 } else { |
| 290 stringSink = StringConversionSink.from(sink); | 290 stringSink = StringConversionSink.from(sink); |
| 291 } | 291 } |
| 292 if (dart.notNull(this[_allowInvalid])) { | 292 if (dart.notNull(this[_allowInvalid])) { |
| 293 return new _ErrorHandlingAsciiDecoderSink(stringSink.asUtf8Sink(false)); | 293 return new _ErrorHandlingAsciiDecoderSink(dart.dcall(stringSink.asUtf8Si
nk, false)); |
| 294 } else { | 294 } else { |
| 295 return new _SimpleAsciiDecoderSink(stringSink); | 295 return new _SimpleAsciiDecoderSink(stringSink); |
| 296 } | 296 } |
| 297 } | 297 } |
| 298 } | 298 } |
| 299 dart.setSignature(AsciiDecoder, { | 299 dart.setSignature(AsciiDecoder, { |
| 300 constructors: () => ({AsciiDecoder: [AsciiDecoder, [], {allowInvalid: core.b
ool}]}), | 300 constructors: () => ({AsciiDecoder: [AsciiDecoder, [], {allowInvalid: core.b
ool}]}), |
| 301 methods: () => ({startChunkedConversion: [ByteConversionSink, [core.Sink$(co
re.String)]]}) | 301 methods: () => ({startChunkedConversion: [ByteConversionSink, [core.Sink$(co
re.String)]]}) |
| 302 }); | 302 }); |
| 303 let ChunkedConversionSink$ = dart.generic(function(T) { | 303 let ChunkedConversionSink$ = dart.generic(function(T) { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 334 ByteConversionSink: [ByteConversionSink, []], | 334 ByteConversionSink: [ByteConversionSink, []], |
| 335 withCallback: [ByteConversionSink, [dart.functionType(dart.void, [core.Lis
t$(core.int)])]], | 335 withCallback: [ByteConversionSink, [dart.functionType(dart.void, [core.Lis
t$(core.int)])]], |
| 336 from: [ByteConversionSink, [core.Sink$(core.List$(core.int))]] | 336 from: [ByteConversionSink, [core.Sink$(core.List$(core.int))]] |
| 337 }) | 337 }) |
| 338 }); | 338 }); |
| 339 class ByteConversionSinkBase extends ByteConversionSink { | 339 class ByteConversionSinkBase extends ByteConversionSink { |
| 340 ByteConversionSinkBase() { | 340 ByteConversionSinkBase() { |
| 341 super.ByteConversionSink(); | 341 super.ByteConversionSink(); |
| 342 } | 342 } |
| 343 addSlice(chunk, start, end, isLast) { | 343 addSlice(chunk, start, end, isLast) { |
| 344 this.add(chunk[dartx.sublist](start, end)); | 344 dart.dcall(this.add, dart.dcall(chunk[dartx.sublist], start, end)); |
| 345 if (dart.notNull(isLast)) | 345 if (dart.notNull(isLast)) |
| 346 this.close(); | 346 dart.dcall(this.close); |
| 347 } | 347 } |
| 348 } | 348 } |
| 349 dart.setSignature(ByteConversionSinkBase, { | 349 dart.setSignature(ByteConversionSinkBase, { |
| 350 methods: () => ({addSlice: [dart.void, [core.List$(core.int), core.int, core
.int, core.bool]]}) | 350 methods: () => ({addSlice: [dart.void, [core.List$(core.int), core.int, core
.int, core.bool]]}) |
| 351 }); | 351 }); |
| 352 let _utf8Sink = Symbol('_utf8Sink'); | 352 let _utf8Sink = Symbol('_utf8Sink'); |
| 353 class _ErrorHandlingAsciiDecoderSink extends ByteConversionSinkBase { | 353 class _ErrorHandlingAsciiDecoderSink extends ByteConversionSinkBase { |
| 354 _ErrorHandlingAsciiDecoderSink(utf8Sink) { | 354 _ErrorHandlingAsciiDecoderSink(utf8Sink) { |
| 355 this[_utf8Sink] = utf8Sink; | 355 this[_utf8Sink] = utf8Sink; |
| 356 } | 356 } |
| 357 close() { | 357 close() { |
| 358 this[_utf8Sink].close(); | 358 dart.dcall(this[_utf8Sink].close); |
| 359 } | 359 } |
| 360 add(source) { | 360 add(source) { |
| 361 this.addSlice(source, 0, source[dartx.length], false); | 361 dart.dcall(this.addSlice, source, 0, source[dartx.length], false); |
| 362 } | 362 } |
| 363 addSlice(source, start, end, isLast) { | 363 addSlice(source, start, end, isLast) { |
| 364 core.RangeError.checkValidRange(start, end, source[dartx.length]); | 364 dart.dcall(core.RangeError.checkValidRange, start, end, source[dartx.lengt
h]); |
| 365 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { | 365 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { |
| 366 if ((dart.notNull(source[dartx.get](i)) & ~dart.notNull(_ASCII_MASK)) !=
0) { | 366 if ((dart.notNull(source[dartx.get](i)) & ~dart.notNull(_ASCII_MASK)) !=
0) { |
| 367 if (dart.notNull(i) > dart.notNull(start)) | 367 if (dart.notNull(i) > dart.notNull(start)) |
| 368 this[_utf8Sink].addSlice(source, start, i, false); | 368 dart.dcall(this[_utf8Sink].addSlice, source, start, i, false); |
| 369 this[_utf8Sink].add(dart.const(dart.list([239, 191, 189], core.int))); | 369 dart.dcall(this[_utf8Sink].add, dart.const(dart.list([239, 191, 189],
core.int))); |
| 370 start = dart.notNull(i) + 1; | 370 start = dart.notNull(i) + 1; |
| 371 } | 371 } |
| 372 } | 372 } |
| 373 if (dart.notNull(start) < dart.notNull(end)) { | 373 if (dart.notNull(start) < dart.notNull(end)) { |
| 374 this[_utf8Sink].addSlice(source, start, end, isLast); | 374 dart.dcall(this[_utf8Sink].addSlice, source, start, end, isLast); |
| 375 } else if (dart.notNull(isLast)) { | 375 } else if (dart.notNull(isLast)) { |
| 376 this.close(); | 376 dart.dcall(this.close); |
| 377 } | 377 } |
| 378 } | 378 } |
| 379 } | 379 } |
| 380 dart.setSignature(_ErrorHandlingAsciiDecoderSink, { | 380 dart.setSignature(_ErrorHandlingAsciiDecoderSink, { |
| 381 constructors: () => ({_ErrorHandlingAsciiDecoderSink: [_ErrorHandlingAsciiDe
coderSink, [ByteConversionSink]]}), | 381 constructors: () => ({_ErrorHandlingAsciiDecoderSink: [_ErrorHandlingAsciiDe
coderSink, [ByteConversionSink]]}), |
| 382 methods: () => ({ | 382 methods: () => ({ |
| 383 close: [dart.void, []], | 383 close: [dart.void, []], |
| 384 add: [dart.void, [core.List$(core.int)]] | 384 add: [dart.void, [core.List$(core.int)]] |
| 385 }) | 385 }) |
| 386 }); | 386 }); |
| 387 class _SimpleAsciiDecoderSink extends ByteConversionSinkBase { | 387 class _SimpleAsciiDecoderSink extends ByteConversionSinkBase { |
| 388 _SimpleAsciiDecoderSink(sink) { | 388 _SimpleAsciiDecoderSink(sink) { |
| 389 this[_sink] = sink; | 389 this[_sink] = sink; |
| 390 } | 390 } |
| 391 close() { | 391 close() { |
| 392 this[_sink].close(); | 392 dart.dcall(this[_sink].close); |
| 393 } | 393 } |
| 394 add(source) { | 394 add(source) { |
| 395 for (let i = 0; dart.notNull(i) < dart.notNull(source[dartx.length]); i =
dart.notNull(i) + 1) { | 395 for (let i = 0; dart.notNull(i) < dart.notNull(source[dartx.length]); i =
dart.notNull(i) + 1) { |
| 396 if ((dart.notNull(source[dartx.get](i)) & ~dart.notNull(_ASCII_MASK)) !=
0) { | 396 if ((dart.notNull(source[dartx.get](i)) & ~dart.notNull(_ASCII_MASK)) !=
0) { |
| 397 dart.throw(new core.FormatException("Source contains non-ASCII bytes."
)); | 397 dart.throw(new core.FormatException("Source contains non-ASCII bytes."
)); |
| 398 } | 398 } |
| 399 } | 399 } |
| 400 this[_sink].add(core.String.fromCharCodes(source)); | 400 dart.dcall(this[_sink].add, core.String.fromCharCodes(source)); |
| 401 } | 401 } |
| 402 addSlice(source, start, end, isLast) { | 402 addSlice(source, start, end, isLast) { |
| 403 let length = source[dartx.length]; | 403 let length = source[dartx.length]; |
| 404 core.RangeError.checkValidRange(start, end, length); | 404 dart.dcall(core.RangeError.checkValidRange, start, end, length); |
| 405 if (dart.notNull(start) < dart.notNull(end)) { | 405 if (dart.notNull(start) < dart.notNull(end)) { |
| 406 if (start != 0 || end != length) { | 406 if (start != 0 || end != length) { |
| 407 source = source[dartx.sublist](start, end); | 407 source = dart.dcall(source[dartx.sublist], start, end); |
| 408 } | 408 } |
| 409 this.add(source); | 409 dart.dcall(this.add, source); |
| 410 } | 410 } |
| 411 if (dart.notNull(isLast)) | 411 if (dart.notNull(isLast)) |
| 412 this.close(); | 412 dart.dcall(this.close); |
| 413 } | 413 } |
| 414 } | 414 } |
| 415 dart.setSignature(_SimpleAsciiDecoderSink, { | 415 dart.setSignature(_SimpleAsciiDecoderSink, { |
| 416 constructors: () => ({_SimpleAsciiDecoderSink: [_SimpleAsciiDecoderSink, [co
re.Sink]]}), | 416 constructors: () => ({_SimpleAsciiDecoderSink: [_SimpleAsciiDecoderSink, [co
re.Sink]]}), |
| 417 methods: () => ({ | 417 methods: () => ({ |
| 418 close: [dart.void, []], | 418 close: [dart.void, []], |
| 419 add: [dart.void, [core.List$(core.int)]] | 419 add: [dart.void, [core.List$(core.int)]] |
| 420 }) | 420 }) |
| 421 }); | 421 }); |
| 422 class _ByteAdapterSink extends ByteConversionSinkBase { | 422 class _ByteAdapterSink extends ByteConversionSinkBase { |
| 423 _ByteAdapterSink(sink) { | 423 _ByteAdapterSink(sink) { |
| 424 this[_sink] = sink; | 424 this[_sink] = sink; |
| 425 } | 425 } |
| 426 add(chunk) { | 426 add(chunk) { |
| 427 return this[_sink].add(chunk); | 427 return dart.dcall(this[_sink].add, chunk); |
| 428 } | 428 } |
| 429 close() { | 429 close() { |
| 430 return this[_sink].close(); | 430 return dart.dcall(this[_sink].close); |
| 431 } | 431 } |
| 432 } | 432 } |
| 433 dart.setSignature(_ByteAdapterSink, { | 433 dart.setSignature(_ByteAdapterSink, { |
| 434 constructors: () => ({_ByteAdapterSink: [_ByteAdapterSink, [core.Sink$(core.
List$(core.int))]]}), | 434 constructors: () => ({_ByteAdapterSink: [_ByteAdapterSink, [core.Sink$(core.
List$(core.int))]]}), |
| 435 methods: () => ({ | 435 methods: () => ({ |
| 436 add: [dart.void, [core.List$(core.int)]], | 436 add: [dart.void, [core.List$(core.int)]], |
| 437 close: [dart.void, []] | 437 close: [dart.void, []] |
| 438 }) | 438 }) |
| 439 }); | 439 }); |
| 440 let _buffer = Symbol('_buffer'); | 440 let _buffer = Symbol('_buffer'); |
| 441 let _callback = Symbol('_callback'); | 441 let _callback = Symbol('_callback'); |
| 442 let _bufferIndex = Symbol('_bufferIndex'); | 442 let _bufferIndex = Symbol('_bufferIndex'); |
| 443 class _ByteCallbackSink extends ByteConversionSinkBase { | 443 class _ByteCallbackSink extends ByteConversionSinkBase { |
| 444 _ByteCallbackSink(callback) { | 444 _ByteCallbackSink(callback) { |
| 445 this[_buffer] = typed_data.Uint8List.new(_ByteCallbackSink._INITIAL_BUFFER
_SIZE); | 445 this[_buffer] = typed_data.Uint8List.new(dart.as(_ByteCallbackSink._INITIA
L_BUFFER_SIZE, core.int)); |
| 446 this[_callback] = callback; | 446 this[_callback] = callback; |
| 447 this[_bufferIndex] = 0; | 447 this[_bufferIndex] = 0; |
| 448 } | 448 } |
| 449 add(chunk) { | 449 add(chunk) { |
| 450 let freeCount = dart.notNull(this[_buffer][dartx.length]) - dart.notNull(t
his[_bufferIndex]); | 450 let freeCount = dart.notNull(this[_buffer][dartx.length]) - dart.notNull(t
his[_bufferIndex]); |
| 451 if (dart.notNull(chunk[dartx.length]) > dart.notNull(freeCount)) { | 451 if (dart.notNull(chunk[dartx.length]) > dart.notNull(freeCount)) { |
| 452 let oldLength = this[_buffer][dartx.length]; | 452 let oldLength = this[_buffer][dartx.length]; |
| 453 let newLength = dart.notNull(_ByteCallbackSink._roundToPowerOf2(dart.not
Null(chunk[dartx.length]) + dart.notNull(oldLength))) * 2; | 453 let newLength = dart.notNull(dart.dcall(_ByteCallbackSink._roundToPowerO
f2, dart.notNull(chunk[dartx.length]) + dart.notNull(oldLength))) * 2; |
| 454 let grown = typed_data.Uint8List.new(newLength); | 454 let grown = typed_data.Uint8List.new(newLength); |
| 455 grown[dartx.setRange](0, this[_buffer][dartx.length], this[_buffer]); | 455 dart.dcall(grown[dartx.setRange], 0, this[_buffer][dartx.length], this[_
buffer]); |
| 456 this[_buffer] = grown; | 456 this[_buffer] = grown; |
| 457 } | 457 } |
| 458 this[_buffer][dartx.setRange](this[_bufferIndex], dart.notNull(this[_buffe
rIndex]) + dart.notNull(chunk[dartx.length]), chunk); | 458 dart.dcall(this[_buffer][dartx.setRange], this[_bufferIndex], dart.notNull
(this[_bufferIndex]) + dart.notNull(chunk[dartx.length]), chunk); |
| 459 this[_bufferIndex] = dart.notNull(this[_bufferIndex]) + dart.notNull(chunk
[dartx.length]); | 459 this[_bufferIndex] = dart.notNull(this[_bufferIndex]) + dart.notNull(chunk
[dartx.length]); |
| 460 } | 460 } |
| 461 static _roundToPowerOf2(v) { | 461 static _roundToPowerOf2(v) { |
| 462 dart.assert(dart.notNull(v) > 0); | 462 dart.assert(dart.notNull(v) > 0); |
| 463 v = dart.notNull(v) - 1; | 463 v = dart.notNull(v) - 1; |
| 464 v = dart.notNull(v) | dart.notNull(v) >> 1; | 464 v = dart.notNull(v) | dart.notNull(v) >> 1; |
| 465 v = dart.notNull(v) | dart.notNull(v) >> 2; | 465 v = dart.notNull(v) | dart.notNull(v) >> 2; |
| 466 v = dart.notNull(v) | dart.notNull(v) >> 4; | 466 v = dart.notNull(v) | dart.notNull(v) >> 4; |
| 467 v = dart.notNull(v) | dart.notNull(v) >> 8; | 467 v = dart.notNull(v) | dart.notNull(v) >> 8; |
| 468 v = dart.notNull(v) | dart.notNull(v) >> 16; | 468 v = dart.notNull(v) | dart.notNull(v) >> 16; |
| 469 v = dart.notNull(v) + 1; | 469 v = dart.notNull(v) + 1; |
| 470 return v; | 470 return v; |
| 471 } | 471 } |
| 472 close() { | 472 close() { |
| 473 this[_callback](this[_buffer][dartx.sublist](0, this[_bufferIndex])); | 473 dart.dcall(this[_callback], dart.dcall(this[_buffer][dartx.sublist], 0, th
is[_bufferIndex])); |
| 474 } | 474 } |
| 475 } | 475 } |
| 476 dart.setSignature(_ByteCallbackSink, { | 476 dart.setSignature(_ByteCallbackSink, { |
| 477 constructors: () => ({_ByteCallbackSink: [_ByteCallbackSink, [dart.functionT
ype(dart.void, [core.List$(core.int)])]]}), | 477 constructors: () => ({_ByteCallbackSink: [_ByteCallbackSink, [dart.functionT
ype(dart.void, [core.List$(core.int)])]]}), |
| 478 methods: () => ({ | 478 methods: () => ({ |
| 479 add: [dart.void, [core.Iterable$(core.int)]], | 479 add: [dart.void, [core.Iterable$(core.int)]], |
| 480 close: [dart.void, []] | 480 close: [dart.void, []] |
| 481 }), | 481 }), |
| 482 statics: () => ({_roundToPowerOf2: [core.int, [core.int]]}), | 482 statics: () => ({_roundToPowerOf2: [core.int, [core.int]]}), |
| 483 names: ['_roundToPowerOf2'] | 483 names: ['_roundToPowerOf2'] |
| 484 }); | 484 }); |
| 485 _ByteCallbackSink._INITIAL_BUFFER_SIZE = 1024; | 485 _ByteCallbackSink._INITIAL_BUFFER_SIZE = 1024; |
| 486 let _ChunkedConversionCallback$ = dart.generic(function(T) { | 486 let _ChunkedConversionCallback$ = dart.generic(function(T) { |
| 487 let _ChunkedConversionCallback = dart.typedef('_ChunkedConversionCallback',
() => dart.functionType(dart.void, [T])); | 487 let _ChunkedConversionCallback = dart.typedef('_ChunkedConversionCallback',
() => dart.functionType(dart.void, [T])); |
| 488 return _ChunkedConversionCallback; | 488 return _ChunkedConversionCallback; |
| 489 }); | 489 }); |
| 490 let _ChunkedConversionCallback = _ChunkedConversionCallback$(); | 490 let _ChunkedConversionCallback = _ChunkedConversionCallback$(); |
| 491 let _accumulated = Symbol('_accumulated'); | 491 let _accumulated = Symbol('_accumulated'); |
| 492 let _SimpleCallbackSink$ = dart.generic(function(T) { | 492 let _SimpleCallbackSink$ = dart.generic(function(T) { |
| 493 class _SimpleCallbackSink extends ChunkedConversionSink$(T) { | 493 class _SimpleCallbackSink extends ChunkedConversionSink$(T) { |
| 494 _SimpleCallbackSink(callback) { | 494 _SimpleCallbackSink(callback) { |
| 495 this[_accumulated] = dart.list([], T); | 495 this[_accumulated] = dart.list([], T); |
| 496 this[_callback] = callback; | 496 this[_callback] = callback; |
| 497 super.ChunkedConversionSink(); | 497 super.ChunkedConversionSink(); |
| 498 } | 498 } |
| 499 add(chunk) { | 499 add(chunk) { |
| 500 dart.as(chunk, T); | 500 dart.as(chunk, T); |
| 501 this[_accumulated][dartx.add](chunk); | 501 dart.dcall(this[_accumulated][dartx.add], chunk); |
| 502 } | 502 } |
| 503 close() { | 503 close() { |
| 504 this[_callback](this[_accumulated]); | 504 dart.dcall(this[_callback], this[_accumulated]); |
| 505 } | 505 } |
| 506 } | 506 } |
| 507 dart.setSignature(_SimpleCallbackSink, { | 507 dart.setSignature(_SimpleCallbackSink, { |
| 508 constructors: () => ({_SimpleCallbackSink: [_SimpleCallbackSink$(T), [_Chu
nkedConversionCallback$(core.List$(T))]]}), | 508 constructors: () => ({_SimpleCallbackSink: [_SimpleCallbackSink$(T), [_Chu
nkedConversionCallback$(core.List$(T))]]}), |
| 509 methods: () => ({ | 509 methods: () => ({ |
| 510 add: [dart.void, [T]], | 510 add: [dart.void, [T]], |
| 511 close: [dart.void, []] | 511 close: [dart.void, []] |
| 512 }) | 512 }) |
| 513 }); | 513 }); |
| 514 return _SimpleCallbackSink; | 514 return _SimpleCallbackSink; |
| 515 }); | 515 }); |
| 516 let _SimpleCallbackSink = _SimpleCallbackSink$(); | 516 let _SimpleCallbackSink = _SimpleCallbackSink$(); |
| 517 let _EventSinkAdapter$ = dart.generic(function(T) { | 517 let _EventSinkAdapter$ = dart.generic(function(T) { |
| 518 class _EventSinkAdapter extends core.Object { | 518 class _EventSinkAdapter extends core.Object { |
| 519 _EventSinkAdapter(sink) { | 519 _EventSinkAdapter(sink) { |
| 520 this[_sink] = sink; | 520 this[_sink] = sink; |
| 521 } | 521 } |
| 522 add(data) { | 522 add(data) { |
| 523 dart.as(data, T); | 523 dart.as(data, T); |
| 524 return this[_sink].add(data); | 524 return dart.dcall(this[_sink].add, data); |
| 525 } | 525 } |
| 526 close() { | 526 close() { |
| 527 return this[_sink].close(); | 527 return dart.dcall(this[_sink].close); |
| 528 } | 528 } |
| 529 } | 529 } |
| 530 _EventSinkAdapter[dart.implements] = () => [ChunkedConversionSink$(T)]; | 530 _EventSinkAdapter[dart.implements] = () => [ChunkedConversionSink$(T)]; |
| 531 dart.setSignature(_EventSinkAdapter, { | 531 dart.setSignature(_EventSinkAdapter, { |
| 532 constructors: () => ({_EventSinkAdapter: [_EventSinkAdapter$(T), [async.Ev
entSink$(T)]]}), | 532 constructors: () => ({_EventSinkAdapter: [_EventSinkAdapter$(T), [async.Ev
entSink$(T)]]}), |
| 533 methods: () => ({ | 533 methods: () => ({ |
| 534 add: [dart.void, [T]], | 534 add: [dart.void, [T]], |
| 535 close: [dart.void, []] | 535 close: [dart.void, []] |
| 536 }) | 536 }) |
| 537 }); | 537 }); |
| 538 return _EventSinkAdapter; | 538 return _EventSinkAdapter; |
| 539 }); | 539 }); |
| 540 let _EventSinkAdapter = _EventSinkAdapter$(); | 540 let _EventSinkAdapter = _EventSinkAdapter$(); |
| 541 let _eventSink = Symbol('_eventSink'); | 541 let _eventSink = Symbol('_eventSink'); |
| 542 let _chunkedSink = Symbol('_chunkedSink'); | 542 let _chunkedSink = Symbol('_chunkedSink'); |
| 543 let _ConverterStreamEventSink$ = dart.generic(function(S, T) { | 543 let _ConverterStreamEventSink$ = dart.generic(function(S, T) { |
| 544 class _ConverterStreamEventSink extends core.Object { | 544 class _ConverterStreamEventSink extends core.Object { |
| 545 _ConverterStreamEventSink(converter, sink) { | 545 _ConverterStreamEventSink(converter, sink) { |
| 546 this[_eventSink] = sink; | 546 this[_eventSink] = sink; |
| 547 this[_chunkedSink] = converter.startChunkedConversion(sink); | 547 this[_chunkedSink] = dart.dcall(converter.startChunkedConversion, sink); |
| 548 } | 548 } |
| 549 add(o) { | 549 add(o) { |
| 550 dart.as(o, S); | 550 dart.as(o, S); |
| 551 return this[_chunkedSink].add(o); | 551 return dart.dcall(this[_chunkedSink].add, o); |
| 552 } | 552 } |
| 553 addError(error, stackTrace) { | 553 addError(error, stackTrace) { |
| 554 if (stackTrace === void 0) | 554 if (stackTrace === void 0) |
| 555 stackTrace = null; | 555 stackTrace = null; |
| 556 this[_eventSink].addError(error, stackTrace); | 556 dart.dcall(this[_eventSink].addError, error, stackTrace); |
| 557 } | 557 } |
| 558 close() { | 558 close() { |
| 559 return this[_chunkedSink].close(); | 559 return dart.dcall(this[_chunkedSink].close); |
| 560 } | 560 } |
| 561 } | 561 } |
| 562 _ConverterStreamEventSink[dart.implements] = () => [async.EventSink$(S)]; | 562 _ConverterStreamEventSink[dart.implements] = () => [async.EventSink$(S)]; |
| 563 dart.setSignature(_ConverterStreamEventSink, { | 563 dart.setSignature(_ConverterStreamEventSink, { |
| 564 constructors: () => ({_ConverterStreamEventSink: [_ConverterStreamEventSin
k$(S, T), [Converter, async.EventSink$(T)]]}), | 564 constructors: () => ({_ConverterStreamEventSink: [_ConverterStreamEventSin
k$(S, T), [Converter, async.EventSink$(T)]]}), |
| 565 methods: () => ({ | 565 methods: () => ({ |
| 566 add: [dart.void, [S]], | 566 add: [dart.void, [S]], |
| 567 addError: [dart.void, [core.Object], [core.StackTrace]], | 567 addError: [dart.void, [core.Object], [core.StackTrace]], |
| 568 close: [dart.void, []] | 568 close: [dart.void, []] |
| 569 }) | 569 }) |
| 570 }); | 570 }); |
| 571 return _ConverterStreamEventSink; | 571 return _ConverterStreamEventSink; |
| 572 }); | 572 }); |
| 573 let _ConverterStreamEventSink = _ConverterStreamEventSink$(); | 573 let _ConverterStreamEventSink = _ConverterStreamEventSink$(); |
| 574 let _first = Symbol('_first'); | 574 let _first = Symbol('_first'); |
| 575 let _second = Symbol('_second'); | 575 let _second = Symbol('_second'); |
| 576 let _FusedCodec$ = dart.generic(function(S, M, T) { | 576 let _FusedCodec$ = dart.generic(function(S, M, T) { |
| 577 class _FusedCodec extends Codec$(S, T) { | 577 class _FusedCodec extends Codec$(S, T) { |
| 578 get encoder() { | 578 get encoder() { |
| 579 return dart.as(this[_first].encoder.fuse(this[_second].encoder), Convert
er$(S, T)); | 579 return dart.as(dart.dcall(this[_first].encoder.fuse, this[_second].encod
er), Converter$(S, T)); |
| 580 } | 580 } |
| 581 get decoder() { | 581 get decoder() { |
| 582 return dart.as(this[_second].decoder.fuse(this[_first].decoder), Convert
er$(T, S)); | 582 return dart.as(dart.dcall(this[_second].decoder.fuse, this[_first].decod
er), Converter$(T, S)); |
| 583 } | 583 } |
| 584 _FusedCodec(first, second) { | 584 _FusedCodec(first, second) { |
| 585 this[_first] = first; | 585 this[_first] = first; |
| 586 this[_second] = second; | 586 this[_second] = second; |
| 587 super.Codec(); | 587 super.Codec(); |
| 588 } | 588 } |
| 589 } | 589 } |
| 590 dart.setSignature(_FusedCodec, { | 590 dart.setSignature(_FusedCodec, { |
| 591 constructors: () => ({_FusedCodec: [_FusedCodec$(S, M, T), [Codec$(S, M),
Codec$(M, T)]]}) | 591 constructors: () => ({_FusedCodec: [_FusedCodec$(S, M, T), [Codec$(S, M),
Codec$(M, T)]]}) |
| 592 }); | 592 }); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 618 let _InvertedCodec = _InvertedCodec$(); | 618 let _InvertedCodec = _InvertedCodec$(); |
| 619 let _FusedConverter$ = dart.generic(function(S, M, T) { | 619 let _FusedConverter$ = dart.generic(function(S, M, T) { |
| 620 class _FusedConverter extends Converter$(S, T) { | 620 class _FusedConverter extends Converter$(S, T) { |
| 621 _FusedConverter(first, second) { | 621 _FusedConverter(first, second) { |
| 622 this[_first] = first; | 622 this[_first] = first; |
| 623 this[_second] = second; | 623 this[_second] = second; |
| 624 super.Converter(); | 624 super.Converter(); |
| 625 } | 625 } |
| 626 convert(input) { | 626 convert(input) { |
| 627 dart.as(input, S); | 627 dart.as(input, S); |
| 628 return dart.as(this[_second].convert(this[_first].convert(input)), T); | 628 return dart.as(dart.dcall(this[_second].convert, dart.dcall(this[_first]
.convert, input)), T); |
| 629 } | 629 } |
| 630 startChunkedConversion(sink) { | 630 startChunkedConversion(sink) { |
| 631 dart.as(sink, core.Sink$(T)); | 631 dart.as(sink, core.Sink$(T)); |
| 632 return this[_first].startChunkedConversion(this[_second].startChunkedCon
version(sink)); | 632 return dart.dcall(this[_first].startChunkedConversion, dart.dcall(this[_
second].startChunkedConversion, sink)); |
| 633 } | 633 } |
| 634 } | 634 } |
| 635 dart.setSignature(_FusedConverter, { | 635 dart.setSignature(_FusedConverter, { |
| 636 constructors: () => ({_FusedConverter: [_FusedConverter$(S, M, T), [Conver
ter, Converter]]}), | 636 constructors: () => ({_FusedConverter: [_FusedConverter$(S, M, T), [Conver
ter, Converter]]}), |
| 637 methods: () => ({ | 637 methods: () => ({ |
| 638 convert: [T, [S]], | 638 convert: [T, [S]], |
| 639 startChunkedConversion: [ChunkedConversionSink, [core.Sink$(T)]] | 639 startChunkedConversion: [ChunkedConversionSink, [core.Sink$(T)]] |
| 640 }) | 640 }) |
| 641 }); | 641 }); |
| 642 return _FusedConverter; | 642 return _FusedConverter; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 668 HtmlEscapeMode.UNKNOWN = dart.const(new HtmlEscapeMode._('unknown', true, true
, true, true)); | 668 HtmlEscapeMode.UNKNOWN = dart.const(new HtmlEscapeMode._('unknown', true, true
, true, true)); |
| 669 let _convert = Symbol('_convert'); | 669 let _convert = Symbol('_convert'); |
| 670 class HtmlEscape extends Converter$(core.String, core.String) { | 670 class HtmlEscape extends Converter$(core.String, core.String) { |
| 671 HtmlEscape(mode) { | 671 HtmlEscape(mode) { |
| 672 if (mode === void 0) | 672 if (mode === void 0) |
| 673 mode = HtmlEscapeMode.UNKNOWN; | 673 mode = HtmlEscapeMode.UNKNOWN; |
| 674 this.mode = mode; | 674 this.mode = mode; |
| 675 super.Converter(); | 675 super.Converter(); |
| 676 } | 676 } |
| 677 convert(text) { | 677 convert(text) { |
| 678 let val = this[_convert](text, 0, text[dartx.length]); | 678 let val = dart.dcall(this[_convert], text, 0, text[dartx.length]); |
| 679 return val == null ? text : val; | 679 return val == null ? text : dart.as(val, core.String); |
| 680 } | 680 } |
| 681 [_convert](text, start, end) { | 681 [_convert](text, start, end) { |
| 682 let result = null; | 682 let result = null; |
| 683 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { | 683 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { |
| 684 let ch = text[dartx.get](i); | 684 let ch = text[dartx.get](i); |
| 685 let replace = null; | 685 let replace = null; |
| 686 switch (ch) { | 686 switch (ch) { |
| 687 case '&': | 687 case '&': |
| 688 { | 688 { |
| 689 replace = '&'; | 689 replace = '&'; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 720 } | 720 } |
| 721 case '/': | 721 case '/': |
| 722 { | 722 { |
| 723 if (dart.notNull(this.mode.escapeSlash)) | 723 if (dart.notNull(this.mode.escapeSlash)) |
| 724 replace = '/'; | 724 replace = '/'; |
| 725 break; | 725 break; |
| 726 } | 726 } |
| 727 } | 727 } |
| 728 if (replace != null) { | 728 if (replace != null) { |
| 729 if (result == null) | 729 if (result == null) |
| 730 result = new core.StringBuffer(text[dartx.substring](start, i)); | 730 result = new core.StringBuffer(dart.dcall(text[dartx.substring], sta
rt, i)); |
| 731 result.write(replace); | 731 dart.dcall(result.write, replace); |
| 732 } else if (result != null) { | 732 } else if (result != null) { |
| 733 result.write(ch); | 733 dart.dcall(result.write, ch); |
| 734 } | 734 } |
| 735 } | 735 } |
| 736 return result != null ? dart.toString(result) : null; | 736 return result != null ? dart.dcall(result.toString) : null; |
| 737 } | 737 } |
| 738 startChunkedConversion(sink) { | 738 startChunkedConversion(sink) { |
| 739 if (!dart.is(sink, StringConversionSink)) { | 739 if (!dart.is(sink, StringConversionSink)) { |
| 740 sink = StringConversionSink.from(sink); | 740 sink = StringConversionSink.from(sink); |
| 741 } | 741 } |
| 742 return new _HtmlEscapeSink(this, dart.as(sink, StringConversionSink)); | 742 return new _HtmlEscapeSink(this, dart.as(sink, StringConversionSink)); |
| 743 } | 743 } |
| 744 } | 744 } |
| 745 dart.setSignature(HtmlEscape, { | 745 dart.setSignature(HtmlEscape, { |
| 746 constructors: () => ({HtmlEscape: [HtmlEscape, [], [HtmlEscapeMode]]}), | 746 constructors: () => ({HtmlEscape: [HtmlEscape, [], [HtmlEscapeMode]]}), |
| 747 methods: () => ({ | 747 methods: () => ({ |
| 748 convert: [core.String, [core.String]], | 748 convert: [core.String, [core.String]], |
| 749 [_convert]: [core.String, [core.String, core.int, core.int]], | 749 [_convert]: [core.String, [core.String, core.int, core.int]], |
| 750 startChunkedConversion: [StringConversionSink, [core.Sink$(core.String)]] | 750 startChunkedConversion: [StringConversionSink, [core.Sink$(core.String)]] |
| 751 }) | 751 }) |
| 752 }); | 752 }); |
| 753 let HTML_ESCAPE = dart.const(new HtmlEscape()); | 753 let HTML_ESCAPE = dart.const(new HtmlEscape()); |
| 754 HtmlEscapeMode.ATTRIBUTE = dart.const(new HtmlEscapeMode._('attribute', false,
true, false, false)); | 754 HtmlEscapeMode.ATTRIBUTE = dart.const(new HtmlEscapeMode._('attribute', false,
true, false, false)); |
| 755 HtmlEscapeMode.ELEMENT = dart.const(new HtmlEscapeMode._('element', true, fals
e, false, true)); | 755 HtmlEscapeMode.ELEMENT = dart.const(new HtmlEscapeMode._('element', true, fals
e, false, true)); |
| 756 let _escape = Symbol('_escape'); | 756 let _escape = Symbol('_escape'); |
| 757 class _HtmlEscapeSink extends StringConversionSinkBase { | 757 class _HtmlEscapeSink extends StringConversionSinkBase { |
| 758 _HtmlEscapeSink(escape, sink) { | 758 _HtmlEscapeSink(escape, sink) { |
| 759 this[_escape] = escape; | 759 this[_escape] = escape; |
| 760 this[_sink] = sink; | 760 this[_sink] = sink; |
| 761 } | 761 } |
| 762 addSlice(chunk, start, end, isLast) { | 762 addSlice(chunk, start, end, isLast) { |
| 763 let val = this[_escape][_convert](chunk, start, end); | 763 let val = dart.dcall(this[_escape][_convert], chunk, start, end); |
| 764 if (val == null) { | 764 if (val == null) { |
| 765 this[_sink].addSlice(chunk, start, end, isLast); | 765 dart.dcall(this[_sink].addSlice, chunk, start, end, isLast); |
| 766 } else { | 766 } else { |
| 767 this[_sink].add(val); | 767 dart.dcall(this[_sink].add, val); |
| 768 if (dart.notNull(isLast)) | 768 if (dart.notNull(isLast)) |
| 769 this[_sink].close(); | 769 dart.dcall(this[_sink].close); |
| 770 } | 770 } |
| 771 } | 771 } |
| 772 close() { | 772 close() { |
| 773 return this[_sink].close(); | 773 return dart.dcall(this[_sink].close); |
| 774 } | 774 } |
| 775 } | 775 } |
| 776 dart.setSignature(_HtmlEscapeSink, { | 776 dart.setSignature(_HtmlEscapeSink, { |
| 777 constructors: () => ({_HtmlEscapeSink: [_HtmlEscapeSink, [HtmlEscape, String
ConversionSink]]}), | 777 constructors: () => ({_HtmlEscapeSink: [_HtmlEscapeSink, [HtmlEscape, String
ConversionSink]]}), |
| 778 methods: () => ({ | 778 methods: () => ({ |
| 779 addSlice: [dart.void, [core.String, core.int, core.int, core.bool]], | 779 addSlice: [dart.void, [core.String, core.int, core.int, core.bool]], |
| 780 close: [dart.void, []] | 780 close: [dart.void, []] |
| 781 }) | 781 }) |
| 782 }); | 782 }); |
| 783 class JsonUnsupportedObjectError extends core.Error { | 783 class JsonUnsupportedObjectError extends core.Error { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 820 super.Codec(); | 820 super.Codec(); |
| 821 } | 821 } |
| 822 withReviver(reviver) { | 822 withReviver(reviver) { |
| 823 this.JsonCodec({reviver: reviver}); | 823 this.JsonCodec({reviver: reviver}); |
| 824 } | 824 } |
| 825 decode(source, opts) { | 825 decode(source, opts) { |
| 826 let reviver = opts && 'reviver' in opts ? opts.reviver : null; | 826 let reviver = opts && 'reviver' in opts ? opts.reviver : null; |
| 827 if (reviver == null) | 827 if (reviver == null) |
| 828 reviver = this[_reviver]; | 828 reviver = this[_reviver]; |
| 829 if (reviver == null) | 829 if (reviver == null) |
| 830 return this.decoder.convert(source); | 830 return dart.dcall(this.decoder.convert, source); |
| 831 return new JsonDecoder(reviver).convert(source); | 831 return dart.dcall(new JsonDecoder(reviver).convert, source); |
| 832 } | 832 } |
| 833 encode(value, opts) { | 833 encode(value, opts) { |
| 834 let toEncodable = opts && 'toEncodable' in opts ? opts.toEncodable : null; | 834 let toEncodable = opts && 'toEncodable' in opts ? opts.toEncodable : null; |
| 835 if (toEncodable == null) | 835 if (toEncodable == null) |
| 836 toEncodable = this[_toEncodable$]; | 836 toEncodable = this[_toEncodable$]; |
| 837 if (toEncodable == null) | 837 if (toEncodable == null) |
| 838 return this.encoder.convert(value); | 838 return dart.dcall(this.encoder.convert, value); |
| 839 return new JsonEncoder(dart.as(toEncodable, __CastType0)).convert(value); | 839 return dart.dcall(new JsonEncoder(dart.as(toEncodable, __CastType0)).conve
rt, value); |
| 840 } | 840 } |
| 841 get encoder() { | 841 get encoder() { |
| 842 if (this[_toEncodable$] == null) | 842 if (this[_toEncodable$] == null) |
| 843 return dart.const(new JsonEncoder()); | 843 return dart.const(new JsonEncoder()); |
| 844 return new JsonEncoder(dart.as(this[_toEncodable$], dart.functionType(core
.Object, [core.Object]))); | 844 return new JsonEncoder(dart.as(this[_toEncodable$], dart.functionType(core
.Object, [core.Object]))); |
| 845 } | 845 } |
| 846 get decoder() { | 846 get decoder() { |
| 847 if (this[_reviver] == null) | 847 if (this[_reviver] == null) |
| 848 return dart.const(new JsonDecoder()); | 848 return dart.const(new JsonDecoder()); |
| 849 return new JsonDecoder(this[_reviver]); | 849 return new JsonDecoder(this[_reviver]); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 872 super.Converter(); | 872 super.Converter(); |
| 873 } | 873 } |
| 874 withIndent(indent, toEncodable) { | 874 withIndent(indent, toEncodable) { |
| 875 if (toEncodable === void 0) | 875 if (toEncodable === void 0) |
| 876 toEncodable = null; | 876 toEncodable = null; |
| 877 this.indent = indent; | 877 this.indent = indent; |
| 878 this[_toEncodable$] = toEncodable; | 878 this[_toEncodable$] = toEncodable; |
| 879 super.Converter(); | 879 super.Converter(); |
| 880 } | 880 } |
| 881 convert(object) { | 881 convert(object) { |
| 882 return _JsonStringStringifier.stringify(object, dart.as(this[_toEncodable$
], __CastType2), this.indent); | 882 return dart.dcall(_JsonStringStringifier.stringify, object, this[_toEncoda
ble$], this.indent); |
| 883 } | 883 } |
| 884 startChunkedConversion(sink) { | 884 startChunkedConversion(sink) { |
| 885 if (!dart.is(sink, StringConversionSink)) { | 885 if (!dart.is(sink, StringConversionSink)) { |
| 886 sink = StringConversionSink.from(sink); | 886 sink = StringConversionSink.from(sink); |
| 887 } else if (dart.is(sink, _Utf8EncoderSink)) { | 887 } else if (dart.is(sink, _Utf8EncoderSink)) { |
| 888 return new _JsonUtf8EncoderSink(sink[_sink], this[_toEncodable$], JsonUt
f8Encoder._utf8Encode(this.indent), JsonUtf8Encoder.DEFAULT_BUFFER_SIZE); | 888 return new _JsonUtf8EncoderSink(sink[_sink], this[_toEncodable$], dart.d
call(JsonUtf8Encoder._utf8Encode, this.indent), JsonUtf8Encoder.DEFAULT_BUFFER_S
IZE); |
| 889 } | 889 } |
| 890 return new _JsonEncoderSink(dart.as(sink, StringConversionSink), this[_toE
ncodable$], this.indent); | 890 return new _JsonEncoderSink(dart.as(sink, StringConversionSink), this[_toE
ncodable$], this.indent); |
| 891 } | 891 } |
| 892 bind(stream) { | 892 bind(stream) { |
| 893 return super.bind(stream); | 893 return dart.dcall(super.bind, stream); |
| 894 } | 894 } |
| 895 fuse(other) { | 895 fuse(other) { |
| 896 if (dart.is(other, Utf8Encoder)) { | 896 if (dart.is(other, Utf8Encoder)) { |
| 897 return new JsonUtf8Encoder(this.indent, dart.as(this[_toEncodable$], __C
astType4)); | 897 return new JsonUtf8Encoder(this.indent, dart.as(this[_toEncodable$], __C
astType2)); |
| 898 } | 898 } |
| 899 return super.fuse(other); | 899 return dart.dcall(super.fuse, other); |
| 900 } | 900 } |
| 901 } | 901 } |
| 902 dart.defineNamedConstructor(JsonEncoder, 'withIndent'); | 902 dart.defineNamedConstructor(JsonEncoder, 'withIndent'); |
| 903 dart.setSignature(JsonEncoder, { | 903 dart.setSignature(JsonEncoder, { |
| 904 constructors: () => ({ | 904 constructors: () => ({ |
| 905 JsonEncoder: [JsonEncoder, [], [dart.functionType(core.Object, [core.Objec
t])]], | 905 JsonEncoder: [JsonEncoder, [], [dart.functionType(core.Object, [core.Objec
t])]], |
| 906 withIndent: [JsonEncoder, [core.String], [dart.functionType(core.Object, [
core.Object])]] | 906 withIndent: [JsonEncoder, [core.String], [dart.functionType(core.Object, [
core.Object])]] |
| 907 }), | 907 }), |
| 908 methods: () => ({ | 908 methods: () => ({ |
| 909 convert: [core.String, [core.Object]], | 909 convert: [core.String, [core.Object]], |
| 910 startChunkedConversion: [ChunkedConversionSink$(core.Object), [core.Sink$(
core.String)]], | 910 startChunkedConversion: [ChunkedConversionSink$(core.Object), [core.Sink$(
core.String)]], |
| 911 bind: [async.Stream$(core.String), [async.Stream$(core.Object)]], | 911 bind: [async.Stream$(core.String), [async.Stream$(core.Object)]], |
| 912 fuse: [Converter$(core.Object, dart.dynamic), [Converter$(core.String, dar
t.dynamic)]] | 912 fuse: [Converter$(core.Object, dart.dynamic), [Converter$(core.String, dar
t.dynamic)]] |
| 913 }) | 913 }) |
| 914 }); | 914 }); |
| 915 let _indent = Symbol('_indent'); | 915 let _indent = Symbol('_indent'); |
| 916 let _bufferSize = Symbol('_bufferSize'); | 916 let _bufferSize = Symbol('_bufferSize'); |
| 917 class JsonUtf8Encoder extends Converter$(core.Object, core.List$(core.int)) { | 917 class JsonUtf8Encoder extends Converter$(core.Object, core.List$(core.int)) { |
| 918 JsonUtf8Encoder(indent, toEncodable, bufferSize) { | 918 JsonUtf8Encoder(indent, toEncodable, bufferSize) { |
| 919 if (indent === void 0) | 919 if (indent === void 0) |
| 920 indent = null; | 920 indent = null; |
| 921 if (toEncodable === void 0) | 921 if (toEncodable === void 0) |
| 922 toEncodable = null; | 922 toEncodable = null; |
| 923 if (bufferSize === void 0) | 923 if (bufferSize === void 0) |
| 924 bufferSize = JsonUtf8Encoder.DEFAULT_BUFFER_SIZE; | 924 bufferSize = JsonUtf8Encoder.DEFAULT_BUFFER_SIZE; |
| 925 this[_indent] = JsonUtf8Encoder._utf8Encode(indent); | 925 this[_indent] = dart.dcall(JsonUtf8Encoder._utf8Encode, indent); |
| 926 this[_toEncodable$] = toEncodable; | 926 this[_toEncodable$] = toEncodable; |
| 927 this[_bufferSize] = bufferSize; | 927 this[_bufferSize] = bufferSize; |
| 928 super.Converter(); | 928 super.Converter(); |
| 929 } | 929 } |
| 930 static _utf8Encode(string) { | 930 static _utf8Encode(string) { |
| 931 if (string == null) | 931 if (string == null) |
| 932 return null; | 932 return null; |
| 933 if (dart.notNull(string[dartx.isEmpty])) | 933 if (dart.notNull(string[dartx.isEmpty])) |
| 934 return typed_data.Uint8List.new(0); | 934 return typed_data.Uint8List.new(0); |
| 935 checkAscii: { | 935 checkAscii: { |
| 936 for (let i = 0; dart.notNull(i) < dart.notNull(string[dartx.length]); i
= dart.notNull(i) + 1) { | 936 for (let i = 0; dart.notNull(i) < dart.notNull(string[dartx.length]); i
= dart.notNull(i) + 1) { |
| 937 if (dart.notNull(string[dartx.codeUnitAt](i)) >= 128) | 937 if (dart.notNull(dart.dcall(string[dartx.codeUnitAt], i)) >= 128) |
| 938 break checkAscii; | 938 break checkAscii; |
| 939 } | 939 } |
| 940 return string[dartx.codeUnits]; | 940 return string[dartx.codeUnits]; |
| 941 } | 941 } |
| 942 return UTF8.encode(string); | 942 return dart.dcall(UTF8.encode, string); |
| 943 } | 943 } |
| 944 convert(object) { | 944 convert(object) { |
| 945 let bytes = dart.list([], core.List$(core.int)); | 945 let bytes = dart.list([], core.List$(core.int)); |
| 946 function addChunk(chunk, start, end) { | 946 function addChunk(chunk, start, end) { |
| 947 if (dart.notNull(start) > 0 || dart.notNull(end) < dart.notNull(chunk.le
ngth)) { | 947 if (dart.notNull(start) > 0 || dart.notNull(end) < dart.notNull(chunk.le
ngth)) { |
| 948 let length = dart.notNull(end) - dart.notNull(start); | 948 let length = dart.notNull(end) - dart.notNull(start); |
| 949 chunk = typed_data.Uint8List.view(chunk.buffer, dart.notNull(chunk.off
setInBytes) + dart.notNull(start), length); | 949 chunk = typed_data.Uint8List.view(chunk.buffer, dart.notNull(chunk.off
setInBytes) + dart.notNull(start), length); |
| 950 } | 950 } |
| 951 bytes[dartx.add](chunk); | 951 dart.dcall(bytes[dartx.add], chunk); |
| 952 } | 952 } |
| 953 dart.fn(addChunk, dart.void, [typed_data.Uint8List, core.int, core.int]); | 953 dart.fn(addChunk, dart.void, [typed_data.Uint8List, core.int, core.int]); |
| 954 _JsonUtf8Stringifier.stringify(object, this[_indent], dart.as(this[_toEnco
dable$], dart.functionType(dart.dynamic, [core.Object])), this[_bufferSize], add
Chunk); | 954 dart.dcall(_JsonUtf8Stringifier.stringify, object, this[_indent], this[_to
Encodable$], this[_bufferSize], addChunk); |
| 955 if (bytes[dartx.length] == 1) | 955 if (bytes[dartx.length] == 1) |
| 956 return bytes[dartx.get](0); | 956 return bytes[dartx.get](0); |
| 957 let length = 0; | 957 let length = 0; |
| 958 for (let i = 0; dart.notNull(i) < dart.notNull(bytes[dartx.length]); i = d
art.notNull(i) + 1) { | 958 for (let i = 0; dart.notNull(i) < dart.notNull(bytes[dartx.length]); i = d
art.notNull(i) + 1) { |
| 959 length = dart.notNull(length) + dart.notNull(bytes[dartx.get](i)[dartx.l
ength]); | 959 length = dart.notNull(length) + dart.notNull(bytes[dartx.get](i)[dartx.l
ength]); |
| 960 } | 960 } |
| 961 let result = typed_data.Uint8List.new(length); | 961 let result = typed_data.Uint8List.new(length); |
| 962 for (let i = 0, offset = 0; dart.notNull(i) < dart.notNull(bytes[dartx.len
gth]); i = dart.notNull(i) + 1) { | 962 for (let i = 0, offset = 0; dart.notNull(i) < dart.notNull(bytes[dartx.len
gth]); i = dart.notNull(i) + 1) { |
| 963 let byteList = bytes[dartx.get](i); | 963 let byteList = bytes[dartx.get](i); |
| 964 let end = dart.notNull(offset) + dart.notNull(byteList[dartx.length]); | 964 let end = dart.notNull(offset) + dart.notNull(dart.as(dart.dload(byteLis
t, 'length'), core.num)); |
| 965 result.setRange(offset, end, byteList); | 965 dart.dcall(result.setRange, offset, end, byteList); |
| 966 offset = end; | 966 offset = end; |
| 967 } | 967 } |
| 968 return result; | 968 return result; |
| 969 } | 969 } |
| 970 startChunkedConversion(sink) { | 970 startChunkedConversion(sink) { |
| 971 let byteSink = null; | 971 let byteSink = null; |
| 972 if (dart.is(sink, ByteConversionSink)) { | 972 if (dart.is(sink, ByteConversionSink)) { |
| 973 byteSink = sink; | 973 byteSink = sink; |
| 974 } else { | 974 } else { |
| 975 byteSink = ByteConversionSink.from(sink); | 975 byteSink = ByteConversionSink.from(sink); |
| 976 } | 976 } |
| 977 return new _JsonUtf8EncoderSink(byteSink, this[_toEncodable$], this[_inden
t], this[_bufferSize]); | 977 return new _JsonUtf8EncoderSink(byteSink, this[_toEncodable$], this[_inden
t], this[_bufferSize]); |
| 978 } | 978 } |
| 979 bind(stream) { | 979 bind(stream) { |
| 980 return super.bind(stream); | 980 return dart.dcall(super.bind, stream); |
| 981 } | 981 } |
| 982 fuse(other) { | 982 fuse(other) { |
| 983 return super.fuse(other); | 983 return dart.dcall(super.fuse, other); |
| 984 } | 984 } |
| 985 } | 985 } |
| 986 dart.setSignature(JsonUtf8Encoder, { | 986 dart.setSignature(JsonUtf8Encoder, { |
| 987 constructors: () => ({JsonUtf8Encoder: [JsonUtf8Encoder, [], [core.String, d
art.functionType(dart.dynamic, [core.Object]), core.int]]}), | 987 constructors: () => ({JsonUtf8Encoder: [JsonUtf8Encoder, [], [core.String, d
art.functionType(dart.dynamic, [core.Object]), core.int]]}), |
| 988 methods: () => ({ | 988 methods: () => ({ |
| 989 convert: [core.List$(core.int), [core.Object]], | 989 convert: [core.List$(core.int), [core.Object]], |
| 990 startChunkedConversion: [ChunkedConversionSink$(core.Object), [core.Sink$(
core.List$(core.int))]], | 990 startChunkedConversion: [ChunkedConversionSink$(core.Object), [core.Sink$(
core.List$(core.int))]], |
| 991 bind: [async.Stream$(core.List$(core.int)), [async.Stream$(core.Object)]], | 991 bind: [async.Stream$(core.List$(core.int)), [async.Stream$(core.Object)]], |
| 992 fuse: [Converter$(core.Object, dart.dynamic), [Converter$(core.List$(core.
int), dart.dynamic)]] | 992 fuse: [Converter$(core.Object, dart.dynamic), [Converter$(core.List$(core.
int), dart.dynamic)]] |
| 993 }), | 993 }), |
| 994 statics: () => ({_utf8Encode: [core.List$(core.int), [core.String]]}), | 994 statics: () => ({_utf8Encode: [core.List$(core.int), [core.String]]}), |
| 995 names: ['_utf8Encode'] | 995 names: ['_utf8Encode'] |
| 996 }); | 996 }); |
| 997 JsonUtf8Encoder.DEFAULT_BUFFER_SIZE = 256; | 997 JsonUtf8Encoder.DEFAULT_BUFFER_SIZE = 256; |
| 998 let _isDone = Symbol('_isDone'); | 998 let _isDone = Symbol('_isDone'); |
| 999 class _JsonEncoderSink extends ChunkedConversionSink$(core.Object) { | 999 class _JsonEncoderSink extends ChunkedConversionSink$(core.Object) { |
| 1000 _JsonEncoderSink(sink, toEncodable, indent) { | 1000 _JsonEncoderSink(sink, toEncodable, indent) { |
| 1001 this[_sink] = sink; | 1001 this[_sink] = sink; |
| 1002 this[_toEncodable$] = toEncodable; | 1002 this[_toEncodable$] = toEncodable; |
| 1003 this[_indent] = indent; | 1003 this[_indent] = indent; |
| 1004 this[_isDone] = false; | 1004 this[_isDone] = false; |
| 1005 super.ChunkedConversionSink(); | 1005 super.ChunkedConversionSink(); |
| 1006 } | 1006 } |
| 1007 add(o) { | 1007 add(o) { |
| 1008 if (dart.notNull(this[_isDone])) { | 1008 if (dart.notNull(this[_isDone])) { |
| 1009 dart.throw(new core.StateError("Only one call to add allowed")); | 1009 dart.throw(new core.StateError("Only one call to add allowed")); |
| 1010 } | 1010 } |
| 1011 this[_isDone] = true; | 1011 this[_isDone] = true; |
| 1012 let stringSink = this[_sink].asStringSink(); | 1012 let stringSink = dart.dcall(this[_sink].asStringSink); |
| 1013 _JsonStringStringifier.printOn(o, stringSink, dart.as(this[_toEncodable$],
dart.functionType(dart.dynamic, [dart.dynamic])), this[_indent]); | 1013 dart.dcall(_JsonStringStringifier.printOn, o, stringSink, this[_toEncodabl
e$], this[_indent]); |
| 1014 stringSink.close(); | 1014 dart.dcall(stringSink.close); |
| 1015 } | 1015 } |
| 1016 close() {} | 1016 close() {} |
| 1017 } | 1017 } |
| 1018 dart.setSignature(_JsonEncoderSink, { | 1018 dart.setSignature(_JsonEncoderSink, { |
| 1019 constructors: () => ({_JsonEncoderSink: [_JsonEncoderSink, [StringConversion
Sink, core.Function, core.String]]}), | 1019 constructors: () => ({_JsonEncoderSink: [_JsonEncoderSink, [StringConversion
Sink, core.Function, core.String]]}), |
| 1020 methods: () => ({ | 1020 methods: () => ({ |
| 1021 add: [dart.void, [core.Object]], | 1021 add: [dart.void, [core.Object]], |
| 1022 close: [dart.void, []] | 1022 close: [dart.void, []] |
| 1023 }) | 1023 }) |
| 1024 }); | 1024 }); |
| 1025 let _addChunk = Symbol('_addChunk'); | 1025 let _addChunk = Symbol('_addChunk'); |
| 1026 class _JsonUtf8EncoderSink extends ChunkedConversionSink$(core.Object) { | 1026 class _JsonUtf8EncoderSink extends ChunkedConversionSink$(core.Object) { |
| 1027 _JsonUtf8EncoderSink(sink, toEncodable, indent, bufferSize) { | 1027 _JsonUtf8EncoderSink(sink, toEncodable, indent, bufferSize) { |
| 1028 this[_sink] = sink; | 1028 this[_sink] = sink; |
| 1029 this[_toEncodable$] = toEncodable; | 1029 this[_toEncodable$] = toEncodable; |
| 1030 this[_indent] = indent; | 1030 this[_indent] = indent; |
| 1031 this[_bufferSize] = bufferSize; | 1031 this[_bufferSize] = bufferSize; |
| 1032 this[_isDone] = false; | 1032 this[_isDone] = false; |
| 1033 super.ChunkedConversionSink(); | 1033 super.ChunkedConversionSink(); |
| 1034 } | 1034 } |
| 1035 [_addChunk](chunk, start, end) { | 1035 [_addChunk](chunk, start, end) { |
| 1036 this[_sink].addSlice(chunk, start, end, false); | 1036 dart.dcall(this[_sink].addSlice, chunk, start, end, false); |
| 1037 } | 1037 } |
| 1038 add(object) { | 1038 add(object) { |
| 1039 if (dart.notNull(this[_isDone])) { | 1039 if (dart.notNull(this[_isDone])) { |
| 1040 dart.throw(new core.StateError("Only one call to add allowed")); | 1040 dart.throw(new core.StateError("Only one call to add allowed")); |
| 1041 } | 1041 } |
| 1042 this[_isDone] = true; | 1042 this[_isDone] = true; |
| 1043 _JsonUtf8Stringifier.stringify(object, this[_indent], dart.as(this[_toEnco
dable$], dart.functionType(dart.dynamic, [core.Object])), this[_bufferSize], dar
t.bind(this, _addChunk)); | 1043 dart.dcall(_JsonUtf8Stringifier.stringify, object, this[_indent], this[_to
Encodable$], this[_bufferSize], dart.bind(this, _addChunk)); |
| 1044 this[_sink].close(); | 1044 dart.dcall(this[_sink].close); |
| 1045 } | 1045 } |
| 1046 close() { | 1046 close() { |
| 1047 if (!dart.notNull(this[_isDone])) { | 1047 if (!dart.notNull(this[_isDone])) { |
| 1048 this[_isDone] = true; | 1048 this[_isDone] = true; |
| 1049 this[_sink].close(); | 1049 dart.dcall(this[_sink].close); |
| 1050 } | 1050 } |
| 1051 } | 1051 } |
| 1052 } | 1052 } |
| 1053 dart.setSignature(_JsonUtf8EncoderSink, { | 1053 dart.setSignature(_JsonUtf8EncoderSink, { |
| 1054 constructors: () => ({_JsonUtf8EncoderSink: [_JsonUtf8EncoderSink, [ByteConv
ersionSink, core.Function, core.List$(core.int), core.int]]}), | 1054 constructors: () => ({_JsonUtf8EncoderSink: [_JsonUtf8EncoderSink, [ByteConv
ersionSink, core.Function, core.List$(core.int), core.int]]}), |
| 1055 methods: () => ({ | 1055 methods: () => ({ |
| 1056 [_addChunk]: [dart.void, [typed_data.Uint8List, core.int, core.int]], | 1056 [_addChunk]: [dart.void, [typed_data.Uint8List, core.int, core.int]], |
| 1057 add: [dart.void, [core.Object]], | 1057 add: [dart.void, [core.Object]], |
| 1058 close: [dart.void, []] | 1058 close: [dart.void, []] |
| 1059 }) | 1059 }) |
| 1060 }); | 1060 }); |
| 1061 class JsonDecoder extends Converter$(core.String, core.Object) { | 1061 class JsonDecoder extends Converter$(core.String, core.Object) { |
| 1062 JsonDecoder(reviver) { | 1062 JsonDecoder(reviver) { |
| 1063 if (reviver === void 0) | 1063 if (reviver === void 0) |
| 1064 reviver = null; | 1064 reviver = null; |
| 1065 this[_reviver] = reviver; | 1065 this[_reviver] = reviver; |
| 1066 super.Converter(); | 1066 super.Converter(); |
| 1067 } | 1067 } |
| 1068 convert(input) { | 1068 convert(input) { |
| 1069 return _parseJson(input, this[_reviver]); | 1069 return dart.dcall(_parseJson, input, this[_reviver]); |
| 1070 } | 1070 } |
| 1071 startChunkedConversion(sink) { | 1071 startChunkedConversion(sink) { |
| 1072 return new _JsonDecoderSink(this[_reviver], sink); | 1072 return new _JsonDecoderSink(this[_reviver], sink); |
| 1073 } | 1073 } |
| 1074 bind(stream) { | 1074 bind(stream) { |
| 1075 return super.bind(stream); | 1075 return dart.dcall(super.bind, stream); |
| 1076 } | 1076 } |
| 1077 } | 1077 } |
| 1078 dart.setSignature(JsonDecoder, { | 1078 dart.setSignature(JsonDecoder, { |
| 1079 constructors: () => ({JsonDecoder: [JsonDecoder, [], [dart.functionType(dart
.dynamic, [dart.dynamic, dart.dynamic])]]}), | 1079 constructors: () => ({JsonDecoder: [JsonDecoder, [], [dart.functionType(dart
.dynamic, [dart.dynamic, dart.dynamic])]]}), |
| 1080 methods: () => ({ | 1080 methods: () => ({ |
| 1081 convert: [dart.dynamic, [core.String]], | 1081 convert: [dart.dynamic, [core.String]], |
| 1082 startChunkedConversion: [StringConversionSink, [core.Sink$(core.Object)]], | 1082 startChunkedConversion: [StringConversionSink, [core.Sink$(core.Object)]], |
| 1083 bind: [async.Stream$(core.Object), [async.Stream$(core.String)]] | 1083 bind: [async.Stream$(core.Object), [async.Stream$(core.String)]] |
| 1084 }) | 1084 }) |
| 1085 }); | 1085 }); |
| 1086 function _parseJson(source, reviver) { | 1086 function _parseJson(source, reviver) { |
| 1087 if (!(typeof source == 'string')) | 1087 if (!(typeof source == 'string')) |
| 1088 dart.throw(new core.ArgumentError(source)); | 1088 dart.throw(new core.ArgumentError(source)); |
| 1089 let parsed = null; | 1089 let parsed = null; |
| 1090 try { | 1090 try { |
| 1091 parsed = JSON.parse(source); | 1091 parsed = JSON.parse(source); |
| 1092 } catch (e) { | 1092 } catch (e) { |
| 1093 dart.throw(new core.FormatException(String(e))); | 1093 dart.throw(new core.FormatException(dart.as(String(e), core.String))); |
| 1094 } | 1094 } |
| 1095 | 1095 |
| 1096 if (reviver == null) { | 1096 if (reviver == null) { |
| 1097 return _convertJsonToDartLazy(parsed); | 1097 return dart.dcall(_convertJsonToDartLazy, parsed); |
| 1098 } else { | 1098 } else { |
| 1099 return _convertJsonToDart(parsed, reviver); | 1099 return dart.dcall(_convertJsonToDart, parsed, reviver); |
| 1100 } | 1100 } |
| 1101 } | 1101 } |
| 1102 dart.fn(_parseJson, dart.dynamic, [core.String, dart.functionType(dart.dynamic
, [dart.dynamic, dart.dynamic])]); | 1102 dart.fn(_parseJson, dart.dynamic, [core.String, dart.functionType(dart.dynamic
, [dart.dynamic, dart.dynamic])]); |
| 1103 function _defaultToEncodable(object) { | 1103 function _defaultToEncodable(object) { |
| 1104 return dart.dsend(object, 'toJson'); | 1104 return dart.dsend(object, 'toJson'); |
| 1105 } | 1105 } |
| 1106 dart.fn(_defaultToEncodable, core.Object, [dart.dynamic]); | 1106 dart.fn(_defaultToEncodable, core.Object, [dart.dynamic]); |
| 1107 let _seen = Symbol('_seen'); | 1107 let _seen = Symbol('_seen'); |
| 1108 let _checkCycle = Symbol('_checkCycle'); | 1108 let _checkCycle = Symbol('_checkCycle'); |
| 1109 let _removeSeen = Symbol('_removeSeen'); | 1109 let _removeSeen = Symbol('_removeSeen'); |
| 1110 class _JsonStringifier extends core.Object { | 1110 class _JsonStringifier extends core.Object { |
| 1111 _JsonStringifier(_toEncodable) { | 1111 _JsonStringifier(_toEncodable) { |
| 1112 this[_seen] = core.List.new(); | 1112 this[_seen] = core.List.new(); |
| 1113 this[_toEncodable$] = _toEncodable != null ? _toEncodable : _defaultToEnco
dable; | 1113 this[_toEncodable$] = _toEncodable != null ? _toEncodable : _defaultToEnco
dable; |
| 1114 } | 1114 } |
| 1115 static hexDigit(x) { | 1115 static hexDigit(x) { |
| 1116 return dart.notNull(x) < 10 ? 48 + dart.notNull(x) : 87 + dart.notNull(x); | 1116 return dart.notNull(x) < 10 ? 48 + dart.notNull(x) : 87 + dart.notNull(x); |
| 1117 } | 1117 } |
| 1118 writeStringContent(s) { | 1118 writeStringContent(s) { |
| 1119 let offset = 0; | 1119 let offset = 0; |
| 1120 let length = s[dartx.length]; | 1120 let length = s[dartx.length]; |
| 1121 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull(i
) + 1) { | 1121 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull(i
) + 1) { |
| 1122 let charCode = s[dartx.codeUnitAt](i); | 1122 let charCode = dart.dcall(s[dartx.codeUnitAt], i); |
| 1123 if (dart.notNull(charCode) > dart.notNull(_JsonStringifier.BACKSLASH)) | 1123 if (dart.notNull(charCode) > dart.notNull(_JsonStringifier.BACKSLASH)) |
| 1124 continue; | 1124 continue; |
| 1125 if (dart.notNull(charCode) < 32) { | 1125 if (dart.notNull(charCode) < 32) { |
| 1126 if (dart.notNull(i) > dart.notNull(offset)) | 1126 if (dart.notNull(i) > dart.notNull(offset)) |
| 1127 this.writeStringSlice(s, offset, i); | 1127 dart.dcall(this.writeStringSlice, s, offset, i); |
| 1128 offset = dart.notNull(i) + 1; | 1128 offset = dart.notNull(i) + 1; |
| 1129 this.writeCharCode(_JsonStringifier.BACKSLASH); | 1129 dart.dcall(this.writeCharCode, _JsonStringifier.BACKSLASH); |
| 1130 switch (charCode) { | 1130 switch (charCode) { |
| 1131 case _JsonStringifier.BACKSPACE: | 1131 case _JsonStringifier.BACKSPACE: |
| 1132 { | 1132 { |
| 1133 this.writeCharCode(_JsonStringifier.CHAR_b); | 1133 dart.dcall(this.writeCharCode, _JsonStringifier.CHAR_b); |
| 1134 break; | 1134 break; |
| 1135 } | 1135 } |
| 1136 case _JsonStringifier.TAB: | 1136 case _JsonStringifier.TAB: |
| 1137 { | 1137 { |
| 1138 this.writeCharCode(_JsonStringifier.CHAR_t); | 1138 dart.dcall(this.writeCharCode, _JsonStringifier.CHAR_t); |
| 1139 break; | 1139 break; |
| 1140 } | 1140 } |
| 1141 case _JsonStringifier.NEWLINE: | 1141 case _JsonStringifier.NEWLINE: |
| 1142 { | 1142 { |
| 1143 this.writeCharCode(_JsonStringifier.CHAR_n); | 1143 dart.dcall(this.writeCharCode, _JsonStringifier.CHAR_n); |
| 1144 break; | 1144 break; |
| 1145 } | 1145 } |
| 1146 case _JsonStringifier.FORM_FEED: | 1146 case _JsonStringifier.FORM_FEED: |
| 1147 { | 1147 { |
| 1148 this.writeCharCode(_JsonStringifier.CHAR_f); | 1148 dart.dcall(this.writeCharCode, _JsonStringifier.CHAR_f); |
| 1149 break; | 1149 break; |
| 1150 } | 1150 } |
| 1151 case _JsonStringifier.CARRIAGE_RETURN: | 1151 case _JsonStringifier.CARRIAGE_RETURN: |
| 1152 { | 1152 { |
| 1153 this.writeCharCode(_JsonStringifier.CHAR_r); | 1153 dart.dcall(this.writeCharCode, _JsonStringifier.CHAR_r); |
| 1154 break; | 1154 break; |
| 1155 } | 1155 } |
| 1156 default: | 1156 default: |
| 1157 { | 1157 { |
| 1158 this.writeCharCode(_JsonStringifier.CHAR_u); | 1158 dart.dcall(this.writeCharCode, _JsonStringifier.CHAR_u); |
| 1159 this.writeCharCode(_JsonStringifier.CHAR_0); | 1159 dart.dcall(this.writeCharCode, _JsonStringifier.CHAR_0); |
| 1160 this.writeCharCode(_JsonStringifier.CHAR_0); | 1160 dart.dcall(this.writeCharCode, _JsonStringifier.CHAR_0); |
| 1161 this.writeCharCode(_JsonStringifier.hexDigit(dart.notNull(charCode
) >> 4 & 15)); | 1161 dart.dcall(this.writeCharCode, dart.dcall(_JsonStringifier.hexDigi
t, dart.notNull(charCode) >> 4 & 15)); |
| 1162 this.writeCharCode(_JsonStringifier.hexDigit(dart.notNull(charCode
) & 15)); | 1162 dart.dcall(this.writeCharCode, dart.dcall(_JsonStringifier.hexDigi
t, dart.notNull(charCode) & 15)); |
| 1163 break; | 1163 break; |
| 1164 } | 1164 } |
| 1165 } | 1165 } |
| 1166 } else if (charCode == _JsonStringifier.QUOTE || charCode == _JsonString
ifier.BACKSLASH) { | 1166 } else if (charCode == _JsonStringifier.QUOTE || charCode == _JsonString
ifier.BACKSLASH) { |
| 1167 if (dart.notNull(i) > dart.notNull(offset)) | 1167 if (dart.notNull(i) > dart.notNull(offset)) |
| 1168 this.writeStringSlice(s, offset, i); | 1168 dart.dcall(this.writeStringSlice, s, offset, i); |
| 1169 offset = dart.notNull(i) + 1; | 1169 offset = dart.notNull(i) + 1; |
| 1170 this.writeCharCode(_JsonStringifier.BACKSLASH); | 1170 dart.dcall(this.writeCharCode, _JsonStringifier.BACKSLASH); |
| 1171 this.writeCharCode(charCode); | 1171 dart.dcall(this.writeCharCode, charCode); |
| 1172 } | 1172 } |
| 1173 } | 1173 } |
| 1174 if (offset == 0) { | 1174 if (offset == 0) { |
| 1175 this.writeString(s); | 1175 dart.dcall(this.writeString, s); |
| 1176 } else if (dart.notNull(offset) < dart.notNull(length)) { | 1176 } else if (dart.notNull(offset) < dart.notNull(length)) { |
| 1177 this.writeStringSlice(s, offset, length); | 1177 dart.dcall(this.writeStringSlice, s, offset, length); |
| 1178 } | 1178 } |
| 1179 } | 1179 } |
| 1180 [_checkCycle](object) { | 1180 [_checkCycle](object) { |
| 1181 for (let i = 0; dart.notNull(i) < dart.notNull(this[_seen][dartx.length]);
i = dart.notNull(i) + 1) { | 1181 for (let i = 0; dart.notNull(i) < dart.notNull(this[_seen][dartx.length]);
i = dart.notNull(i) + 1) { |
| 1182 if (dart.notNull(core.identical(object, this[_seen][dartx.get](i)))) { | 1182 if (dart.notNull(dart.dcall(core.identical, object, this[_seen][dartx.ge
t](i)))) { |
| 1183 dart.throw(new JsonCyclicError(object)); | 1183 dart.throw(new JsonCyclicError(object)); |
| 1184 } | 1184 } |
| 1185 } | 1185 } |
| 1186 this[_seen][dartx.add](object); | 1186 dart.dcall(this[_seen][dartx.add], object); |
| 1187 } | 1187 } |
| 1188 [_removeSeen](object) { | 1188 [_removeSeen](object) { |
| 1189 dart.assert(!dart.notNull(this[_seen][dartx.isEmpty])); | 1189 dart.assert(!dart.notNull(this[_seen][dartx.isEmpty])); |
| 1190 dart.assert(core.identical(this[_seen][dartx.last], object)); | 1190 dart.assert(dart.dcall(core.identical, this[_seen][dartx.last], object)); |
| 1191 this[_seen][dartx.removeLast](); | 1191 dart.dcall(this[_seen][dartx.removeLast]); |
| 1192 } | 1192 } |
| 1193 writeObject(object) { | 1193 writeObject(object) { |
| 1194 if (dart.notNull(this.writeJsonValue(object))) | 1194 if (dart.notNull(dart.dcall(this.writeJsonValue, object))) |
| 1195 return; | 1195 return; |
| 1196 this[_checkCycle](object); | 1196 dart.dcall(this[_checkCycle], object); |
| 1197 try { | 1197 try { |
| 1198 let customJson = dart.dcall(this[_toEncodable$], object); | 1198 let customJson = dart.dcall(this[_toEncodable$], object); |
| 1199 if (!dart.notNull(this.writeJsonValue(customJson))) { | 1199 if (!dart.notNull(dart.dcall(this.writeJsonValue, customJson))) { |
| 1200 dart.throw(new JsonUnsupportedObjectError(object)); | 1200 dart.throw(new JsonUnsupportedObjectError(object)); |
| 1201 } | 1201 } |
| 1202 this[_removeSeen](object); | 1202 dart.dcall(this[_removeSeen], object); |
| 1203 } catch (e) { | 1203 } catch (e) { |
| 1204 dart.throw(new JsonUnsupportedObjectError(object, {cause: e})); | 1204 dart.throw(new JsonUnsupportedObjectError(object, {cause: e})); |
| 1205 } | 1205 } |
| 1206 | 1206 |
| 1207 } | 1207 } |
| 1208 writeJsonValue(object) { | 1208 writeJsonValue(object) { |
| 1209 if (dart.is(object, core.num)) { | 1209 if (dart.is(object, core.num)) { |
| 1210 if (!dart.notNull(dart.as(dart.dload(object, 'isFinite'), core.bool))) | 1210 if (!dart.notNull(dart.as(dart.dload(object, 'isFinite'), core.bool))) |
| 1211 return false; | 1211 return false; |
| 1212 this.writeNumber(dart.as(object, core.num)); | 1212 dart.dcall(this.writeNumber, object); |
| 1213 return true; | 1213 return true; |
| 1214 } else if (dart.notNull(core.identical(object, true))) { | 1214 } else if (dart.notNull(dart.dcall(core.identical, object, true))) { |
| 1215 this.writeString('true'); | 1215 dart.dcall(this.writeString, 'true'); |
| 1216 return true; | 1216 return true; |
| 1217 } else if (dart.notNull(core.identical(object, false))) { | 1217 } else if (dart.notNull(dart.dcall(core.identical, object, false))) { |
| 1218 this.writeString('false'); | 1218 dart.dcall(this.writeString, 'false'); |
| 1219 return true; | 1219 return true; |
| 1220 } else if (object == null) { | 1220 } else if (object == null) { |
| 1221 this.writeString('null'); | 1221 dart.dcall(this.writeString, 'null'); |
| 1222 return true; | 1222 return true; |
| 1223 } else if (typeof object == 'string') { | 1223 } else if (typeof object == 'string') { |
| 1224 this.writeString('"'); | 1224 dart.dcall(this.writeString, '"'); |
| 1225 this.writeStringContent(dart.as(object, core.String)); | 1225 dart.dcall(this.writeStringContent, object); |
| 1226 this.writeString('"'); | 1226 dart.dcall(this.writeString, '"'); |
| 1227 return true; | 1227 return true; |
| 1228 } else if (dart.is(object, core.List)) { | 1228 } else if (dart.is(object, core.List)) { |
| 1229 this[_checkCycle](object); | 1229 dart.dcall(this[_checkCycle], object); |
| 1230 this.writeList(dart.as(object, core.List)); | 1230 dart.dcall(this.writeList, object); |
| 1231 this[_removeSeen](object); | 1231 dart.dcall(this[_removeSeen], object); |
| 1232 return true; | 1232 return true; |
| 1233 } else if (dart.is(object, core.Map)) { | 1233 } else if (dart.is(object, core.Map)) { |
| 1234 this[_checkCycle](object); | 1234 dart.dcall(this[_checkCycle], object); |
| 1235 this.writeMap(dart.as(object, core.Map$(core.String, core.Object))); | 1235 dart.dcall(this.writeMap, object); |
| 1236 this[_removeSeen](object); | 1236 dart.dcall(this[_removeSeen], object); |
| 1237 return true; | 1237 return true; |
| 1238 } else { | 1238 } else { |
| 1239 return false; | 1239 return false; |
| 1240 } | 1240 } |
| 1241 } | 1241 } |
| 1242 writeList(list) { | 1242 writeList(list) { |
| 1243 this.writeString('['); | 1243 dart.dcall(this.writeString, '['); |
| 1244 if (dart.notNull(list[dartx.length]) > 0) { | 1244 if (dart.notNull(list[dartx.length]) > 0) { |
| 1245 this.writeObject(list[dartx.get](0)); | 1245 dart.dcall(this.writeObject, list[dartx.get](0)); |
| 1246 for (let i = 1; dart.notNull(i) < dart.notNull(list[dartx.length]); i =
dart.notNull(i) + 1) { | 1246 for (let i = 1; dart.notNull(i) < dart.notNull(list[dartx.length]); i =
dart.notNull(i) + 1) { |
| 1247 this.writeString(','); | 1247 dart.dcall(this.writeString, ','); |
| 1248 this.writeObject(list[dartx.get](i)); | 1248 dart.dcall(this.writeObject, list[dartx.get](i)); |
| 1249 } | 1249 } |
| 1250 } | 1250 } |
| 1251 this.writeString(']'); | 1251 dart.dcall(this.writeString, ']'); |
| 1252 } | 1252 } |
| 1253 writeMap(map) { | 1253 writeMap(map) { |
| 1254 this.writeString('{'); | 1254 dart.dcall(this.writeString, '{'); |
| 1255 let separator = '"'; | 1255 let separator = '"'; |
| 1256 map.forEach(dart.fn(((key, value) => { | 1256 dart.dcall(map.forEach, dart.fn(((key, value) => { |
| 1257 this.writeString(separator); | 1257 dart.dcall(this.writeString, separator); |
| 1258 separator = ',"'; | 1258 separator = ',"'; |
| 1259 this.writeStringContent(key); | 1259 dart.dcall(this.writeStringContent, key); |
| 1260 this.writeString('":'); | 1260 dart.dcall(this.writeString, '":'); |
| 1261 this.writeObject(value); | 1261 dart.dcall(this.writeObject, value); |
| 1262 }).bind(this), dart.dynamic, [core.String, dart.dynamic])); | 1262 }).bind(this), dart.dynamic, [core.String, dart.dynamic])); |
| 1263 this.writeString('}'); | 1263 dart.dcall(this.writeString, '}'); |
| 1264 } | 1264 } |
| 1265 } | 1265 } |
| 1266 dart.setSignature(_JsonStringifier, { | 1266 dart.setSignature(_JsonStringifier, { |
| 1267 constructors: () => ({_JsonStringifier: [_JsonStringifier, [dart.functionTyp
e(core.Object, [core.Object])]]}), | 1267 constructors: () => ({_JsonStringifier: [_JsonStringifier, [dart.functionTyp
e(core.Object, [core.Object])]]}), |
| 1268 methods: () => ({ | 1268 methods: () => ({ |
| 1269 writeStringContent: [dart.void, [core.String]], | 1269 writeStringContent: [dart.void, [core.String]], |
| 1270 [_checkCycle]: [dart.void, [dart.dynamic]], | 1270 [_checkCycle]: [dart.void, [dart.dynamic]], |
| 1271 [_removeSeen]: [dart.void, [dart.dynamic]], | 1271 [_removeSeen]: [dart.void, [dart.dynamic]], |
| 1272 writeObject: [dart.void, [dart.dynamic]], | 1272 writeObject: [dart.void, [dart.dynamic]], |
| 1273 writeJsonValue: [core.bool, [dart.dynamic]], | 1273 writeJsonValue: [core.bool, [dart.dynamic]], |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1291 _JsonStringifier.CHAR_r = 114; | 1291 _JsonStringifier.CHAR_r = 114; |
| 1292 _JsonStringifier.CHAR_t = 116; | 1292 _JsonStringifier.CHAR_t = 116; |
| 1293 _JsonStringifier.CHAR_u = 117; | 1293 _JsonStringifier.CHAR_u = 117; |
| 1294 let _indentLevel = Symbol('_indentLevel'); | 1294 let _indentLevel = Symbol('_indentLevel'); |
| 1295 class _JsonPrettyPrintMixin extends core.Object { | 1295 class _JsonPrettyPrintMixin extends core.Object { |
| 1296 _JsonPrettyPrintMixin() { | 1296 _JsonPrettyPrintMixin() { |
| 1297 this[_indentLevel] = 0; | 1297 this[_indentLevel] = 0; |
| 1298 } | 1298 } |
| 1299 writeList(list) { | 1299 writeList(list) { |
| 1300 if (dart.notNull(list[dartx.isEmpty])) { | 1300 if (dart.notNull(list[dartx.isEmpty])) { |
| 1301 this.writeString('[]'); | 1301 dart.dcall(this.writeString, '[]'); |
| 1302 } else { | 1302 } else { |
| 1303 this.writeString('[\n'); | 1303 dart.dcall(this.writeString, '[\n'); |
| 1304 this[_indentLevel] = dart.notNull(this[_indentLevel]) + 1; | 1304 this[_indentLevel] = dart.notNull(this[_indentLevel]) + 1; |
| 1305 this.writeIndentation(this[_indentLevel]); | 1305 dart.dcall(this.writeIndentation, this[_indentLevel]); |
| 1306 this.writeObject(list[dartx.get](0)); | 1306 dart.dcall(this.writeObject, list[dartx.get](0)); |
| 1307 for (let i = 1; dart.notNull(i) < dart.notNull(list[dartx.length]); i =
dart.notNull(i) + 1) { | 1307 for (let i = 1; dart.notNull(i) < dart.notNull(list[dartx.length]); i =
dart.notNull(i) + 1) { |
| 1308 this.writeString(',\n'); | 1308 dart.dcall(this.writeString, ',\n'); |
| 1309 this.writeIndentation(this[_indentLevel]); | 1309 dart.dcall(this.writeIndentation, this[_indentLevel]); |
| 1310 this.writeObject(list[dartx.get](i)); | 1310 dart.dcall(this.writeObject, list[dartx.get](i)); |
| 1311 } | 1311 } |
| 1312 this.writeString('\n'); | 1312 dart.dcall(this.writeString, '\n'); |
| 1313 this[_indentLevel] = dart.notNull(this[_indentLevel]) - 1; | 1313 this[_indentLevel] = dart.notNull(this[_indentLevel]) - 1; |
| 1314 this.writeIndentation(this[_indentLevel]); | 1314 dart.dcall(this.writeIndentation, this[_indentLevel]); |
| 1315 this.writeString(']'); | 1315 dart.dcall(this.writeString, ']'); |
| 1316 } | 1316 } |
| 1317 } | 1317 } |
| 1318 writeMap(map) { | 1318 writeMap(map) { |
| 1319 if (dart.notNull(map.isEmpty)) { | 1319 if (dart.notNull(map.isEmpty)) { |
| 1320 this.writeString('{}'); | 1320 dart.dcall(this.writeString, '{}'); |
| 1321 } else { | 1321 } else { |
| 1322 this.writeString('{\n'); | 1322 dart.dcall(this.writeString, '{\n'); |
| 1323 this[_indentLevel] = dart.notNull(this[_indentLevel]) + 1; | 1323 this[_indentLevel] = dart.notNull(this[_indentLevel]) + 1; |
| 1324 let first = true; | 1324 let first = true; |
| 1325 map.forEach(dart.fn(((key, value) => { | 1325 dart.dcall(map.forEach, dart.fn(((key, value) => { |
| 1326 if (!dart.notNull(first)) { | 1326 if (!dart.notNull(first)) { |
| 1327 this.writeString(",\n"); | 1327 dart.dcall(this.writeString, ",\n"); |
| 1328 } | 1328 } |
| 1329 this.writeIndentation(this[_indentLevel]); | 1329 dart.dcall(this.writeIndentation, this[_indentLevel]); |
| 1330 this.writeString('"'); | 1330 dart.dcall(this.writeString, '"'); |
| 1331 this.writeStringContent(key); | 1331 dart.dcall(this.writeStringContent, key); |
| 1332 this.writeString('": '); | 1332 dart.dcall(this.writeString, '": '); |
| 1333 this.writeObject(value); | 1333 dart.dcall(this.writeObject, value); |
| 1334 first = false; | 1334 first = false; |
| 1335 }).bind(this), dart.dynamic, [core.String, core.Object])); | 1335 }).bind(this), dart.dynamic, [core.String, core.Object])); |
| 1336 this.writeString('\n'); | 1336 dart.dcall(this.writeString, '\n'); |
| 1337 this[_indentLevel] = dart.notNull(this[_indentLevel]) - 1; | 1337 this[_indentLevel] = dart.notNull(this[_indentLevel]) - 1; |
| 1338 this.writeIndentation(this[_indentLevel]); | 1338 dart.dcall(this.writeIndentation, this[_indentLevel]); |
| 1339 this.writeString('}'); | 1339 dart.dcall(this.writeString, '}'); |
| 1340 } | 1340 } |
| 1341 } | 1341 } |
| 1342 } | 1342 } |
| 1343 _JsonPrettyPrintMixin[dart.implements] = () => [_JsonStringifier]; | 1343 _JsonPrettyPrintMixin[dart.implements] = () => [_JsonStringifier]; |
| 1344 dart.setSignature(_JsonPrettyPrintMixin, { | 1344 dart.setSignature(_JsonPrettyPrintMixin, { |
| 1345 methods: () => ({ | 1345 methods: () => ({ |
| 1346 writeList: [dart.void, [core.List]], | 1346 writeList: [dart.void, [core.List]], |
| 1347 writeMap: [dart.void, [core.Map]] | 1347 writeMap: [dart.void, [core.Map]] |
| 1348 }) | 1348 }) |
| 1349 }); | 1349 }); |
| 1350 class _JsonStringStringifier extends _JsonStringifier { | 1350 class _JsonStringStringifier extends _JsonStringifier { |
| 1351 _JsonStringStringifier(sink, _toEncodable) { | 1351 _JsonStringStringifier(sink, _toEncodable) { |
| 1352 this[_sink] = sink; | 1352 this[_sink] = sink; |
| 1353 super._JsonStringifier(dart.as(_toEncodable, dart.functionType(core.Object
, [core.Object]))); | 1353 super._JsonStringifier(dart.as(_toEncodable, dart.functionType(core.Object
, [core.Object]))); |
| 1354 } | 1354 } |
| 1355 static stringify(object, toEncodable, indent) { | 1355 static stringify(object, toEncodable, indent) { |
| 1356 let output = new core.StringBuffer(); | 1356 let output = new core.StringBuffer(); |
| 1357 _JsonStringStringifier.printOn(object, output, toEncodable, indent); | 1357 dart.dcall(_JsonStringStringifier.printOn, object, output, toEncodable, in
dent); |
| 1358 return dart.toString(output); | 1358 return dart.dcall(output.toString); |
| 1359 } | 1359 } |
| 1360 static printOn(object, output, toEncodable, indent) { | 1360 static printOn(object, output, toEncodable, indent) { |
| 1361 let stringifier = null; | 1361 let stringifier = null; |
| 1362 if (indent == null) { | 1362 if (indent == null) { |
| 1363 stringifier = new _JsonStringStringifier(output, toEncodable); | 1363 stringifier = new _JsonStringStringifier(output, toEncodable); |
| 1364 } else { | 1364 } else { |
| 1365 stringifier = new _JsonStringStringifierPretty(output, toEncodable, inde
nt); | 1365 stringifier = new _JsonStringStringifierPretty(output, toEncodable, inde
nt); |
| 1366 } | 1366 } |
| 1367 dart.dsend(stringifier, 'writeObject', object); | 1367 dart.dsend(stringifier, 'writeObject', object); |
| 1368 } | 1368 } |
| 1369 writeNumber(number) { | 1369 writeNumber(number) { |
| 1370 this[_sink].write(dart.toString(number)); | 1370 dart.dcall(this[_sink].write, dart.dcall(number.toString)); |
| 1371 } | 1371 } |
| 1372 writeString(string) { | 1372 writeString(string) { |
| 1373 this[_sink].write(string); | 1373 dart.dcall(this[_sink].write, string); |
| 1374 } | 1374 } |
| 1375 writeStringSlice(string, start, end) { | 1375 writeStringSlice(string, start, end) { |
| 1376 this[_sink].write(string[dartx.substring](start, end)); | 1376 dart.dcall(this[_sink].write, dart.dcall(string[dartx.substring], start, e
nd)); |
| 1377 } | 1377 } |
| 1378 writeCharCode(charCode) { | 1378 writeCharCode(charCode) { |
| 1379 this[_sink].writeCharCode(charCode); | 1379 dart.dcall(this[_sink].writeCharCode, charCode); |
| 1380 } | 1380 } |
| 1381 } | 1381 } |
| 1382 dart.setSignature(_JsonStringStringifier, { | 1382 dart.setSignature(_JsonStringStringifier, { |
| 1383 constructors: () => ({_JsonStringStringifier: [_JsonStringStringifier, [core
.StringSink, dart.dynamic]]}), | 1383 constructors: () => ({_JsonStringStringifier: [_JsonStringStringifier, [core
.StringSink, dart.dynamic]]}), |
| 1384 methods: () => ({ | 1384 methods: () => ({ |
| 1385 writeNumber: [dart.void, [core.num]], | 1385 writeNumber: [dart.void, [core.num]], |
| 1386 writeString: [dart.void, [core.String]], | 1386 writeString: [dart.void, [core.String]], |
| 1387 writeStringSlice: [dart.void, [core.String, core.int, core.int]], | 1387 writeStringSlice: [dart.void, [core.String, core.int, core.int]], |
| 1388 writeCharCode: [dart.void, [core.int]] | 1388 writeCharCode: [dart.void, [core.int]] |
| 1389 }), | 1389 }), |
| 1390 statics: () => ({ | 1390 statics: () => ({ |
| 1391 stringify: [core.String, [dart.dynamic, dart.functionType(dart.dynamic, [d
art.dynamic]), core.String]], | 1391 stringify: [core.String, [dart.dynamic, dart.functionType(dart.dynamic, [d
art.dynamic]), core.String]], |
| 1392 printOn: [dart.void, [dart.dynamic, core.StringSink, dart.functionType(dar
t.dynamic, [dart.dynamic]), core.String]] | 1392 printOn: [dart.void, [dart.dynamic, core.StringSink, dart.functionType(dar
t.dynamic, [dart.dynamic]), core.String]] |
| 1393 }), | 1393 }), |
| 1394 names: ['stringify', 'printOn'] | 1394 names: ['stringify', 'printOn'] |
| 1395 }); | 1395 }); |
| 1396 class _JsonStringStringifierPretty extends dart.mixin(_JsonStringStringifier,
_JsonPrettyPrintMixin) { | 1396 class _JsonStringStringifierPretty extends dart.mixin(_JsonStringStringifier,
_JsonPrettyPrintMixin) { |
| 1397 _JsonStringStringifierPretty(sink, toEncodable, indent) { | 1397 _JsonStringStringifierPretty(sink, toEncodable, indent) { |
| 1398 this[_indent] = indent; | 1398 this[_indent] = indent; |
| 1399 super._JsonStringStringifier(sink, toEncodable); | 1399 super._JsonStringStringifier(sink, toEncodable); |
| 1400 } | 1400 } |
| 1401 writeIndentation(count) { | 1401 writeIndentation(count) { |
| 1402 for (let i = 0; dart.notNull(i) < dart.notNull(count); i = dart.notNull(i)
+ 1) | 1402 for (let i = 0; dart.notNull(i) < dart.notNull(count); i = dart.notNull(i)
+ 1) |
| 1403 this.writeString(this[_indent]); | 1403 dart.dcall(this.writeString, this[_indent]); |
| 1404 } | 1404 } |
| 1405 } | 1405 } |
| 1406 dart.setSignature(_JsonStringStringifierPretty, { | 1406 dart.setSignature(_JsonStringStringifierPretty, { |
| 1407 constructors: () => ({_JsonStringStringifierPretty: [_JsonStringStringifierP
retty, [core.StringSink, core.Function, core.String]]}), | 1407 constructors: () => ({_JsonStringStringifierPretty: [_JsonStringStringifierP
retty, [core.StringSink, core.Function, core.String]]}), |
| 1408 methods: () => ({writeIndentation: [dart.void, [core.int]]}) | 1408 methods: () => ({writeIndentation: [dart.void, [core.int]]}) |
| 1409 }); | 1409 }); |
| 1410 class _JsonUtf8Stringifier extends _JsonStringifier { | 1410 class _JsonUtf8Stringifier extends _JsonStringifier { |
| 1411 _JsonUtf8Stringifier(toEncodable, bufferSize, addChunk) { | 1411 _JsonUtf8Stringifier(toEncodable, bufferSize, addChunk) { |
| 1412 this.addChunk = addChunk; | 1412 this.addChunk = addChunk; |
| 1413 this.bufferSize = bufferSize; | 1413 this.bufferSize = bufferSize; |
| 1414 this.buffer = typed_data.Uint8List.new(bufferSize); | 1414 this.buffer = typed_data.Uint8List.new(bufferSize); |
| 1415 this.index = 0; | 1415 this.index = 0; |
| 1416 super._JsonStringifier(dart.as(toEncodable, dart.functionType(core.Object,
[core.Object]))); | 1416 super._JsonStringifier(dart.as(toEncodable, dart.functionType(core.Object,
[core.Object]))); |
| 1417 } | 1417 } |
| 1418 static stringify(object, indent, toEncodableFunction, bufferSize, addChunk)
{ | 1418 static stringify(object, indent, toEncodableFunction, bufferSize, addChunk)
{ |
| 1419 let stringifier = null; | 1419 let stringifier = null; |
| 1420 if (indent != null) { | 1420 if (indent != null) { |
| 1421 stringifier = new _JsonUtf8StringifierPretty(toEncodableFunction, indent
, bufferSize, addChunk); | 1421 stringifier = new _JsonUtf8StringifierPretty(toEncodableFunction, indent
, bufferSize, addChunk); |
| 1422 } else { | 1422 } else { |
| 1423 stringifier = new _JsonUtf8Stringifier(toEncodableFunction, bufferSize,
addChunk); | 1423 stringifier = new _JsonUtf8Stringifier(toEncodableFunction, bufferSize,
addChunk); |
| 1424 } | 1424 } |
| 1425 stringifier.writeObject(object); | 1425 dart.dcall(stringifier.writeObject, object); |
| 1426 stringifier.flush(); | 1426 dart.dcall(stringifier.flush); |
| 1427 } | 1427 } |
| 1428 flush() { | 1428 flush() { |
| 1429 if (dart.notNull(this.index) > 0) { | 1429 if (dart.notNull(this.index) > 0) { |
| 1430 dart.dcall(this.addChunk, this.buffer, 0, this.index); | 1430 dart.dcall(this.addChunk, this.buffer, 0, this.index); |
| 1431 } | 1431 } |
| 1432 this.buffer = null; | 1432 this.buffer = null; |
| 1433 this.index = 0; | 1433 this.index = 0; |
| 1434 } | 1434 } |
| 1435 writeNumber(number) { | 1435 writeNumber(number) { |
| 1436 this.writeAsciiString(dart.toString(number)); | 1436 dart.dcall(this.writeAsciiString, dart.dcall(number.toString)); |
| 1437 } | 1437 } |
| 1438 writeAsciiString(string) { | 1438 writeAsciiString(string) { |
| 1439 for (let i = 0; dart.notNull(i) < dart.notNull(string[dartx.length]); i =
dart.notNull(i) + 1) { | 1439 for (let i = 0; dart.notNull(i) < dart.notNull(string[dartx.length]); i =
dart.notNull(i) + 1) { |
| 1440 let char = string[dartx.codeUnitAt](i); | 1440 let char = dart.dcall(string[dartx.codeUnitAt], i); |
| 1441 dart.assert(dart.notNull(char) <= 127); | 1441 dart.assert(dart.notNull(char) <= 127); |
| 1442 this.writeByte(char); | 1442 dart.dcall(this.writeByte, char); |
| 1443 } | 1443 } |
| 1444 } | 1444 } |
| 1445 writeString(string) { | 1445 writeString(string) { |
| 1446 this.writeStringSlice(string, 0, string[dartx.length]); | 1446 dart.dcall(this.writeStringSlice, string, 0, string[dartx.length]); |
| 1447 } | 1447 } |
| 1448 writeStringSlice(string, start, end) { | 1448 writeStringSlice(string, start, end) { |
| 1449 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { | 1449 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { |
| 1450 let char = string[dartx.codeUnitAt](i); | 1450 let char = dart.dcall(string[dartx.codeUnitAt], i); |
| 1451 if (dart.notNull(char) <= 127) { | 1451 if (dart.notNull(char) <= 127) { |
| 1452 this.writeByte(char); | 1452 dart.dcall(this.writeByte, char); |
| 1453 } else { | 1453 } else { |
| 1454 if ((dart.notNull(char) & 64512) == 55296 && dart.notNull(i) + 1 < dar
t.notNull(end)) { | 1454 if ((dart.notNull(char) & 64512) == 55296 && dart.notNull(i) + 1 < dar
t.notNull(end)) { |
| 1455 let nextChar = string[dartx.codeUnitAt](dart.notNull(i) + 1); | 1455 let nextChar = dart.dcall(string[dartx.codeUnitAt], dart.notNull(i)
+ 1); |
| 1456 if ((dart.notNull(nextChar) & 64512) == 56320) { | 1456 if ((dart.notNull(nextChar) & 64512) == 56320) { |
| 1457 char = 65536 + ((dart.notNull(char) & 1023) << 10) + (dart.notNull
(nextChar) & 1023); | 1457 char = 65536 + ((dart.notNull(char) & 1023) << 10) + (dart.notNull
(nextChar) & 1023); |
| 1458 this.writeFourByteCharCode(char); | 1458 dart.dcall(this.writeFourByteCharCode, char); |
| 1459 i = dart.notNull(i) + 1; | 1459 i = dart.notNull(i) + 1; |
| 1460 continue; | 1460 continue; |
| 1461 } | 1461 } |
| 1462 } | 1462 } |
| 1463 this.writeMultiByteCharCode(char); | 1463 dart.dcall(this.writeMultiByteCharCode, char); |
| 1464 } | 1464 } |
| 1465 } | 1465 } |
| 1466 } | 1466 } |
| 1467 writeCharCode(charCode) { | 1467 writeCharCode(charCode) { |
| 1468 if (dart.notNull(charCode) <= 127) { | 1468 if (dart.notNull(charCode) <= 127) { |
| 1469 this.writeByte(charCode); | 1469 dart.dcall(this.writeByte, charCode); |
| 1470 return; | 1470 return; |
| 1471 } | 1471 } |
| 1472 this.writeMultiByteCharCode(charCode); | 1472 dart.dcall(this.writeMultiByteCharCode, charCode); |
| 1473 } | 1473 } |
| 1474 writeMultiByteCharCode(charCode) { | 1474 writeMultiByteCharCode(charCode) { |
| 1475 if (dart.notNull(charCode) <= 2047) { | 1475 if (dart.notNull(charCode) <= 2047) { |
| 1476 this.writeByte(192 | dart.notNull(charCode) >> 6); | 1476 dart.dcall(this.writeByte, 192 | dart.notNull(charCode) >> 6); |
| 1477 this.writeByte(128 | dart.notNull(charCode) & 63); | 1477 dart.dcall(this.writeByte, 128 | dart.notNull(charCode) & 63); |
| 1478 return; | 1478 return; |
| 1479 } | 1479 } |
| 1480 if (dart.notNull(charCode) <= 65535) { | 1480 if (dart.notNull(charCode) <= 65535) { |
| 1481 this.writeByte(224 | dart.notNull(charCode) >> 12); | 1481 dart.dcall(this.writeByte, 224 | dart.notNull(charCode) >> 12); |
| 1482 this.writeByte(128 | dart.notNull(charCode) >> 6 & 63); | 1482 dart.dcall(this.writeByte, 128 | dart.notNull(charCode) >> 6 & 63); |
| 1483 this.writeByte(128 | dart.notNull(charCode) & 63); | 1483 dart.dcall(this.writeByte, 128 | dart.notNull(charCode) & 63); |
| 1484 return; | 1484 return; |
| 1485 } | 1485 } |
| 1486 this.writeFourByteCharCode(charCode); | 1486 dart.dcall(this.writeFourByteCharCode, charCode); |
| 1487 } | 1487 } |
| 1488 writeFourByteCharCode(charCode) { | 1488 writeFourByteCharCode(charCode) { |
| 1489 dart.assert(dart.notNull(charCode) <= 1114111); | 1489 dart.assert(dart.notNull(charCode) <= 1114111); |
| 1490 this.writeByte(240 | dart.notNull(charCode) >> 18); | 1490 dart.dcall(this.writeByte, 240 | dart.notNull(charCode) >> 18); |
| 1491 this.writeByte(128 | dart.notNull(charCode) >> 12 & 63); | 1491 dart.dcall(this.writeByte, 128 | dart.notNull(charCode) >> 12 & 63); |
| 1492 this.writeByte(128 | dart.notNull(charCode) >> 6 & 63); | 1492 dart.dcall(this.writeByte, 128 | dart.notNull(charCode) >> 6 & 63); |
| 1493 this.writeByte(128 | dart.notNull(charCode) & 63); | 1493 dart.dcall(this.writeByte, 128 | dart.notNull(charCode) & 63); |
| 1494 } | 1494 } |
| 1495 writeByte(byte) { | 1495 writeByte(byte) { |
| 1496 dart.assert(dart.notNull(byte) <= 255); | 1496 dart.assert(dart.notNull(byte) <= 255); |
| 1497 if (this.index == this.buffer.length) { | 1497 if (this.index == this.buffer.length) { |
| 1498 dart.dcall(this.addChunk, this.buffer, 0, this.index); | 1498 dart.dcall(this.addChunk, this.buffer, 0, this.index); |
| 1499 this.buffer = typed_data.Uint8List.new(this.bufferSize); | 1499 this.buffer = typed_data.Uint8List.new(this.bufferSize); |
| 1500 this.index = 0; | 1500 this.index = 0; |
| 1501 } | 1501 } |
| 1502 this.buffer.set((() => { | 1502 this.buffer.set((() => { |
| 1503 let x = this.index; | 1503 let x = this.index; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1526 _JsonUtf8StringifierPretty(toEncodableFunction, indent, bufferSize, addChunk
) { | 1526 _JsonUtf8StringifierPretty(toEncodableFunction, indent, bufferSize, addChunk
) { |
| 1527 this.indent = indent; | 1527 this.indent = indent; |
| 1528 super._JsonUtf8Stringifier(toEncodableFunction, dart.as(bufferSize, core.i
nt), dart.as(addChunk, core.Function)); | 1528 super._JsonUtf8Stringifier(toEncodableFunction, dart.as(bufferSize, core.i
nt), dart.as(addChunk, core.Function)); |
| 1529 } | 1529 } |
| 1530 writeIndentation(count) { | 1530 writeIndentation(count) { |
| 1531 let indent = this.indent; | 1531 let indent = this.indent; |
| 1532 let indentLength = indent[dartx.length]; | 1532 let indentLength = indent[dartx.length]; |
| 1533 if (indentLength == 1) { | 1533 if (indentLength == 1) { |
| 1534 let char = indent[dartx.get](0); | 1534 let char = indent[dartx.get](0); |
| 1535 while (dart.notNull(count) > 0) { | 1535 while (dart.notNull(count) > 0) { |
| 1536 this.writeByte(char); | 1536 dart.dcall(this.writeByte, char); |
| 1537 count = dart.notNull(count) - 1; | 1537 count = dart.notNull(count) - 1; |
| 1538 } | 1538 } |
| 1539 return; | 1539 return; |
| 1540 } | 1540 } |
| 1541 while (dart.notNull(count) > 0) { | 1541 while (dart.notNull(count) > 0) { |
| 1542 count = dart.notNull(count) - 1; | 1542 count = dart.notNull(count) - 1; |
| 1543 let end = dart.notNull(this.index) + dart.notNull(indentLength); | 1543 let end = dart.notNull(this.index) + dart.notNull(indentLength); |
| 1544 if (dart.notNull(end) <= dart.notNull(this.buffer.length)) { | 1544 if (dart.notNull(end) <= dart.notNull(this.buffer.length)) { |
| 1545 this.buffer.setRange(this.index, end, indent); | 1545 dart.dcall(this.buffer.setRange, this.index, end, indent); |
| 1546 this.index = end; | 1546 this.index = end; |
| 1547 } else { | 1547 } else { |
| 1548 for (let i = 0; dart.notNull(i) < dart.notNull(indentLength); i = dart
.notNull(i) + 1) { | 1548 for (let i = 0; dart.notNull(i) < dart.notNull(indentLength); i = dart
.notNull(i) + 1) { |
| 1549 this.writeByte(indent[dartx.get](i)); | 1549 dart.dcall(this.writeByte, indent[dartx.get](i)); |
| 1550 } | 1550 } |
| 1551 } | 1551 } |
| 1552 } | 1552 } |
| 1553 } | 1553 } |
| 1554 } | 1554 } |
| 1555 dart.setSignature(_JsonUtf8StringifierPretty, { | 1555 dart.setSignature(_JsonUtf8StringifierPretty, { |
| 1556 constructors: () => ({_JsonUtf8StringifierPretty: [_JsonUtf8StringifierPrett
y, [dart.dynamic, core.List$(core.int), dart.dynamic, dart.dynamic]]}), | 1556 constructors: () => ({_JsonUtf8StringifierPretty: [_JsonUtf8StringifierPrett
y, [dart.dynamic, core.List$(core.int), dart.dynamic, dart.dynamic]]}), |
| 1557 methods: () => ({writeIndentation: [dart.void, [core.int]]}) | 1557 methods: () => ({writeIndentation: [dart.void, [core.int]]}) |
| 1558 }); | 1558 }); |
| 1559 let __CastType0 = dart.typedef('__CastType0', () => dart.functionType(core.Obj
ect, [core.Object])); | 1559 let __CastType0 = dart.typedef('__CastType0', () => dart.functionType(core.Obj
ect, [core.Object])); |
| 1560 let __CastType2 = dart.typedef('__CastType2', () => dart.functionType(dart.dyn
amic, [dart.dynamic])); | 1560 let __CastType2 = dart.typedef('__CastType2', () => dart.functionType(dart.dyn
amic, [core.Object])); |
| 1561 let __CastType4 = dart.typedef('__CastType4', () => dart.functionType(dart.dyn
amic, [core.Object])); | |
| 1562 class Latin1Codec extends Encoding { | 1561 class Latin1Codec extends Encoding { |
| 1563 Latin1Codec(opts) { | 1562 Latin1Codec(opts) { |
| 1564 let allowInvalid = opts && 'allowInvalid' in opts ? opts.allowInvalid : fa
lse; | 1563 let allowInvalid = opts && 'allowInvalid' in opts ? opts.allowInvalid : fa
lse; |
| 1565 this[_allowInvalid] = allowInvalid; | 1564 this[_allowInvalid] = allowInvalid; |
| 1566 super.Encoding(); | 1565 super.Encoding(); |
| 1567 } | 1566 } |
| 1568 get name() { | 1567 get name() { |
| 1569 return "iso-8859-1"; | 1568 return "iso-8859-1"; |
| 1570 } | 1569 } |
| 1571 decode(bytes, opts) { | 1570 decode(bytes, opts) { |
| 1572 let allowInvalid = opts && 'allowInvalid' in opts ? opts.allowInvalid : nu
ll; | 1571 let allowInvalid = opts && 'allowInvalid' in opts ? opts.allowInvalid : nu
ll; |
| 1573 if (allowInvalid == null) | 1572 if (allowInvalid == null) |
| 1574 allowInvalid = this[_allowInvalid]; | 1573 allowInvalid = this[_allowInvalid]; |
| 1575 if (dart.notNull(allowInvalid)) { | 1574 if (dart.notNull(allowInvalid)) { |
| 1576 return dart.const(new Latin1Decoder({allowInvalid: true})).convert(bytes
); | 1575 return dart.dcall(dart.const(new Latin1Decoder({allowInvalid: true})).co
nvert, bytes); |
| 1577 } else { | 1576 } else { |
| 1578 return dart.const(new Latin1Decoder({allowInvalid: false})).convert(byte
s); | 1577 return dart.dcall(dart.const(new Latin1Decoder({allowInvalid: false})).c
onvert, bytes); |
| 1579 } | 1578 } |
| 1580 } | 1579 } |
| 1581 get encoder() { | 1580 get encoder() { |
| 1582 return dart.const(new Latin1Encoder()); | 1581 return dart.const(new Latin1Encoder()); |
| 1583 } | 1582 } |
| 1584 get decoder() { | 1583 get decoder() { |
| 1585 return dart.notNull(this[_allowInvalid]) ? dart.const(new Latin1Decoder({a
llowInvalid: true})) : dart.const(new Latin1Decoder({allowInvalid: false})); | 1584 return dart.notNull(this[_allowInvalid]) ? dart.const(new Latin1Decoder({a
llowInvalid: true})) : dart.const(new Latin1Decoder({allowInvalid: false})); |
| 1586 } | 1585 } |
| 1587 } | 1586 } |
| 1588 dart.setSignature(Latin1Codec, { | 1587 dart.setSignature(Latin1Codec, { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1619 dart.setSignature(Latin1Decoder, { | 1618 dart.setSignature(Latin1Decoder, { |
| 1620 constructors: () => ({Latin1Decoder: [Latin1Decoder, [], {allowInvalid: core
.bool}]}), | 1619 constructors: () => ({Latin1Decoder: [Latin1Decoder, [], {allowInvalid: core
.bool}]}), |
| 1621 methods: () => ({startChunkedConversion: [ByteConversionSink, [core.Sink$(co
re.String)]]}) | 1620 methods: () => ({startChunkedConversion: [ByteConversionSink, [core.Sink$(co
re.String)]]}) |
| 1622 }); | 1621 }); |
| 1623 let _addSliceToSink = Symbol('_addSliceToSink'); | 1622 let _addSliceToSink = Symbol('_addSliceToSink'); |
| 1624 class _Latin1DecoderSink extends ByteConversionSinkBase { | 1623 class _Latin1DecoderSink extends ByteConversionSinkBase { |
| 1625 _Latin1DecoderSink(sink) { | 1624 _Latin1DecoderSink(sink) { |
| 1626 this[_sink] = sink; | 1625 this[_sink] = sink; |
| 1627 } | 1626 } |
| 1628 close() { | 1627 close() { |
| 1629 this[_sink].close(); | 1628 dart.dcall(this[_sink].close); |
| 1630 } | 1629 } |
| 1631 add(source) { | 1630 add(source) { |
| 1632 this.addSlice(source, 0, source[dartx.length], false); | 1631 dart.dcall(this.addSlice, source, 0, source[dartx.length], false); |
| 1633 } | 1632 } |
| 1634 [_addSliceToSink](source, start, end, isLast) { | 1633 [_addSliceToSink](source, start, end, isLast) { |
| 1635 this[_sink].add(core.String.fromCharCodes(source, start, end)); | 1634 dart.dcall(this[_sink].add, core.String.fromCharCodes(source, start, end))
; |
| 1636 if (dart.notNull(isLast)) | 1635 if (dart.notNull(isLast)) |
| 1637 this.close(); | 1636 dart.dcall(this.close); |
| 1638 } | 1637 } |
| 1639 addSlice(source, start, end, isLast) { | 1638 addSlice(source, start, end, isLast) { |
| 1640 core.RangeError.checkValidRange(start, end, source[dartx.length]); | 1639 dart.dcall(core.RangeError.checkValidRange, start, end, source[dartx.lengt
h]); |
| 1641 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { | 1640 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { |
| 1642 let char = source[dartx.get](i); | 1641 let char = source[dartx.get](i); |
| 1643 if (dart.notNull(char) > dart.notNull(_LATIN1_MASK) || dart.notNull(char
) < 0) { | 1642 if (dart.notNull(char) > dart.notNull(_LATIN1_MASK) || dart.notNull(char
) < 0) { |
| 1644 dart.throw(new core.FormatException("Source contains non-Latin-1 chara
cters.")); | 1643 dart.throw(new core.FormatException("Source contains non-Latin-1 chara
cters.")); |
| 1645 } | 1644 } |
| 1646 } | 1645 } |
| 1647 if (dart.notNull(start) < dart.notNull(end)) { | 1646 if (dart.notNull(start) < dart.notNull(end)) { |
| 1648 this[_addSliceToSink](source, start, end, isLast); | 1647 dart.dcall(this[_addSliceToSink], source, start, end, isLast); |
| 1649 } | 1648 } |
| 1650 if (dart.notNull(isLast)) { | 1649 if (dart.notNull(isLast)) { |
| 1651 this.close(); | 1650 dart.dcall(this.close); |
| 1652 } | 1651 } |
| 1653 } | 1652 } |
| 1654 } | 1653 } |
| 1655 dart.setSignature(_Latin1DecoderSink, { | 1654 dart.setSignature(_Latin1DecoderSink, { |
| 1656 constructors: () => ({_Latin1DecoderSink: [_Latin1DecoderSink, [StringConver
sionSink]]}), | 1655 constructors: () => ({_Latin1DecoderSink: [_Latin1DecoderSink, [StringConver
sionSink]]}), |
| 1657 methods: () => ({ | 1656 methods: () => ({ |
| 1658 close: [dart.void, []], | 1657 close: [dart.void, []], |
| 1659 add: [dart.void, [core.List$(core.int)]], | 1658 add: [dart.void, [core.List$(core.int)]], |
| 1660 [_addSliceToSink]: [dart.void, [core.List$(core.int), core.int, core.int,
core.bool]] | 1659 [_addSliceToSink]: [dart.void, [core.List$(core.int), core.int, core.int,
core.bool]] |
| 1661 }) | 1660 }) |
| 1662 }); | 1661 }); |
| 1663 class _Latin1AllowInvalidDecoderSink extends _Latin1DecoderSink { | 1662 class _Latin1AllowInvalidDecoderSink extends _Latin1DecoderSink { |
| 1664 _Latin1AllowInvalidDecoderSink(sink) { | 1663 _Latin1AllowInvalidDecoderSink(sink) { |
| 1665 super._Latin1DecoderSink(sink); | 1664 super._Latin1DecoderSink(sink); |
| 1666 } | 1665 } |
| 1667 addSlice(source, start, end, isLast) { | 1666 addSlice(source, start, end, isLast) { |
| 1668 core.RangeError.checkValidRange(start, end, source[dartx.length]); | 1667 dart.dcall(core.RangeError.checkValidRange, start, end, source[dartx.lengt
h]); |
| 1669 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { | 1668 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { |
| 1670 let char = source[dartx.get](i); | 1669 let char = source[dartx.get](i); |
| 1671 if (dart.notNull(char) > dart.notNull(_LATIN1_MASK) || dart.notNull(char
) < 0) { | 1670 if (dart.notNull(char) > dart.notNull(_LATIN1_MASK) || dart.notNull(char
) < 0) { |
| 1672 if (dart.notNull(i) > dart.notNull(start)) | 1671 if (dart.notNull(i) > dart.notNull(start)) |
| 1673 this[_addSliceToSink](source, start, i, false); | 1672 dart.dcall(this[_addSliceToSink], source, start, i, false); |
| 1674 this[_addSliceToSink](dart.const(dart.list([65533], core.int)), 0, 1,
false); | 1673 dart.dcall(this[_addSliceToSink], dart.const([65533]), 0, 1, false); |
| 1675 start = dart.notNull(i) + 1; | 1674 start = dart.notNull(i) + 1; |
| 1676 } | 1675 } |
| 1677 } | 1676 } |
| 1678 if (dart.notNull(start) < dart.notNull(end)) { | 1677 if (dart.notNull(start) < dart.notNull(end)) { |
| 1679 this[_addSliceToSink](source, start, end, isLast); | 1678 dart.dcall(this[_addSliceToSink], source, start, end, isLast); |
| 1680 } | 1679 } |
| 1681 if (dart.notNull(isLast)) { | 1680 if (dart.notNull(isLast)) { |
| 1682 this.close(); | 1681 dart.dcall(this.close); |
| 1683 } | 1682 } |
| 1684 } | 1683 } |
| 1685 } | 1684 } |
| 1686 dart.setSignature(_Latin1AllowInvalidDecoderSink, { | 1685 dart.setSignature(_Latin1AllowInvalidDecoderSink, { |
| 1687 constructors: () => ({_Latin1AllowInvalidDecoderSink: [_Latin1AllowInvalidDe
coderSink, [StringConversionSink]]}) | 1686 constructors: () => ({_Latin1AllowInvalidDecoderSink: [_Latin1AllowInvalidDe
coderSink, [StringConversionSink]]}) |
| 1688 }); | 1687 }); |
| 1689 class LineSplitter extends Converter$(core.String, core.List$(core.String)) { | 1688 class LineSplitter extends Converter$(core.String, core.List$(core.String)) { |
| 1690 LineSplitter() { | 1689 LineSplitter() { |
| 1691 super.Converter(); | 1690 super.Converter(); |
| 1692 } | 1691 } |
| 1693 convert(data) { | 1692 convert(data) { |
| 1694 let lines = core.List$(core.String).new(); | 1693 let lines = core.List$(core.String).new(); |
| 1695 _LineSplitterSink._addSlice(data, 0, data[dartx.length], true, dart.bind(l
ines, dartx.add)); | 1694 dart.dcall(_LineSplitterSink._addSlice, data, 0, data[dartx.length], true,
dart.dload(lines, 'add')); |
| 1696 return lines; | 1695 return dart.as(lines, core.List$(core.String)); |
| 1697 } | 1696 } |
| 1698 startChunkedConversion(sink) { | 1697 startChunkedConversion(sink) { |
| 1699 if (!dart.is(sink, StringConversionSink)) { | 1698 if (!dart.is(sink, StringConversionSink)) { |
| 1700 sink = StringConversionSink.from(dart.as(sink, core.Sink$(core.String)))
; | 1699 sink = StringConversionSink.from(dart.as(sink, core.Sink$(core.String)))
; |
| 1701 } | 1700 } |
| 1702 return new _LineSplitterSink(dart.as(sink, StringConversionSink)); | 1701 return new _LineSplitterSink(dart.as(sink, StringConversionSink)); |
| 1703 } | 1702 } |
| 1704 } | 1703 } |
| 1705 dart.setSignature(LineSplitter, { | 1704 dart.setSignature(LineSplitter, { |
| 1706 constructors: () => ({LineSplitter: [LineSplitter, []]}), | 1705 constructors: () => ({LineSplitter: [LineSplitter, []]}), |
| 1707 methods: () => ({ | 1706 methods: () => ({ |
| 1708 convert: [core.List$(core.String), [core.String]], | 1707 convert: [core.List$(core.String), [core.String]], |
| 1709 startChunkedConversion: [StringConversionSink, [core.Sink]] | 1708 startChunkedConversion: [StringConversionSink, [core.Sink]] |
| 1710 }) | 1709 }) |
| 1711 }); | 1710 }); |
| 1712 let _carry = Symbol('_carry'); | 1711 let _carry = Symbol('_carry'); |
| 1713 class _LineSplitterSink extends StringConversionSinkBase { | 1712 class _LineSplitterSink extends StringConversionSinkBase { |
| 1714 _LineSplitterSink(sink) { | 1713 _LineSplitterSink(sink) { |
| 1715 this[_sink] = sink; | 1714 this[_sink] = sink; |
| 1716 this[_carry] = null; | 1715 this[_carry] = null; |
| 1717 } | 1716 } |
| 1718 addSlice(chunk, start, end, isLast) { | 1717 addSlice(chunk, start, end, isLast) { |
| 1719 if (this[_carry] != null) { | 1718 if (this[_carry] != null) { |
| 1720 chunk = dart.notNull(this[_carry]) + dart.notNull(chunk[dartx.substring]
(start, end)); | 1719 chunk = dart.notNull(this[_carry]) + dart.notNull(dart.dcall(chunk[dartx
.substring], start, end)); |
| 1721 start = 0; | 1720 start = 0; |
| 1722 end = chunk[dartx.length]; | 1721 end = chunk[dartx.length]; |
| 1723 this[_carry] = null; | 1722 this[_carry] = null; |
| 1724 } | 1723 } |
| 1725 this[_carry] = _LineSplitterSink._addSlice(chunk, start, end, isLast, dart
.bind(this[_sink], 'add')); | 1724 this[_carry] = dart.dcall(_LineSplitterSink._addSlice, chunk, start, end,
isLast, dart.bind(this[_sink], 'add')); |
| 1726 if (dart.notNull(isLast)) | 1725 if (dart.notNull(isLast)) |
| 1727 this[_sink].close(); | 1726 dart.dcall(this[_sink].close); |
| 1728 } | 1727 } |
| 1729 close() { | 1728 close() { |
| 1730 this.addSlice('', 0, 0, true); | 1729 dart.dcall(this.addSlice, '', 0, 0, true); |
| 1731 } | 1730 } |
| 1732 static _addSlice(chunk, start, end, isLast, adder) { | 1731 static _addSlice(chunk, start, end, isLast, adder) { |
| 1733 let pos = start; | 1732 let pos = start; |
| 1734 while (dart.notNull(pos) < dart.notNull(end)) { | 1733 while (dart.notNull(pos) < dart.notNull(end)) { |
| 1735 let skip = 0; | 1734 let skip = 0; |
| 1736 let char = chunk[dartx.codeUnitAt](pos); | 1735 let char = dart.dcall(chunk[dartx.codeUnitAt], pos); |
| 1737 if (char == _LineSplitterSink._LF) { | 1736 if (char == _LineSplitterSink._LF) { |
| 1738 skip = 1; | 1737 skip = 1; |
| 1739 } else if (char == _LineSplitterSink._CR) { | 1738 } else if (char == _LineSplitterSink._CR) { |
| 1740 skip = 1; | 1739 skip = 1; |
| 1741 if (dart.notNull(pos) + 1 < dart.notNull(end)) { | 1740 if (dart.notNull(pos) + 1 < dart.notNull(end)) { |
| 1742 if (chunk[dartx.codeUnitAt](dart.notNull(pos) + 1) == _LineSplitterS
ink._LF) { | 1741 if (dart.dcall(chunk[dartx.codeUnitAt], dart.notNull(pos) + 1) == _L
ineSplitterSink._LF) { |
| 1743 skip = 2; | 1742 skip = 2; |
| 1744 } | 1743 } |
| 1745 } else if (!dart.notNull(isLast)) { | 1744 } else if (!dart.notNull(isLast)) { |
| 1746 return chunk[dartx.substring](start, end); | 1745 return dart.dcall(chunk[dartx.substring], start, end); |
| 1747 } | 1746 } |
| 1748 } | 1747 } |
| 1749 if (dart.notNull(skip) > 0) { | 1748 if (dart.notNull(skip) > 0) { |
| 1750 adder(chunk[dartx.substring](start, pos)); | 1749 adder(dart.dcall(chunk[dartx.substring], start, pos)); |
| 1751 start = pos = dart.notNull(pos) + dart.notNull(skip); | 1750 start = pos = dart.notNull(pos) + dart.notNull(skip); |
| 1752 } else { | 1751 } else { |
| 1753 pos = dart.notNull(pos) + 1; | 1752 pos = dart.notNull(pos) + 1; |
| 1754 } | 1753 } |
| 1755 } | 1754 } |
| 1756 if (pos != start) { | 1755 if (pos != start) { |
| 1757 let carry = chunk[dartx.substring](start, pos); | 1756 let carry = dart.dcall(chunk[dartx.substring], start, pos); |
| 1758 if (dart.notNull(isLast)) { | 1757 if (dart.notNull(isLast)) { |
| 1759 adder(carry); | 1758 adder(dart.as(carry, core.String)); |
| 1760 } else { | 1759 } else { |
| 1761 return carry; | 1760 return dart.as(carry, core.String); |
| 1762 } | 1761 } |
| 1763 } | 1762 } |
| 1764 return null; | 1763 return null; |
| 1765 } | 1764 } |
| 1766 } | 1765 } |
| 1767 dart.setSignature(_LineSplitterSink, { | 1766 dart.setSignature(_LineSplitterSink, { |
| 1768 constructors: () => ({_LineSplitterSink: [_LineSplitterSink, [StringConversi
onSink]]}), | 1767 constructors: () => ({_LineSplitterSink: [_LineSplitterSink, [StringConversi
onSink]]}), |
| 1769 methods: () => ({ | 1768 methods: () => ({ |
| 1770 addSlice: [dart.void, [core.String, core.int, core.int, core.bool]], | 1769 addSlice: [dart.void, [core.String, core.int, core.int, core.bool]], |
| 1771 close: [dart.void, []] | 1770 close: [dart.void, []] |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1805 dart.setSignature(ClosableStringSink, { | 1804 dart.setSignature(ClosableStringSink, { |
| 1806 constructors: () => ({fromStringSink: [ClosableStringSink, [core.StringSink,
dart.functionType(dart.void, [])]]}) | 1805 constructors: () => ({fromStringSink: [ClosableStringSink, [core.StringSink,
dart.functionType(dart.void, [])]]}) |
| 1807 }); | 1806 }); |
| 1808 let _StringSinkCloseCallback = dart.typedef('_StringSinkCloseCallback', () =>
dart.functionType(dart.void, [])); | 1807 let _StringSinkCloseCallback = dart.typedef('_StringSinkCloseCallback', () =>
dart.functionType(dart.void, [])); |
| 1809 class _ClosableStringSink extends core.Object { | 1808 class _ClosableStringSink extends core.Object { |
| 1810 _ClosableStringSink(sink, callback) { | 1809 _ClosableStringSink(sink, callback) { |
| 1811 this[_sink] = sink; | 1810 this[_sink] = sink; |
| 1812 this[_callback] = callback; | 1811 this[_callback] = callback; |
| 1813 } | 1812 } |
| 1814 close() { | 1813 close() { |
| 1815 return this[_callback](); | 1814 return dart.dcall(this[_callback]); |
| 1816 } | 1815 } |
| 1817 writeCharCode(charCode) { | 1816 writeCharCode(charCode) { |
| 1818 return this[_sink].writeCharCode(charCode); | 1817 return dart.dcall(this[_sink].writeCharCode, charCode); |
| 1819 } | 1818 } |
| 1820 write(o) { | 1819 write(o) { |
| 1821 return this[_sink].write(o); | 1820 return dart.dcall(this[_sink].write, o); |
| 1822 } | 1821 } |
| 1823 writeln(o) { | 1822 writeln(o) { |
| 1824 if (o === void 0) | 1823 if (o === void 0) |
| 1825 o = ""; | 1824 o = ""; |
| 1826 return this[_sink].writeln(o); | 1825 return dart.dcall(this[_sink].writeln, o); |
| 1827 } | 1826 } |
| 1828 writeAll(objects, separator) { | 1827 writeAll(objects, separator) { |
| 1829 if (separator === void 0) | 1828 if (separator === void 0) |
| 1830 separator = ""; | 1829 separator = ""; |
| 1831 return this[_sink].writeAll(objects, separator); | 1830 return dart.dcall(this[_sink].writeAll, objects, separator); |
| 1832 } | 1831 } |
| 1833 } | 1832 } |
| 1834 _ClosableStringSink[dart.implements] = () => [ClosableStringSink]; | 1833 _ClosableStringSink[dart.implements] = () => [ClosableStringSink]; |
| 1835 dart.setSignature(_ClosableStringSink, { | 1834 dart.setSignature(_ClosableStringSink, { |
| 1836 constructors: () => ({_ClosableStringSink: [_ClosableStringSink, [core.Strin
gSink, _StringSinkCloseCallback]]}), | 1835 constructors: () => ({_ClosableStringSink: [_ClosableStringSink, [core.Strin
gSink, _StringSinkCloseCallback]]}), |
| 1837 methods: () => ({ | 1836 methods: () => ({ |
| 1838 close: [dart.void, []], | 1837 close: [dart.void, []], |
| 1839 writeCharCode: [dart.void, [core.int]], | 1838 writeCharCode: [dart.void, [core.int]], |
| 1840 write: [dart.void, [core.Object]], | 1839 write: [dart.void, [core.Object]], |
| 1841 writeln: [dart.void, [], [core.Object]], | 1840 writeln: [dart.void, [], [core.Object]], |
| 1842 writeAll: [dart.void, [core.Iterable], [core.String]] | 1841 writeAll: [dart.void, [core.Iterable], [core.String]] |
| 1843 }) | 1842 }) |
| 1844 }); | 1843 }); |
| 1845 let _flush = Symbol('_flush'); | 1844 let _flush = Symbol('_flush'); |
| 1846 class _StringConversionSinkAsStringSinkAdapter extends core.Object { | 1845 class _StringConversionSinkAsStringSinkAdapter extends core.Object { |
| 1847 _StringConversionSinkAsStringSinkAdapter(chunkedSink) { | 1846 _StringConversionSinkAsStringSinkAdapter(chunkedSink) { |
| 1848 this[_chunkedSink] = chunkedSink; | 1847 this[_chunkedSink] = chunkedSink; |
| 1849 this[_buffer] = new core.StringBuffer(); | 1848 this[_buffer] = new core.StringBuffer(); |
| 1850 } | 1849 } |
| 1851 close() { | 1850 close() { |
| 1852 if (dart.notNull(this[_buffer].isNotEmpty)) | 1851 if (dart.notNull(this[_buffer].isNotEmpty)) |
| 1853 this[_flush](); | 1852 dart.dcall(this[_flush]); |
| 1854 this[_chunkedSink].close(); | 1853 dart.dcall(this[_chunkedSink].close); |
| 1855 } | 1854 } |
| 1856 writeCharCode(charCode) { | 1855 writeCharCode(charCode) { |
| 1857 this[_buffer].writeCharCode(charCode); | 1856 dart.dcall(this[_buffer].writeCharCode, charCode); |
| 1858 if (dart.notNull(this[_buffer].length) > dart.notNull(_StringConversionSin
kAsStringSinkAdapter._MIN_STRING_SIZE)) | 1857 if (dart.notNull(this[_buffer].length) > dart.notNull(dart.as(_StringConve
rsionSinkAsStringSinkAdapter._MIN_STRING_SIZE, core.num))) |
| 1859 this[_flush](); | 1858 dart.dcall(this[_flush]); |
| 1860 } | 1859 } |
| 1861 write(o) { | 1860 write(o) { |
| 1862 if (dart.notNull(this[_buffer].isNotEmpty)) | 1861 if (dart.notNull(this[_buffer].isNotEmpty)) |
| 1863 this[_flush](); | 1862 dart.dcall(this[_flush]); |
| 1864 let str = dart.toString(o); | 1863 let str = dart.dcall(o.toString); |
| 1865 this[_chunkedSink].add(dart.toString(o)); | 1864 dart.dcall(this[_chunkedSink].add, dart.dcall(o.toString)); |
| 1866 } | 1865 } |
| 1867 writeln(o) { | 1866 writeln(o) { |
| 1868 if (o === void 0) | 1867 if (o === void 0) |
| 1869 o = ""; | 1868 o = ""; |
| 1870 this[_buffer].writeln(o); | 1869 dart.dcall(this[_buffer].writeln, o); |
| 1871 if (dart.notNull(this[_buffer].length) > dart.notNull(_StringConversionSin
kAsStringSinkAdapter._MIN_STRING_SIZE)) | 1870 if (dart.notNull(this[_buffer].length) > dart.notNull(dart.as(_StringConve
rsionSinkAsStringSinkAdapter._MIN_STRING_SIZE, core.num))) |
| 1872 this[_flush](); | 1871 dart.dcall(this[_flush]); |
| 1873 } | 1872 } |
| 1874 writeAll(objects, separator) { | 1873 writeAll(objects, separator) { |
| 1875 if (separator === void 0) | 1874 if (separator === void 0) |
| 1876 separator = ""; | 1875 separator = ""; |
| 1877 if (dart.notNull(this[_buffer].isNotEmpty)) | 1876 if (dart.notNull(this[_buffer].isNotEmpty)) |
| 1878 this[_flush](); | 1877 dart.dcall(this[_flush]); |
| 1879 let iterator = objects[dartx.iterator]; | 1878 let iterator = objects[dartx.iterator]; |
| 1880 if (!dart.notNull(iterator.moveNext())) | 1879 if (!dart.notNull(dart.dcall(iterator.moveNext))) |
| 1881 return; | 1880 return; |
| 1882 if (dart.notNull(separator[dartx.isEmpty])) { | 1881 if (dart.notNull(separator[dartx.isEmpty])) { |
| 1883 do { | 1882 do { |
| 1884 this[_chunkedSink].add(dart.toString(iterator.current)); | 1883 dart.dcall(this[_chunkedSink].add, dart.dsend(iterator.current, 'toStr
ing')); |
| 1885 } while (dart.notNull(iterator.moveNext())); | 1884 } while (dart.notNull(dart.dcall(iterator.moveNext))); |
| 1886 } else { | 1885 } else { |
| 1887 this[_chunkedSink].add(dart.toString(iterator.current)); | 1886 dart.dcall(this[_chunkedSink].add, dart.dsend(iterator.current, 'toStrin
g')); |
| 1888 while (dart.notNull(iterator.moveNext())) { | 1887 while (dart.notNull(dart.dcall(iterator.moveNext))) { |
| 1889 this.write(separator); | 1888 dart.dcall(this.write, separator); |
| 1890 this[_chunkedSink].add(dart.toString(iterator.current)); | 1889 dart.dcall(this[_chunkedSink].add, dart.dsend(iterator.current, 'toStr
ing')); |
| 1891 } | 1890 } |
| 1892 } | 1891 } |
| 1893 } | 1892 } |
| 1894 [_flush]() { | 1893 [_flush]() { |
| 1895 let accumulated = dart.toString(this[_buffer]); | 1894 let accumulated = dart.dcall(this[_buffer].toString); |
| 1896 this[_buffer].clear(); | 1895 dart.dcall(this[_buffer].clear); |
| 1897 this[_chunkedSink].add(accumulated); | 1896 dart.dcall(this[_chunkedSink].add, accumulated); |
| 1898 } | 1897 } |
| 1899 } | 1898 } |
| 1900 _StringConversionSinkAsStringSinkAdapter[dart.implements] = () => [ClosableStr
ingSink]; | 1899 _StringConversionSinkAsStringSinkAdapter[dart.implements] = () => [ClosableStr
ingSink]; |
| 1901 dart.setSignature(_StringConversionSinkAsStringSinkAdapter, { | 1900 dart.setSignature(_StringConversionSinkAsStringSinkAdapter, { |
| 1902 constructors: () => ({_StringConversionSinkAsStringSinkAdapter: [_StringConv
ersionSinkAsStringSinkAdapter, [StringConversionSink]]}), | 1901 constructors: () => ({_StringConversionSinkAsStringSinkAdapter: [_StringConv
ersionSinkAsStringSinkAdapter, [StringConversionSink]]}), |
| 1903 methods: () => ({ | 1902 methods: () => ({ |
| 1904 close: [dart.void, []], | 1903 close: [dart.void, []], |
| 1905 writeCharCode: [dart.void, [core.int]], | 1904 writeCharCode: [dart.void, [core.int]], |
| 1906 write: [dart.void, [core.Object]], | 1905 write: [dart.void, [core.Object]], |
| 1907 writeln: [dart.void, [], [core.Object]], | 1906 writeln: [dart.void, [], [core.Object]], |
| 1908 writeAll: [dart.void, [core.Iterable], [core.String]], | 1907 writeAll: [dart.void, [core.Iterable], [core.String]], |
| 1909 [_flush]: [dart.void, []] | 1908 [_flush]: [dart.void, []] |
| 1910 }) | 1909 }) |
| 1911 }); | 1910 }); |
| 1912 _StringConversionSinkAsStringSinkAdapter._MIN_STRING_SIZE = 16; | 1911 _StringConversionSinkAsStringSinkAdapter._MIN_STRING_SIZE = 16; |
| 1913 let _stringSink = Symbol('_stringSink'); | 1912 let _stringSink = Symbol('_stringSink'); |
| 1914 class _StringSinkConversionSink extends StringConversionSinkBase { | 1913 class _StringSinkConversionSink extends StringConversionSinkBase { |
| 1915 _StringSinkConversionSink(stringSink) { | 1914 _StringSinkConversionSink(stringSink) { |
| 1916 this[_stringSink] = stringSink; | 1915 this[_stringSink] = stringSink; |
| 1917 } | 1916 } |
| 1918 close() {} | 1917 close() {} |
| 1919 addSlice(str, start, end, isLast) { | 1918 addSlice(str, start, end, isLast) { |
| 1920 if (start != 0 || end != str[dartx.length]) { | 1919 if (start != 0 || end != str[dartx.length]) { |
| 1921 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNul
l(i) + 1) { | 1920 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNul
l(i) + 1) { |
| 1922 this[_stringSink].writeCharCode(str[dartx.codeUnitAt](i)); | 1921 dart.dcall(this[_stringSink].writeCharCode, dart.dcall(str[dartx.codeU
nitAt], i)); |
| 1923 } | 1922 } |
| 1924 } else { | 1923 } else { |
| 1925 this[_stringSink].write(str); | 1924 dart.dcall(this[_stringSink].write, str); |
| 1926 } | 1925 } |
| 1927 if (dart.notNull(isLast)) | 1926 if (dart.notNull(isLast)) |
| 1928 this.close(); | 1927 dart.dcall(this.close); |
| 1929 } | 1928 } |
| 1930 add(str) { | 1929 add(str) { |
| 1931 return this[_stringSink].write(str); | 1930 return dart.dcall(this[_stringSink].write, str); |
| 1932 } | 1931 } |
| 1933 asUtf8Sink(allowMalformed) { | 1932 asUtf8Sink(allowMalformed) { |
| 1934 return new _Utf8StringSinkAdapter(this, this[_stringSink], allowMalformed)
; | 1933 return new _Utf8StringSinkAdapter(this, this[_stringSink], allowMalformed)
; |
| 1935 } | 1934 } |
| 1936 asStringSink() { | 1935 asStringSink() { |
| 1937 return ClosableStringSink.fromStringSink(this[_stringSink], dart.bind(this
, 'close')); | 1936 return ClosableStringSink.fromStringSink(this[_stringSink], dart.bind(this
, 'close')); |
| 1938 } | 1937 } |
| 1939 } | 1938 } |
| 1940 dart.setSignature(_StringSinkConversionSink, { | 1939 dart.setSignature(_StringSinkConversionSink, { |
| 1941 constructors: () => ({_StringSinkConversionSink: [_StringSinkConversionSink,
[core.StringSink]]}), | 1940 constructors: () => ({_StringSinkConversionSink: [_StringSinkConversionSink,
[core.StringSink]]}), |
| 1942 methods: () => ({ | 1941 methods: () => ({ |
| 1943 close: [dart.void, []], | 1942 close: [dart.void, []], |
| 1944 addSlice: [dart.void, [core.String, core.int, core.int, core.bool]] | 1943 addSlice: [dart.void, [core.String, core.int, core.int, core.bool]] |
| 1945 }) | 1944 }) |
| 1946 }); | 1945 }); |
| 1947 class _StringCallbackSink extends _StringSinkConversionSink { | 1946 class _StringCallbackSink extends _StringSinkConversionSink { |
| 1948 _StringCallbackSink(callback) { | 1947 _StringCallbackSink(callback) { |
| 1949 this[_callback] = callback; | 1948 this[_callback] = callback; |
| 1950 super._StringSinkConversionSink(new core.StringBuffer()); | 1949 super._StringSinkConversionSink(new core.StringBuffer()); |
| 1951 } | 1950 } |
| 1952 close() { | 1951 close() { |
| 1953 let buffer = dart.as(this[_stringSink], core.StringBuffer); | 1952 let buffer = dart.as(this[_stringSink], core.StringBuffer); |
| 1954 let accumulated = dart.toString(buffer); | 1953 let accumulated = dart.dcall(buffer.toString); |
| 1955 buffer.clear(); | 1954 dart.dcall(buffer.clear); |
| 1956 this[_callback](accumulated); | 1955 dart.dcall(this[_callback], accumulated); |
| 1957 } | 1956 } |
| 1958 asUtf8Sink(allowMalformed) { | 1957 asUtf8Sink(allowMalformed) { |
| 1959 return new _Utf8StringSinkAdapter(this, this[_stringSink], allowMalformed)
; | 1958 return new _Utf8StringSinkAdapter(this, this[_stringSink], allowMalformed)
; |
| 1960 } | 1959 } |
| 1961 } | 1960 } |
| 1962 dart.setSignature(_StringCallbackSink, { | 1961 dart.setSignature(_StringCallbackSink, { |
| 1963 constructors: () => ({_StringCallbackSink: [_StringCallbackSink, [_ChunkedCo
nversionCallback$(core.String)]]}) | 1962 constructors: () => ({_StringCallbackSink: [_StringCallbackSink, [_ChunkedCo
nversionCallback$(core.String)]]}) |
| 1964 }); | 1963 }); |
| 1965 class _StringAdapterSink extends StringConversionSinkBase { | 1964 class _StringAdapterSink extends StringConversionSinkBase { |
| 1966 _StringAdapterSink(sink) { | 1965 _StringAdapterSink(sink) { |
| 1967 this[_sink] = sink; | 1966 this[_sink] = sink; |
| 1968 } | 1967 } |
| 1969 add(str) { | 1968 add(str) { |
| 1970 return this[_sink].add(str); | 1969 return dart.dcall(this[_sink].add, str); |
| 1971 } | 1970 } |
| 1972 addSlice(str, start, end, isLast) { | 1971 addSlice(str, start, end, isLast) { |
| 1973 if (start == 0 && end == str[dartx.length]) { | 1972 if (start == 0 && end == str[dartx.length]) { |
| 1974 this.add(str); | 1973 dart.dcall(this.add, str); |
| 1975 } else { | 1974 } else { |
| 1976 this.add(str[dartx.substring](start, end)); | 1975 dart.dcall(this.add, dart.dcall(str[dartx.substring], start, end)); |
| 1977 } | 1976 } |
| 1978 if (dart.notNull(isLast)) | 1977 if (dart.notNull(isLast)) |
| 1979 this.close(); | 1978 dart.dcall(this.close); |
| 1980 } | 1979 } |
| 1981 close() { | 1980 close() { |
| 1982 return this[_sink].close(); | 1981 return dart.dcall(this[_sink].close); |
| 1983 } | 1982 } |
| 1984 } | 1983 } |
| 1985 dart.setSignature(_StringAdapterSink, { | 1984 dart.setSignature(_StringAdapterSink, { |
| 1986 constructors: () => ({_StringAdapterSink: [_StringAdapterSink, [core.Sink$(c
ore.String)]]}), | 1985 constructors: () => ({_StringAdapterSink: [_StringAdapterSink, [core.Sink$(c
ore.String)]]}), |
| 1987 methods: () => ({ | 1986 methods: () => ({ |
| 1988 addSlice: [dart.void, [core.String, core.int, core.int, core.bool]], | 1987 addSlice: [dart.void, [core.String, core.int, core.int, core.bool]], |
| 1989 close: [dart.void, []] | 1988 close: [dart.void, []] |
| 1990 }) | 1989 }) |
| 1991 }); | 1990 }); |
| 1992 let _decoder = Symbol('_decoder'); | 1991 let _decoder = Symbol('_decoder'); |
| 1993 class _Utf8StringSinkAdapter extends ByteConversionSink { | 1992 class _Utf8StringSinkAdapter extends ByteConversionSink { |
| 1994 _Utf8StringSinkAdapter(sink, stringSink, allowMalformed) { | 1993 _Utf8StringSinkAdapter(sink, stringSink, allowMalformed) { |
| 1995 this[_sink] = sink; | 1994 this[_sink] = sink; |
| 1996 this[_decoder] = new _Utf8Decoder(stringSink, allowMalformed); | 1995 this[_decoder] = new _Utf8Decoder(stringSink, allowMalformed); |
| 1997 super.ByteConversionSink(); | 1996 super.ByteConversionSink(); |
| 1998 } | 1997 } |
| 1999 close() { | 1998 close() { |
| 2000 this[_decoder].close(); | 1999 dart.dcall(this[_decoder].close); |
| 2001 if (this[_sink] != null) | 2000 if (this[_sink] != null) |
| 2002 this[_sink].close(); | 2001 dart.dcall(this[_sink].close); |
| 2003 } | 2002 } |
| 2004 add(chunk) { | 2003 add(chunk) { |
| 2005 this.addSlice(chunk, 0, chunk[dartx.length], false); | 2004 dart.dcall(this.addSlice, chunk, 0, chunk[dartx.length], false); |
| 2006 } | 2005 } |
| 2007 addSlice(codeUnits, startIndex, endIndex, isLast) { | 2006 addSlice(codeUnits, startIndex, endIndex, isLast) { |
| 2008 this[_decoder].convert(codeUnits, startIndex, endIndex); | 2007 dart.dcall(this[_decoder].convert, codeUnits, startIndex, endIndex); |
| 2009 if (dart.notNull(isLast)) | 2008 if (dart.notNull(isLast)) |
| 2010 this.close(); | 2009 dart.dcall(this.close); |
| 2011 } | 2010 } |
| 2012 } | 2011 } |
| 2013 dart.setSignature(_Utf8StringSinkAdapter, { | 2012 dart.setSignature(_Utf8StringSinkAdapter, { |
| 2014 constructors: () => ({_Utf8StringSinkAdapter: [_Utf8StringSinkAdapter, [core
.Sink, core.StringSink, core.bool]]}), | 2013 constructors: () => ({_Utf8StringSinkAdapter: [_Utf8StringSinkAdapter, [core
.Sink, core.StringSink, core.bool]]}), |
| 2015 methods: () => ({ | 2014 methods: () => ({ |
| 2016 close: [dart.void, []], | 2015 close: [dart.void, []], |
| 2017 add: [dart.void, [core.List$(core.int)]], | 2016 add: [dart.void, [core.List$(core.int)]], |
| 2018 addSlice: [dart.void, [core.List$(core.int), core.int, core.int, core.bool
]] | 2017 addSlice: [dart.void, [core.List$(core.int), core.int, core.int, core.bool
]] |
| 2019 }) | 2018 }) |
| 2020 }); | 2019 }); |
| 2021 class _Utf8ConversionSink extends ByteConversionSink { | 2020 class _Utf8ConversionSink extends ByteConversionSink { |
| 2022 _Utf8ConversionSink(sink, allowMalformed) { | 2021 _Utf8ConversionSink(sink, allowMalformed) { |
| 2023 this._(sink, new core.StringBuffer(), allowMalformed); | 2022 this._(sink, new core.StringBuffer(), allowMalformed); |
| 2024 } | 2023 } |
| 2025 _(chunkedSink, stringBuffer, allowMalformed) { | 2024 _(chunkedSink, stringBuffer, allowMalformed) { |
| 2026 this[_chunkedSink] = chunkedSink; | 2025 this[_chunkedSink] = chunkedSink; |
| 2027 this[_decoder] = new _Utf8Decoder(stringBuffer, allowMalformed); | 2026 this[_decoder] = new _Utf8Decoder(stringBuffer, allowMalformed); |
| 2028 this[_buffer] = stringBuffer; | 2027 this[_buffer] = stringBuffer; |
| 2029 super.ByteConversionSink(); | 2028 super.ByteConversionSink(); |
| 2030 } | 2029 } |
| 2031 close() { | 2030 close() { |
| 2032 this[_decoder].close(); | 2031 dart.dcall(this[_decoder].close); |
| 2033 if (dart.notNull(this[_buffer].isNotEmpty)) { | 2032 if (dart.notNull(this[_buffer].isNotEmpty)) { |
| 2034 let accumulated = dart.toString(this[_buffer]); | 2033 let accumulated = dart.dcall(this[_buffer].toString); |
| 2035 this[_buffer].clear(); | 2034 dart.dcall(this[_buffer].clear); |
| 2036 this[_chunkedSink].addSlice(accumulated, 0, accumulated[dartx.length], t
rue); | 2035 dart.dcall(this[_chunkedSink].addSlice, accumulated, 0, accumulated[dart
x.length], true); |
| 2037 } else { | 2036 } else { |
| 2038 this[_chunkedSink].close(); | 2037 dart.dcall(this[_chunkedSink].close); |
| 2039 } | 2038 } |
| 2040 } | 2039 } |
| 2041 add(chunk) { | 2040 add(chunk) { |
| 2042 this.addSlice(chunk, 0, chunk[dartx.length], false); | 2041 dart.dcall(this.addSlice, chunk, 0, chunk[dartx.length], false); |
| 2043 } | 2042 } |
| 2044 addSlice(chunk, startIndex, endIndex, isLast) { | 2043 addSlice(chunk, startIndex, endIndex, isLast) { |
| 2045 this[_decoder].convert(chunk, startIndex, endIndex); | 2044 dart.dcall(this[_decoder].convert, chunk, startIndex, endIndex); |
| 2046 if (dart.notNull(this[_buffer].isNotEmpty)) { | 2045 if (dart.notNull(this[_buffer].isNotEmpty)) { |
| 2047 let accumulated = dart.toString(this[_buffer]); | 2046 let accumulated = dart.dcall(this[_buffer].toString); |
| 2048 this[_chunkedSink].addSlice(accumulated, 0, accumulated[dartx.length], i
sLast); | 2047 dart.dcall(this[_chunkedSink].addSlice, accumulated, 0, accumulated[dart
x.length], isLast); |
| 2049 this[_buffer].clear(); | 2048 dart.dcall(this[_buffer].clear); |
| 2050 return; | 2049 return; |
| 2051 } | 2050 } |
| 2052 if (dart.notNull(isLast)) | 2051 if (dart.notNull(isLast)) |
| 2053 this.close(); | 2052 dart.dcall(this.close); |
| 2054 } | 2053 } |
| 2055 } | 2054 } |
| 2056 dart.defineNamedConstructor(_Utf8ConversionSink, '_'); | 2055 dart.defineNamedConstructor(_Utf8ConversionSink, '_'); |
| 2057 dart.setSignature(_Utf8ConversionSink, { | 2056 dart.setSignature(_Utf8ConversionSink, { |
| 2058 constructors: () => ({ | 2057 constructors: () => ({ |
| 2059 _Utf8ConversionSink: [_Utf8ConversionSink, [StringConversionSink, core.boo
l]], | 2058 _Utf8ConversionSink: [_Utf8ConversionSink, [StringConversionSink, core.boo
l]], |
| 2060 _: [_Utf8ConversionSink, [StringConversionSink, core.StringBuffer, core.bo
ol]] | 2059 _: [_Utf8ConversionSink, [StringConversionSink, core.StringBuffer, core.bo
ol]] |
| 2061 }), | 2060 }), |
| 2062 methods: () => ({ | 2061 methods: () => ({ |
| 2063 close: [dart.void, []], | 2062 close: [dart.void, []], |
| (...skipping 10 matching lines...) Expand all Loading... |
| 2074 this[_allowMalformed] = allowMalformed; | 2073 this[_allowMalformed] = allowMalformed; |
| 2075 super.Encoding(); | 2074 super.Encoding(); |
| 2076 } | 2075 } |
| 2077 get name() { | 2076 get name() { |
| 2078 return "utf-8"; | 2077 return "utf-8"; |
| 2079 } | 2078 } |
| 2080 decode(codeUnits, opts) { | 2079 decode(codeUnits, opts) { |
| 2081 let allowMalformed = opts && 'allowMalformed' in opts ? opts.allowMalforme
d : null; | 2080 let allowMalformed = opts && 'allowMalformed' in opts ? opts.allowMalforme
d : null; |
| 2082 if (allowMalformed == null) | 2081 if (allowMalformed == null) |
| 2083 allowMalformed = this[_allowMalformed]; | 2082 allowMalformed = this[_allowMalformed]; |
| 2084 return new Utf8Decoder({allowMalformed: allowMalformed}).convert(codeUnits
); | 2083 return dart.dcall(new Utf8Decoder({allowMalformed: allowMalformed}).conver
t, codeUnits); |
| 2085 } | 2084 } |
| 2086 get encoder() { | 2085 get encoder() { |
| 2087 return new Utf8Encoder(); | 2086 return new Utf8Encoder(); |
| 2088 } | 2087 } |
| 2089 get decoder() { | 2088 get decoder() { |
| 2090 return new Utf8Decoder({allowMalformed: this[_allowMalformed]}); | 2089 return new Utf8Decoder({allowMalformed: this[_allowMalformed]}); |
| 2091 } | 2090 } |
| 2092 } | 2091 } |
| 2093 dart.setSignature(Utf8Codec, { | 2092 dart.setSignature(Utf8Codec, { |
| 2094 constructors: () => ({Utf8Codec: [Utf8Codec, [], {allowMalformed: core.bool}
]}), | 2093 constructors: () => ({Utf8Codec: [Utf8Codec, [], {allowMalformed: core.bool}
]}), |
| 2095 methods: () => ({decode: [core.String, [core.List$(core.int)], {allowMalform
ed: core.bool}]}) | 2094 methods: () => ({decode: [core.String, [core.List$(core.int)], {allowMalform
ed: core.bool}]}) |
| 2096 }); | 2095 }); |
| 2097 let UTF8 = dart.const(new Utf8Codec()); | 2096 let UTF8 = dart.const(new Utf8Codec()); |
| 2098 let _fillBuffer = Symbol('_fillBuffer'); | 2097 let _fillBuffer = Symbol('_fillBuffer'); |
| 2099 let _writeSurrogate = Symbol('_writeSurrogate'); | 2098 let _writeSurrogate = Symbol('_writeSurrogate'); |
| 2100 class Utf8Encoder extends Converter$(core.String, core.List$(core.int)) { | 2099 class Utf8Encoder extends Converter$(core.String, core.List$(core.int)) { |
| 2101 Utf8Encoder() { | 2100 Utf8Encoder() { |
| 2102 super.Converter(); | 2101 super.Converter(); |
| 2103 } | 2102 } |
| 2104 convert(string, start, end) { | 2103 convert(string, start, end) { |
| 2105 if (start === void 0) | 2104 if (start === void 0) |
| 2106 start = 0; | 2105 start = 0; |
| 2107 if (end === void 0) | 2106 if (end === void 0) |
| 2108 end = null; | 2107 end = null; |
| 2109 let stringLength = string[dartx.length]; | 2108 let stringLength = string[dartx.length]; |
| 2110 core.RangeError.checkValidRange(start, end, stringLength); | 2109 dart.dcall(core.RangeError.checkValidRange, start, end, stringLength); |
| 2111 if (end == null) | 2110 if (end == null) |
| 2112 end = stringLength; | 2111 end = stringLength; |
| 2113 let length = dart.notNull(end) - dart.notNull(start); | 2112 let length = dart.notNull(end) - dart.notNull(start); |
| 2114 if (length == 0) | 2113 if (length == 0) |
| 2115 return typed_data.Uint8List.new(0); | 2114 return typed_data.Uint8List.new(0); |
| 2116 let encoder = new _Utf8Encoder.withBufferSize(dart.notNull(length) * 3); | 2115 let encoder = new _Utf8Encoder.withBufferSize(dart.notNull(length) * 3); |
| 2117 let endPosition = encoder[_fillBuffer](string, start, end); | 2116 let endPosition = dart.dcall(encoder[_fillBuffer], string, start, end); |
| 2118 dart.assert(dart.notNull(endPosition) >= dart.notNull(end) - 1); | 2117 dart.assert(dart.notNull(endPosition) >= dart.notNull(end) - 1); |
| 2119 if (endPosition != end) { | 2118 if (endPosition != end) { |
| 2120 let lastCodeUnit = string[dartx.codeUnitAt](dart.notNull(end) - 1); | 2119 let lastCodeUnit = dart.dcall(string[dartx.codeUnitAt], dart.notNull(end
) - 1); |
| 2121 dart.assert(_isLeadSurrogate(lastCodeUnit)); | 2120 dart.assert(dart.dcall(_isLeadSurrogate, lastCodeUnit)); |
| 2122 let wasCombined = encoder[_writeSurrogate](lastCodeUnit, 0); | 2121 let wasCombined = dart.dcall(encoder[_writeSurrogate], lastCodeUnit, 0); |
| 2123 dart.assert(!dart.notNull(wasCombined)); | 2122 dart.assert(!dart.notNull(wasCombined)); |
| 2124 } | 2123 } |
| 2125 return encoder[_buffer][dartx.sublist](0, encoder[_bufferIndex]); | 2124 return dart.dcall(encoder[_buffer][dartx.sublist], 0, encoder[_bufferIndex
]); |
| 2126 } | 2125 } |
| 2127 startChunkedConversion(sink) { | 2126 startChunkedConversion(sink) { |
| 2128 if (!dart.is(sink, ByteConversionSink)) { | 2127 if (!dart.is(sink, ByteConversionSink)) { |
| 2129 sink = ByteConversionSink.from(sink); | 2128 sink = ByteConversionSink.from(sink); |
| 2130 } | 2129 } |
| 2131 return new _Utf8EncoderSink(dart.as(sink, ByteConversionSink)); | 2130 return new _Utf8EncoderSink(dart.as(sink, ByteConversionSink)); |
| 2132 } | 2131 } |
| 2133 bind(stream) { | 2132 bind(stream) { |
| 2134 return super.bind(stream); | 2133 return dart.dcall(super.bind, stream); |
| 2135 } | 2134 } |
| 2136 } | 2135 } |
| 2137 dart.setSignature(Utf8Encoder, { | 2136 dart.setSignature(Utf8Encoder, { |
| 2138 constructors: () => ({Utf8Encoder: [Utf8Encoder, []]}), | 2137 constructors: () => ({Utf8Encoder: [Utf8Encoder, []]}), |
| 2139 methods: () => ({ | 2138 methods: () => ({ |
| 2140 convert: [core.List$(core.int), [core.String], [core.int, core.int]], | 2139 convert: [core.List$(core.int), [core.String], [core.int, core.int]], |
| 2141 startChunkedConversion: [StringConversionSink, [core.Sink$(core.List$(core
.int))]], | 2140 startChunkedConversion: [StringConversionSink, [core.Sink$(core.List$(core
.int))]], |
| 2142 bind: [async.Stream$(core.List$(core.int)), [async.Stream$(core.String)]] | 2141 bind: [async.Stream$(core.List$(core.int)), [async.Stream$(core.String)]] |
| 2143 }) | 2142 }) |
| 2144 }); | 2143 }); |
| 2145 class _Utf8Encoder extends core.Object { | 2144 class _Utf8Encoder extends core.Object { |
| 2146 _Utf8Encoder() { | 2145 _Utf8Encoder() { |
| 2147 this.withBufferSize(_Utf8Encoder._DEFAULT_BYTE_BUFFER_SIZE); | 2146 this.withBufferSize(dart.as(_Utf8Encoder._DEFAULT_BYTE_BUFFER_SIZE, core.i
nt)); |
| 2148 } | 2147 } |
| 2149 withBufferSize(bufferSize) { | 2148 withBufferSize(bufferSize) { |
| 2150 this[_buffer] = _Utf8Encoder._createBuffer(bufferSize); | 2149 this[_buffer] = dart.dcall(_Utf8Encoder._createBuffer, bufferSize); |
| 2151 this[_carry] = 0; | 2150 this[_carry] = 0; |
| 2152 this[_bufferIndex] = 0; | 2151 this[_bufferIndex] = 0; |
| 2153 } | 2152 } |
| 2154 static _createBuffer(size) { | 2153 static _createBuffer(size) { |
| 2155 return typed_data.Uint8List.new(size); | 2154 return typed_data.Uint8List.new(size); |
| 2156 } | 2155 } |
| 2157 [_writeSurrogate](leadingSurrogate, nextCodeUnit) { | 2156 [_writeSurrogate](leadingSurrogate, nextCodeUnit) { |
| 2158 if (dart.notNull(_isTailSurrogate(nextCodeUnit))) { | 2157 if (dart.notNull(dart.dcall(_isTailSurrogate, nextCodeUnit))) { |
| 2159 let rune = _combineSurrogatePair(leadingSurrogate, nextCodeUnit); | 2158 let rune = dart.dcall(_combineSurrogatePair, leadingSurrogate, nextCodeU
nit); |
| 2160 dart.assert(dart.notNull(rune) > dart.notNull(_THREE_BYTE_LIMIT)); | 2159 dart.assert(dart.notNull(rune) > dart.notNull(_THREE_BYTE_LIMIT)); |
| 2161 dart.assert(dart.notNull(rune) <= dart.notNull(_FOUR_BYTE_LIMIT)); | 2160 dart.assert(dart.notNull(rune) <= dart.notNull(_FOUR_BYTE_LIMIT)); |
| 2162 this[_buffer][dartx.set]((() => { | 2161 this[_buffer][dartx.set]((() => { |
| 2163 let x = this[_bufferIndex]; | 2162 let x = this[_bufferIndex]; |
| 2164 this[_bufferIndex] = dart.notNull(x) + 1; | 2163 this[_bufferIndex] = dart.notNull(x) + 1; |
| 2165 return x; | 2164 return x; |
| 2166 }).bind(this)(), 240 | dart.notNull(rune) >> 18); | 2165 }).bind(this)(), 240 | dart.notNull(rune) >> 18); |
| 2167 this[_buffer][dartx.set]((() => { | 2166 this[_buffer][dartx.set]((() => { |
| 2168 let x = this[_bufferIndex]; | 2167 let x = this[_bufferIndex]; |
| 2169 this[_bufferIndex] = dart.notNull(x) + 1; | 2168 this[_bufferIndex] = dart.notNull(x) + 1; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 2193 }).bind(this)(), 128 | dart.notNull(leadingSurrogate) >> 6 & 63); | 2192 }).bind(this)(), 128 | dart.notNull(leadingSurrogate) >> 6 & 63); |
| 2194 this[_buffer][dartx.set]((() => { | 2193 this[_buffer][dartx.set]((() => { |
| 2195 let x = this[_bufferIndex]; | 2194 let x = this[_bufferIndex]; |
| 2196 this[_bufferIndex] = dart.notNull(x) + 1; | 2195 this[_bufferIndex] = dart.notNull(x) + 1; |
| 2197 return x; | 2196 return x; |
| 2198 }).bind(this)(), 128 | dart.notNull(leadingSurrogate) & 63); | 2197 }).bind(this)(), 128 | dart.notNull(leadingSurrogate) & 63); |
| 2199 return false; | 2198 return false; |
| 2200 } | 2199 } |
| 2201 } | 2200 } |
| 2202 [_fillBuffer](str, start, end) { | 2201 [_fillBuffer](str, start, end) { |
| 2203 if (start != end && dart.notNull(_isLeadSurrogate(str[dartx.codeUnitAt](da
rt.notNull(end) - 1)))) { | 2202 if (start != end && dart.notNull(dart.dcall(_isLeadSurrogate, dart.dcall(s
tr[dartx.codeUnitAt], dart.notNull(end) - 1)))) { |
| 2204 end = dart.notNull(end) - 1; | 2203 end = dart.notNull(end) - 1; |
| 2205 } | 2204 } |
| 2206 let stringIndex = null; | 2205 let stringIndex = null; |
| 2207 for (stringIndex = start; dart.notNull(stringIndex) < dart.notNull(end); s
tringIndex = dart.notNull(stringIndex) + 1) { | 2206 for (stringIndex = start; dart.notNull(stringIndex) < dart.notNull(end); s
tringIndex = dart.notNull(stringIndex) + 1) { |
| 2208 let codeUnit = str[dartx.codeUnitAt](stringIndex); | 2207 let codeUnit = dart.dcall(str[dartx.codeUnitAt], stringIndex); |
| 2209 if (dart.notNull(codeUnit) <= dart.notNull(_ONE_BYTE_LIMIT)) { | 2208 if (dart.notNull(codeUnit) <= dart.notNull(_ONE_BYTE_LIMIT)) { |
| 2210 if (dart.notNull(this[_bufferIndex]) >= dart.notNull(this[_buffer][dar
tx.length])) | 2209 if (dart.notNull(this[_bufferIndex]) >= dart.notNull(this[_buffer][dar
tx.length])) |
| 2211 break; | 2210 break; |
| 2212 this[_buffer][dartx.set]((() => { | 2211 this[_buffer][dartx.set]((() => { |
| 2213 let x = this[_bufferIndex]; | 2212 let x = this[_bufferIndex]; |
| 2214 this[_bufferIndex] = dart.notNull(x) + 1; | 2213 this[_bufferIndex] = dart.notNull(x) + 1; |
| 2215 return x; | 2214 return x; |
| 2216 }).bind(this)(), codeUnit); | 2215 }).bind(this)(), codeUnit); |
| 2217 } else if (dart.notNull(_isLeadSurrogate(codeUnit))) { | 2216 } else if (dart.notNull(dart.dcall(_isLeadSurrogate, codeUnit))) { |
| 2218 if (dart.notNull(this[_bufferIndex]) + 3 >= dart.notNull(this[_buffer]
[dartx.length])) | 2217 if (dart.notNull(this[_bufferIndex]) + 3 >= dart.notNull(this[_buffer]
[dartx.length])) |
| 2219 break; | 2218 break; |
| 2220 let nextCodeUnit = str[dartx.codeUnitAt](dart.notNull(stringIndex) + 1
); | 2219 let nextCodeUnit = dart.dcall(str[dartx.codeUnitAt], dart.notNull(stri
ngIndex) + 1); |
| 2221 let wasCombined = this[_writeSurrogate](codeUnit, nextCodeUnit); | 2220 let wasCombined = dart.dcall(this[_writeSurrogate], codeUnit, nextCode
Unit); |
| 2222 if (dart.notNull(wasCombined)) { | 2221 if (dart.notNull(wasCombined)) { |
| 2223 stringIndex = dart.notNull(stringIndex) + 1; | 2222 stringIndex = dart.notNull(stringIndex) + 1; |
| 2224 } | 2223 } |
| 2225 } else { | 2224 } else { |
| 2226 let rune = codeUnit; | 2225 let rune = codeUnit; |
| 2227 if (dart.notNull(rune) <= dart.notNull(_TWO_BYTE_LIMIT)) { | 2226 if (dart.notNull(rune) <= dart.notNull(_TWO_BYTE_LIMIT)) { |
| 2228 if (dart.notNull(this[_bufferIndex]) + 1 >= dart.notNull(this[_buffe
r][dartx.length])) | 2227 if (dart.notNull(this[_bufferIndex]) + 1 >= dart.notNull(this[_buffe
r][dartx.length])) |
| 2229 break; | 2228 break; |
| 2230 this[_buffer][dartx.set]((() => { | 2229 this[_buffer][dartx.set]((() => { |
| 2231 let x = this[_bufferIndex]; | 2230 let x = this[_bufferIndex]; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2276 names: ['_createBuffer'] | 2275 names: ['_createBuffer'] |
| 2277 }); | 2276 }); |
| 2278 _Utf8Encoder._DEFAULT_BYTE_BUFFER_SIZE = 1024; | 2277 _Utf8Encoder._DEFAULT_BYTE_BUFFER_SIZE = 1024; |
| 2279 class _Utf8EncoderSink extends dart.mixin(_Utf8Encoder, StringConversionSinkMi
xin) { | 2278 class _Utf8EncoderSink extends dart.mixin(_Utf8Encoder, StringConversionSinkMi
xin) { |
| 2280 _Utf8EncoderSink(sink) { | 2279 _Utf8EncoderSink(sink) { |
| 2281 this[_sink] = sink; | 2280 this[_sink] = sink; |
| 2282 super._Utf8Encoder(); | 2281 super._Utf8Encoder(); |
| 2283 } | 2282 } |
| 2284 close() { | 2283 close() { |
| 2285 if (this[_carry] != 0) { | 2284 if (this[_carry] != 0) { |
| 2286 this.addSlice("", 0, 0, true); | 2285 dart.dcall(this.addSlice, "", 0, 0, true); |
| 2287 return; | 2286 return; |
| 2288 } | 2287 } |
| 2289 this[_sink].close(); | 2288 dart.dcall(this[_sink].close); |
| 2290 } | 2289 } |
| 2291 addSlice(str, start, end, isLast) { | 2290 addSlice(str, start, end, isLast) { |
| 2292 this[_bufferIndex] = 0; | 2291 this[_bufferIndex] = 0; |
| 2293 if (start == end && !dart.notNull(isLast)) { | 2292 if (start == end && !dart.notNull(isLast)) { |
| 2294 return; | 2293 return; |
| 2295 } | 2294 } |
| 2296 if (this[_carry] != 0) { | 2295 if (this[_carry] != 0) { |
| 2297 let nextCodeUnit = 0; | 2296 let nextCodeUnit = 0; |
| 2298 if (start != end) { | 2297 if (start != end) { |
| 2299 nextCodeUnit = str[dartx.codeUnitAt](start); | 2298 nextCodeUnit = dart.dcall(str[dartx.codeUnitAt], start); |
| 2300 } else { | 2299 } else { |
| 2301 dart.assert(isLast); | 2300 dart.assert(isLast); |
| 2302 } | 2301 } |
| 2303 let wasCombined = this[_writeSurrogate](this[_carry], nextCodeUnit); | 2302 let wasCombined = dart.dcall(this[_writeSurrogate], this[_carry], nextCo
deUnit); |
| 2304 dart.assert(!dart.notNull(wasCombined) || start != end); | 2303 dart.assert(!dart.notNull(wasCombined) || start != end); |
| 2305 if (dart.notNull(wasCombined)) { | 2304 if (dart.notNull(wasCombined)) { |
| 2306 start = dart.notNull(start) + 1; | 2305 start = dart.notNull(start) + 1; |
| 2307 } | 2306 } |
| 2308 this[_carry] = 0; | 2307 this[_carry] = 0; |
| 2309 } | 2308 } |
| 2310 do { | 2309 do { |
| 2311 start = this[_fillBuffer](str, start, end); | 2310 start = dart.dcall(this[_fillBuffer], str, start, end); |
| 2312 let isLastSlice = dart.notNull(isLast) && start == end; | 2311 let isLastSlice = dart.notNull(isLast) && start == end; |
| 2313 if (start == dart.notNull(end) - 1 && dart.notNull(_isLeadSurrogate(str[
dartx.codeUnitAt](start)))) { | 2312 if (start == dart.notNull(end) - 1 && dart.notNull(dart.dcall(_isLeadSur
rogate, dart.dcall(str[dartx.codeUnitAt], start)))) { |
| 2314 if (dart.notNull(isLast) && dart.notNull(this[_bufferIndex]) < dart.no
tNull(this[_buffer][dartx.length]) - 3) { | 2313 if (dart.notNull(isLast) && dart.notNull(this[_bufferIndex]) < dart.no
tNull(this[_buffer][dartx.length]) - 3) { |
| 2315 let hasBeenCombined = this[_writeSurrogate](str[dartx.codeUnitAt](st
art), 0); | 2314 let hasBeenCombined = dart.dcall(this[_writeSurrogate], dart.dcall(s
tr[dartx.codeUnitAt], start), 0); |
| 2316 dart.assert(!dart.notNull(hasBeenCombined)); | 2315 dart.assert(!dart.notNull(hasBeenCombined)); |
| 2317 } else { | 2316 } else { |
| 2318 this[_carry] = str[dartx.codeUnitAt](start); | 2317 this[_carry] = dart.dcall(str[dartx.codeUnitAt], start); |
| 2319 } | 2318 } |
| 2320 start = dart.notNull(start) + 1; | 2319 start = dart.notNull(start) + 1; |
| 2321 } | 2320 } |
| 2322 this[_sink].addSlice(this[_buffer], 0, this[_bufferIndex], isLastSlice); | 2321 dart.dcall(this[_sink].addSlice, this[_buffer], 0, this[_bufferIndex], i
sLastSlice); |
| 2323 this[_bufferIndex] = 0; | 2322 this[_bufferIndex] = 0; |
| 2324 } while (dart.notNull(start) < dart.notNull(end)); | 2323 } while (dart.notNull(start) < dart.notNull(end)); |
| 2325 if (dart.notNull(isLast)) | 2324 if (dart.notNull(isLast)) |
| 2326 this.close(); | 2325 dart.dcall(this.close); |
| 2327 } | 2326 } |
| 2328 } | 2327 } |
| 2329 dart.setSignature(_Utf8EncoderSink, { | 2328 dart.setSignature(_Utf8EncoderSink, { |
| 2330 constructors: () => ({_Utf8EncoderSink: [_Utf8EncoderSink, [ByteConversionSi
nk]]}), | 2329 constructors: () => ({_Utf8EncoderSink: [_Utf8EncoderSink, [ByteConversionSi
nk]]}), |
| 2331 methods: () => ({ | 2330 methods: () => ({ |
| 2332 close: [dart.void, []], | 2331 close: [dart.void, []], |
| 2333 addSlice: [dart.void, [core.String, core.int, core.int, core.bool]] | 2332 addSlice: [dart.void, [core.String, core.int, core.int, core.bool]] |
| 2334 }) | 2333 }) |
| 2335 }); | 2334 }); |
| 2336 class Utf8Decoder extends Converter$(core.List$(core.int), core.String) { | 2335 class Utf8Decoder extends Converter$(core.List$(core.int), core.String) { |
| 2337 Utf8Decoder(opts) { | 2336 Utf8Decoder(opts) { |
| 2338 let allowMalformed = opts && 'allowMalformed' in opts ? opts.allowMalforme
d : false; | 2337 let allowMalformed = opts && 'allowMalformed' in opts ? opts.allowMalforme
d : false; |
| 2339 this[_allowMalformed] = allowMalformed; | 2338 this[_allowMalformed] = allowMalformed; |
| 2340 super.Converter(); | 2339 super.Converter(); |
| 2341 } | 2340 } |
| 2342 convert(codeUnits, start, end) { | 2341 convert(codeUnits, start, end) { |
| 2343 if (start === void 0) | 2342 if (start === void 0) |
| 2344 start = 0; | 2343 start = 0; |
| 2345 if (end === void 0) | 2344 if (end === void 0) |
| 2346 end = null; | 2345 end = null; |
| 2347 let length = codeUnits[dartx.length]; | 2346 let length = codeUnits[dartx.length]; |
| 2348 core.RangeError.checkValidRange(start, end, length); | 2347 dart.dcall(core.RangeError.checkValidRange, start, end, length); |
| 2349 if (end == null) | 2348 if (end == null) |
| 2350 end = length; | 2349 end = length; |
| 2351 let buffer = new core.StringBuffer(); | 2350 let buffer = new core.StringBuffer(); |
| 2352 let decoder = new _Utf8Decoder(buffer, this[_allowMalformed]); | 2351 let decoder = new _Utf8Decoder(buffer, this[_allowMalformed]); |
| 2353 decoder.convert(codeUnits, start, end); | 2352 dart.dcall(decoder.convert, codeUnits, start, end); |
| 2354 decoder.close(); | 2353 dart.dcall(decoder.close); |
| 2355 return dart.toString(buffer); | 2354 return dart.dcall(buffer.toString); |
| 2356 } | 2355 } |
| 2357 startChunkedConversion(sink) { | 2356 startChunkedConversion(sink) { |
| 2358 let stringSink = null; | 2357 let stringSink = null; |
| 2359 if (dart.is(sink, StringConversionSink)) { | 2358 if (dart.is(sink, StringConversionSink)) { |
| 2360 stringSink = sink; | 2359 stringSink = sink; |
| 2361 } else { | 2360 } else { |
| 2362 stringSink = StringConversionSink.from(sink); | 2361 stringSink = StringConversionSink.from(sink); |
| 2363 } | 2362 } |
| 2364 return stringSink.asUtf8Sink(this[_allowMalformed]); | 2363 return dart.dcall(stringSink.asUtf8Sink, this[_allowMalformed]); |
| 2365 } | 2364 } |
| 2366 bind(stream) { | 2365 bind(stream) { |
| 2367 return super.bind(stream); | 2366 return dart.dcall(super.bind, stream); |
| 2368 } | 2367 } |
| 2369 fuse(next) { | 2368 fuse(next) { |
| 2370 return super.fuse(next); | 2369 return dart.dcall(super.fuse, next); |
| 2371 } | 2370 } |
| 2372 } | 2371 } |
| 2373 dart.setSignature(Utf8Decoder, { | 2372 dart.setSignature(Utf8Decoder, { |
| 2374 constructors: () => ({Utf8Decoder: [Utf8Decoder, [], {allowMalformed: core.b
ool}]}), | 2373 constructors: () => ({Utf8Decoder: [Utf8Decoder, [], {allowMalformed: core.b
ool}]}), |
| 2375 methods: () => ({ | 2374 methods: () => ({ |
| 2376 convert: [core.String, [core.List$(core.int)], [core.int, core.int]], | 2375 convert: [core.String, [core.List$(core.int)], [core.int, core.int]], |
| 2377 startChunkedConversion: [ByteConversionSink, [core.Sink$(core.String)]], | 2376 startChunkedConversion: [ByteConversionSink, [core.Sink$(core.String)]], |
| 2378 bind: [async.Stream$(core.String), [async.Stream$(core.List$(core.int))]], | 2377 bind: [async.Stream$(core.String), [async.Stream$(core.List$(core.int))]], |
| 2379 fuse: [Converter$(core.List$(core.int), dart.dynamic), [Converter$(core.St
ring, dart.dynamic)]] | 2378 fuse: [Converter$(core.List$(core.int), dart.dynamic), [Converter$(core.St
ring, dart.dynamic)]] |
| 2380 }) | 2379 }) |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2414 this[_allowMalformed] = allowMalformed; | 2413 this[_allowMalformed] = allowMalformed; |
| 2415 this[_isFirstCharacter] = true; | 2414 this[_isFirstCharacter] = true; |
| 2416 this[_value] = 0; | 2415 this[_value] = 0; |
| 2417 this[_expectedUnits] = 0; | 2416 this[_expectedUnits] = 0; |
| 2418 this[_extraUnits] = 0; | 2417 this[_extraUnits] = 0; |
| 2419 } | 2418 } |
| 2420 get hasPartialInput() { | 2419 get hasPartialInput() { |
| 2421 return dart.notNull(this[_expectedUnits]) > 0; | 2420 return dart.notNull(this[_expectedUnits]) > 0; |
| 2422 } | 2421 } |
| 2423 close() { | 2422 close() { |
| 2424 this.flush(); | 2423 dart.dcall(this.flush); |
| 2425 } | 2424 } |
| 2426 flush() { | 2425 flush() { |
| 2427 if (dart.notNull(this.hasPartialInput)) { | 2426 if (dart.notNull(this.hasPartialInput)) { |
| 2428 if (!dart.notNull(this[_allowMalformed])) { | 2427 if (!dart.notNull(this[_allowMalformed])) { |
| 2429 dart.throw(new core.FormatException("Unfinished UTF-8 octet sequence")
); | 2428 dart.throw(new core.FormatException("Unfinished UTF-8 octet sequence")
); |
| 2430 } | 2429 } |
| 2431 this[_stringSink].writeCharCode(UNICODE_REPLACEMENT_CHARACTER_RUNE); | 2430 dart.dcall(this[_stringSink].writeCharCode, UNICODE_REPLACEMENT_CHARACTE
R_RUNE); |
| 2432 this[_value] = 0; | 2431 this[_value] = 0; |
| 2433 this[_expectedUnits] = 0; | 2432 this[_expectedUnits] = 0; |
| 2434 this[_extraUnits] = 0; | 2433 this[_extraUnits] = 0; |
| 2435 } | 2434 } |
| 2436 } | 2435 } |
| 2437 convert(codeUnits, startIndex, endIndex) { | 2436 convert(codeUnits, startIndex, endIndex) { |
| 2438 let value = this[_value]; | 2437 let value = this[_value]; |
| 2439 let expectedUnits = this[_expectedUnits]; | 2438 let expectedUnits = this[_expectedUnits]; |
| 2440 let extraUnits = this[_extraUnits]; | 2439 let extraUnits = this[_extraUnits]; |
| 2441 this[_value] = 0; | 2440 this[_value] = 0; |
| 2442 this[_expectedUnits] = 0; | 2441 this[_expectedUnits] = 0; |
| 2443 this[_extraUnits] = 0; | 2442 this[_extraUnits] = 0; |
| 2444 function scanOneByteCharacters(units, from) { | 2443 function scanOneByteCharacters(units, from) { |
| 2445 let to = endIndex; | 2444 let to = endIndex; |
| 2446 let mask = _ONE_BYTE_LIMIT; | 2445 let mask = _ONE_BYTE_LIMIT; |
| 2447 for (let i = from; dart.notNull(i) < dart.notNull(to); i = dart.notNull(
i) + 1) { | 2446 for (let i = from; dart.notNull(dart.as(dart.dsend(i, '<', to), core.boo
l)); i = dart.dsend(i, '+', 1)) { |
| 2448 let unit = dart.dindex(units, i); | 2447 let unit = dart.dindex(units, i); |
| 2449 if (!dart.equals(dart.dsend(unit, '&', mask), unit)) | 2448 if (!dart.equals(dart.dsend(unit, '&', mask), unit)) |
| 2450 return dart.notNull(i) - dart.notNull(from); | 2449 return dart.as(dart.dsend(i, '-', from), core.int); |
| 2451 } | 2450 } |
| 2452 return dart.notNull(to) - dart.notNull(from); | 2451 return dart.as(dart.dsend(to, '-', from), core.int); |
| 2453 } | 2452 } |
| 2454 dart.fn(scanOneByteCharacters, core.int, [dart.dynamic, core.int]); | 2453 dart.fn(scanOneByteCharacters, core.int, [dart.dynamic, core.int]); |
| 2455 let addSingleBytes = (function(from, to) { | 2454 let addSingleBytes = (function(from, to) { |
| 2456 dart.assert(dart.notNull(from) >= dart.notNull(startIndex) && dart.notNu
ll(from) <= dart.notNull(endIndex)); | 2455 dart.assert(dart.notNull(from) >= dart.notNull(startIndex) && dart.notNu
ll(from) <= dart.notNull(endIndex)); |
| 2457 dart.assert(dart.notNull(to) >= dart.notNull(startIndex) && dart.notNull
(to) <= dart.notNull(endIndex)); | 2456 dart.assert(dart.notNull(to) >= dart.notNull(startIndex) && dart.notNull
(to) <= dart.notNull(endIndex)); |
| 2458 this[_stringSink].write(core.String.fromCharCodes(codeUnits, from, to)); | 2457 dart.dcall(this[_stringSink].write, core.String.fromCharCodes(codeUnits,
from, to)); |
| 2459 }).bind(this); | 2458 }).bind(this); |
| 2460 dart.fn(addSingleBytes, dart.void, [core.int, core.int]); | 2459 dart.fn(addSingleBytes, dart.void, [core.int, core.int]); |
| 2461 let i = startIndex; | 2460 let i = startIndex; |
| 2462 loop: | 2461 loop: |
| 2463 while (true) { | 2462 while (true) { |
| 2464 multibyte: | 2463 multibyte: |
| 2465 if (dart.notNull(expectedUnits) > 0) { | 2464 if (dart.notNull(expectedUnits) > 0) { |
| 2466 do { | 2465 do { |
| 2467 if (i == endIndex) { | 2466 if (i == endIndex) { |
| 2468 break loop; | 2467 break loop; |
| 2469 } | 2468 } |
| 2470 let unit = codeUnits[dartx.get](i); | 2469 let unit = codeUnits[dartx.get](i); |
| 2471 if ((dart.notNull(unit) & 192) != 128) { | 2470 if ((dart.notNull(unit) & 192) != 128) { |
| 2472 expectedUnits = 0; | 2471 expectedUnits = 0; |
| 2473 if (!dart.notNull(this[_allowMalformed])) { | 2472 if (!dart.notNull(this[_allowMalformed])) { |
| 2474 dart.throw(new core.FormatException(`Bad UTF-8 encoding 0x${
unit[dartx.toRadixString](16)}`)); | 2473 dart.throw(new core.FormatException(`Bad UTF-8 encoding 0x${
dart.dcall(unit[dartx.toRadixString], 16)}`)); |
| 2475 } | 2474 } |
| 2476 this[_isFirstCharacter] = false; | 2475 this[_isFirstCharacter] = false; |
| 2477 this[_stringSink].writeCharCode(UNICODE_REPLACEMENT_CHARACTER_
RUNE); | 2476 dart.dcall(this[_stringSink].writeCharCode, UNICODE_REPLACEMEN
T_CHARACTER_RUNE); |
| 2478 break multibyte; | 2477 break multibyte; |
| 2479 } else { | 2478 } else { |
| 2480 value = dart.notNull(value) << 6 | dart.notNull(unit) & 63; | 2479 value = dart.notNull(value) << 6 | dart.notNull(unit) & 63; |
| 2481 expectedUnits = dart.notNull(expectedUnits) - 1; | 2480 expectedUnits = dart.notNull(expectedUnits) - 1; |
| 2482 i = dart.notNull(i) + 1; | 2481 i = dart.notNull(i) + 1; |
| 2483 } | 2482 } |
| 2484 } while (dart.notNull(expectedUnits) > 0); | 2483 } while (dart.notNull(expectedUnits) > 0); |
| 2485 if (dart.notNull(value) <= dart.notNull(_Utf8Decoder._LIMITS[dartx
.get](dart.notNull(extraUnits) - 1))) { | 2484 if (dart.notNull(value) <= dart.notNull(_Utf8Decoder._LIMITS[dartx
.get](dart.notNull(extraUnits) - 1))) { |
| 2486 if (!dart.notNull(this[_allowMalformed])) { | 2485 if (!dart.notNull(this[_allowMalformed])) { |
| 2487 dart.throw(new core.FormatException(`Overlong encoding of 0x${
value[dartx.toRadixString](16)}`)); | 2486 dart.throw(new core.FormatException(`Overlong encoding of 0x${
dart.dcall(value[dartx.toRadixString], 16)}`)); |
| 2488 } | 2487 } |
| 2489 expectedUnits = extraUnits = 0; | 2488 expectedUnits = extraUnits = 0; |
| 2490 value = UNICODE_REPLACEMENT_CHARACTER_RUNE; | 2489 value = UNICODE_REPLACEMENT_CHARACTER_RUNE; |
| 2491 } | 2490 } |
| 2492 if (dart.notNull(value) > dart.notNull(_FOUR_BYTE_LIMIT)) { | 2491 if (dart.notNull(value) > dart.notNull(_FOUR_BYTE_LIMIT)) { |
| 2493 if (!dart.notNull(this[_allowMalformed])) { | 2492 if (!dart.notNull(this[_allowMalformed])) { |
| 2494 dart.throw(new core.FormatException("Character outside valid U
nicode range: " + `0x${value[dartx.toRadixString](16)}`)); | 2493 dart.throw(new core.FormatException("Character outside valid U
nicode range: " + `0x${dart.dcall(value[dartx.toRadixString], 16)}`)); |
| 2495 } | 2494 } |
| 2496 value = UNICODE_REPLACEMENT_CHARACTER_RUNE; | 2495 value = UNICODE_REPLACEMENT_CHARACTER_RUNE; |
| 2497 } | 2496 } |
| 2498 if (!dart.notNull(this[_isFirstCharacter]) || value != UNICODE_BOM
_CHARACTER_RUNE) { | 2497 if (!dart.notNull(this[_isFirstCharacter]) || value != UNICODE_BOM
_CHARACTER_RUNE) { |
| 2499 this[_stringSink].writeCharCode(value); | 2498 dart.dcall(this[_stringSink].writeCharCode, value); |
| 2500 } | 2499 } |
| 2501 this[_isFirstCharacter] = false; | 2500 this[_isFirstCharacter] = false; |
| 2502 } | 2501 } |
| 2503 while (dart.notNull(i) < dart.notNull(endIndex)) { | 2502 while (dart.notNull(i) < dart.notNull(endIndex)) { |
| 2504 let oneBytes = scanOneByteCharacters(codeUnits, i); | 2503 let oneBytes = dart.dcall(scanOneByteCharacters, codeUnits, i); |
| 2505 if (dart.notNull(oneBytes) > 0) { | 2504 if (dart.notNull(oneBytes) > 0) { |
| 2506 this[_isFirstCharacter] = false; | 2505 this[_isFirstCharacter] = false; |
| 2507 addSingleBytes(i, dart.notNull(i) + dart.notNull(oneBytes)); | 2506 dart.dcall(addSingleBytes, i, dart.notNull(i) + dart.notNull(oneBy
tes)); |
| 2508 i = dart.notNull(i) + dart.notNull(oneBytes); | 2507 i = dart.notNull(i) + dart.notNull(oneBytes); |
| 2509 if (i == endIndex) | 2508 if (i == endIndex) |
| 2510 break; | 2509 break; |
| 2511 } | 2510 } |
| 2512 let unit = codeUnits[dartx.get]((() => { | 2511 let unit = codeUnits[dartx.get]((() => { |
| 2513 let x = i; | 2512 let x = i; |
| 2514 i = dart.notNull(x) + 1; | 2513 i = dart.notNull(x) + 1; |
| 2515 return x; | 2514 return x; |
| 2516 })()); | 2515 })()); |
| 2517 if (dart.notNull(unit) < 0) { | 2516 if (dart.notNull(unit) < 0) { |
| 2518 if (!dart.notNull(this[_allowMalformed])) { | 2517 if (!dart.notNull(this[_allowMalformed])) { |
| 2519 dart.throw(new core.FormatException(`Negative UTF-8 code unit: -
0x${(-dart.notNull(unit))[dartx.toRadixString](16)}`)); | 2518 dart.throw(new core.FormatException(`Negative UTF-8 code unit: -
0x${dart.dcall((-dart.notNull(unit))[dartx.toRadixString], 16)}`)); |
| 2520 } | 2519 } |
| 2521 this[_stringSink].writeCharCode(UNICODE_REPLACEMENT_CHARACTER_RUNE
); | 2520 dart.dcall(this[_stringSink].writeCharCode, UNICODE_REPLACEMENT_CH
ARACTER_RUNE); |
| 2522 } else { | 2521 } else { |
| 2523 dart.assert(dart.notNull(unit) > dart.notNull(_ONE_BYTE_LIMIT)); | 2522 dart.assert(dart.notNull(unit) > dart.notNull(_ONE_BYTE_LIMIT)); |
| 2524 if ((dart.notNull(unit) & 224) == 192) { | 2523 if ((dart.notNull(unit) & 224) == 192) { |
| 2525 value = dart.notNull(unit) & 31; | 2524 value = dart.notNull(unit) & 31; |
| 2526 expectedUnits = extraUnits = 1; | 2525 expectedUnits = extraUnits = 1; |
| 2527 continue loop; | 2526 continue loop; |
| 2528 } | 2527 } |
| 2529 if ((dart.notNull(unit) & 240) == 224) { | 2528 if ((dart.notNull(unit) & 240) == 224) { |
| 2530 value = dart.notNull(unit) & 15; | 2529 value = dart.notNull(unit) & 15; |
| 2531 expectedUnits = extraUnits = 2; | 2530 expectedUnits = extraUnits = 2; |
| 2532 continue loop; | 2531 continue loop; |
| 2533 } | 2532 } |
| 2534 if ((dart.notNull(unit) & 248) == 240 && dart.notNull(unit) < 245)
{ | 2533 if ((dart.notNull(unit) & 248) == 240 && dart.notNull(unit) < 245)
{ |
| 2535 value = dart.notNull(unit) & 7; | 2534 value = dart.notNull(unit) & 7; |
| 2536 expectedUnits = extraUnits = 3; | 2535 expectedUnits = extraUnits = 3; |
| 2537 continue loop; | 2536 continue loop; |
| 2538 } | 2537 } |
| 2539 if (!dart.notNull(this[_allowMalformed])) { | 2538 if (!dart.notNull(this[_allowMalformed])) { |
| 2540 dart.throw(new core.FormatException(`Bad UTF-8 encoding 0x${unit
[dartx.toRadixString](16)}`)); | 2539 dart.throw(new core.FormatException(`Bad UTF-8 encoding 0x${dart
.dcall(unit[dartx.toRadixString], 16)}`)); |
| 2541 } | 2540 } |
| 2542 value = UNICODE_REPLACEMENT_CHARACTER_RUNE; | 2541 value = UNICODE_REPLACEMENT_CHARACTER_RUNE; |
| 2543 expectedUnits = extraUnits = 0; | 2542 expectedUnits = extraUnits = 0; |
| 2544 this[_isFirstCharacter] = false; | 2543 this[_isFirstCharacter] = false; |
| 2545 this[_stringSink].writeCharCode(value); | 2544 dart.dcall(this[_stringSink].writeCharCode, value); |
| 2546 } | 2545 } |
| 2547 } | 2546 } |
| 2548 break loop; | 2547 break loop; |
| 2549 } | 2548 } |
| 2550 if (dart.notNull(expectedUnits) > 0) { | 2549 if (dart.notNull(expectedUnits) > 0) { |
| 2551 this[_value] = value; | 2550 this[_value] = value; |
| 2552 this[_expectedUnits] = expectedUnits; | 2551 this[_expectedUnits] = expectedUnits; |
| 2553 this[_extraUnits] = extraUnits; | 2552 this[_extraUnits] = extraUnits; |
| 2554 } | 2553 } |
| 2555 } | 2554 } |
| 2556 } | 2555 } |
| 2557 dart.setSignature(_Utf8Decoder, { | 2556 dart.setSignature(_Utf8Decoder, { |
| 2558 constructors: () => ({_Utf8Decoder: [_Utf8Decoder, [core.StringSink, core.bo
ol]]}), | 2557 constructors: () => ({_Utf8Decoder: [_Utf8Decoder, [core.StringSink, core.bo
ol]]}), |
| 2559 methods: () => ({ | 2558 methods: () => ({ |
| 2560 close: [dart.void, []], | 2559 close: [dart.void, []], |
| 2561 flush: [dart.void, []], | 2560 flush: [dart.void, []], |
| 2562 convert: [dart.void, [core.List$(core.int), core.int, core.int]] | 2561 convert: [dart.void, [core.List$(core.int), core.int, core.int]] |
| 2563 }) | 2562 }) |
| 2564 }); | 2563 }); |
| 2565 _Utf8Decoder._LIMITS = dart.const(dart.list([_ONE_BYTE_LIMIT, _TWO_BYTE_LIMIT,
_THREE_BYTE_LIMIT, _FOUR_BYTE_LIMIT], core.int)); | 2564 _Utf8Decoder._LIMITS = dart.const(dart.list([_ONE_BYTE_LIMIT, _TWO_BYTE_LIMIT,
_THREE_BYTE_LIMIT, _FOUR_BYTE_LIMIT], core.int)); |
| 2566 let _processed = Symbol('_processed'); | 2565 let _processed = Symbol('_processed'); |
| 2567 let _computeKeys = Symbol('_computeKeys'); | 2566 let _computeKeys = Symbol('_computeKeys'); |
| 2568 let _original = Symbol('_original'); | 2567 let _original = Symbol('_original'); |
| 2569 function _convertJsonToDart(json, reviver) { | 2568 function _convertJsonToDart(json, reviver) { |
| 2570 dart.assert(reviver != null); | 2569 dart.assert(reviver != null); |
| 2571 function walk(e) { | 2570 function walk(e) { |
| 2572 if (e == null || typeof e != "object") { | 2571 if (dart.notNull(dart.as(e == null, core.bool)) || dart.notNull(dart.as(ty
peof e != "object", core.bool))) { |
| 2573 return e; | 2572 return e; |
| 2574 } | 2573 } |
| 2575 if (Object.getPrototypeOf(e) === Array.prototype) { | 2574 if (dart.notNull(dart.as(Object.getPrototypeOf(e) === Array.prototype, cor
e.bool))) { |
| 2576 for (let i = 0; dart.notNull(i) < e.length; i = dart.notNull(i) + 1) { | 2575 for (let i = 0; dart.notNull(i) < dart.notNull(dart.as(e.length, core.nu
m)); i = dart.notNull(i) + 1) { |
| 2577 let item = e[i]; | 2576 let item = e[i]; |
| 2578 e[i] = dart.dcall(reviver, i, walk(item)); | 2577 e[i] = dart.dcall(reviver, i, dart.dcall(walk, item)); |
| 2579 } | 2578 } |
| 2580 return e; | 2579 return e; |
| 2581 } | 2580 } |
| 2582 let map = new _JsonMap(e); | 2581 let map = new _JsonMap(e); |
| 2583 let processed = map[_processed]; | 2582 let processed = map[_processed]; |
| 2584 let keys = map[_computeKeys](); | 2583 let keys = dart.dcall(map[_computeKeys]); |
| 2585 for (let i = 0; dart.notNull(i) < dart.notNull(keys[dartx.length]); i = da
rt.notNull(i) + 1) { | 2584 for (let i = 0; dart.notNull(i) < dart.notNull(keys[dartx.length]); i = da
rt.notNull(i) + 1) { |
| 2586 let key = keys[dartx.get](i); | 2585 let key = keys[dartx.get](i); |
| 2587 let revived = dart.dcall(reviver, key, walk(e[key])); | 2586 let revived = dart.dcall(reviver, key, dart.dcall(walk, e[key])); |
| 2588 processed[key] = revived; | 2587 processed[key] = revived; |
| 2589 } | 2588 } |
| 2590 map[_original] = processed; | 2589 map[_original] = processed; |
| 2591 return map; | 2590 return map; |
| 2592 } | 2591 } |
| 2593 dart.fn(walk); | 2592 dart.fn(walk); |
| 2594 return dart.dcall(reviver, null, walk(json)); | 2593 return dart.dcall(reviver, null, dart.dcall(walk, json)); |
| 2595 } | 2594 } |
| 2596 dart.fn(_convertJsonToDart, dart.dynamic, [dart.dynamic, dart.functionType(dar
t.dynamic, [dart.dynamic, dart.dynamic])]); | 2595 dart.fn(_convertJsonToDart, dart.dynamic, [dart.dynamic, dart.functionType(dar
t.dynamic, [dart.dynamic, dart.dynamic])]); |
| 2597 function _convertJsonToDartLazy(object) { | 2596 function _convertJsonToDartLazy(object) { |
| 2598 if (object == null) | 2597 if (object == null) |
| 2599 return null; | 2598 return null; |
| 2600 if (typeof object != "object") { | 2599 if (dart.notNull(dart.as(typeof object != "object", core.bool))) { |
| 2601 return object; | 2600 return object; |
| 2602 } | 2601 } |
| 2603 if (Object.getPrototypeOf(object) !== Array.prototype) { | 2602 if (dart.notNull(dart.as(Object.getPrototypeOf(object) !== Array.prototype,
core.bool))) { |
| 2604 return new _JsonMap(object); | 2603 return new _JsonMap(object); |
| 2605 } | 2604 } |
| 2606 for (let i = 0; dart.notNull(i) < object.length; i = dart.notNull(i) + 1) { | 2605 for (let i = 0; dart.notNull(i) < dart.notNull(dart.as(object.length, core.n
um)); i = dart.notNull(i) + 1) { |
| 2607 let item = object[i]; | 2606 let item = object[i]; |
| 2608 object[i] = _convertJsonToDartLazy(item); | 2607 object[i] = dart.dcall(_convertJsonToDartLazy, item); |
| 2609 } | 2608 } |
| 2610 return object; | 2609 return object; |
| 2611 } | 2610 } |
| 2612 dart.fn(_convertJsonToDartLazy); | 2611 dart.fn(_convertJsonToDartLazy); |
| 2613 let _data = Symbol('_data'); | 2612 let _data = Symbol('_data'); |
| 2614 let _isUpgraded = Symbol('_isUpgraded'); | 2613 let _isUpgraded = Symbol('_isUpgraded'); |
| 2615 let _upgradedMap = Symbol('_upgradedMap'); | 2614 let _upgradedMap = Symbol('_upgradedMap'); |
| 2616 let _process = Symbol('_process'); | 2615 let _process = Symbol('_process'); |
| 2617 let _upgrade = Symbol('_upgrade'); | 2616 let _upgrade = Symbol('_upgrade'); |
| 2618 class _JsonMap extends core.Object { | 2617 class _JsonMap extends core.Object { |
| 2619 _JsonMap(original) { | 2618 _JsonMap(original) { |
| 2620 this[_processed] = _JsonMap._newJavaScriptObject(); | 2619 this[_processed] = dart.dcall(_JsonMap._newJavaScriptObject); |
| 2621 this[_original] = original; | 2620 this[_original] = original; |
| 2622 this[_data] = null; | 2621 this[_data] = null; |
| 2623 } | 2622 } |
| 2624 get(key) { | 2623 get(key) { |
| 2625 if (dart.notNull(this[_isUpgraded])) { | 2624 if (dart.notNull(this[_isUpgraded])) { |
| 2626 return this[_upgradedMap].get(key); | 2625 return this[_upgradedMap].get(key); |
| 2627 } else if (!(typeof key == 'string')) { | 2626 } else if (!(typeof key == 'string')) { |
| 2628 return null; | 2627 return null; |
| 2629 } else { | 2628 } else { |
| 2630 let result = _JsonMap._getProperty(this[_processed], dart.as(key, core.S
tring)); | 2629 let result = dart.dcall(_JsonMap._getProperty, this[_processed], key); |
| 2631 if (dart.notNull(_JsonMap._isUnprocessed(result))) | 2630 if (dart.notNull(dart.dcall(_JsonMap._isUnprocessed, result))) |
| 2632 result = this[_process](dart.as(key, core.String)); | 2631 result = dart.dcall(this[_process], key); |
| 2633 return result; | 2632 return result; |
| 2634 } | 2633 } |
| 2635 } | 2634 } |
| 2636 get length() { | 2635 get length() { |
| 2637 return dart.notNull(this[_isUpgraded]) ? this[_upgradedMap].length : this[
_computeKeys]()[dartx.length]; | 2636 return dart.notNull(this[_isUpgraded]) ? this[_upgradedMap].length : dart.
dcall(this[_computeKeys])[dartx.length]; |
| 2638 } | 2637 } |
| 2639 get isEmpty() { | 2638 get isEmpty() { |
| 2640 return this.length == 0; | 2639 return this.length == 0; |
| 2641 } | 2640 } |
| 2642 get isNotEmpty() { | 2641 get isNotEmpty() { |
| 2643 return dart.notNull(this.length) > 0; | 2642 return dart.notNull(this.length) > 0; |
| 2644 } | 2643 } |
| 2645 get keys() { | 2644 get keys() { |
| 2646 if (dart.notNull(this[_isUpgraded])) | 2645 if (dart.notNull(this[_isUpgraded])) |
| 2647 return this[_upgradedMap].keys; | 2646 return this[_upgradedMap].keys; |
| 2648 return new _JsonMapKeyIterable(this); | 2647 return new _JsonMapKeyIterable(this); |
| 2649 } | 2648 } |
| 2650 get values() { | 2649 get values() { |
| 2651 if (dart.notNull(this[_isUpgraded])) | 2650 if (dart.notNull(this[_isUpgraded])) |
| 2652 return this[_upgradedMap].values; | 2651 return this[_upgradedMap].values; |
| 2653 return _internal.MappedIterable.new(this[_computeKeys](), dart.fn((each =>
this.get(each)).bind(this))); | 2652 return _internal.MappedIterable.new(dart.dcall(this[_computeKeys]), dart.f
n((each => this.get(each)).bind(this))); |
| 2654 } | 2653 } |
| 2655 set(key, value) { | 2654 set(key, value) { |
| 2656 if (dart.notNull(this[_isUpgraded])) { | 2655 if (dart.notNull(this[_isUpgraded])) { |
| 2657 this[_upgradedMap].set(key, value); | 2656 this[_upgradedMap].set(key, value); |
| 2658 } else if (dart.notNull(this.containsKey(key))) { | 2657 } else if (dart.notNull(dart.dcall(this.containsKey, key))) { |
| 2659 let processed = this[_processed]; | 2658 let processed = this[_processed]; |
| 2660 _JsonMap._setProperty(processed, dart.as(key, core.String), value); | 2659 dart.dcall(_JsonMap._setProperty, processed, key, value); |
| 2661 let original = this[_original]; | 2660 let original = this[_original]; |
| 2662 if (!dart.notNull(core.identical(original, processed))) { | 2661 if (!dart.notNull(dart.dcall(core.identical, original, processed))) { |
| 2663 _JsonMap._setProperty(original, dart.as(key, core.String), null); | 2662 dart.dcall(_JsonMap._setProperty, original, key, null); |
| 2664 } | 2663 } |
| 2665 } else { | 2664 } else { |
| 2666 this[_upgrade]().set(key, value); | 2665 dart.dcall(this[_upgrade]).set(key, value); |
| 2667 } | 2666 } |
| 2668 return value; | 2667 return value; |
| 2669 } | 2668 } |
| 2670 addAll(other) { | 2669 addAll(other) { |
| 2671 other.forEach(dart.fn(((key, value) => { | 2670 dart.dcall(other.forEach, dart.fn(((key, value) => { |
| 2672 this.set(key, value); | 2671 this.set(key, value); |
| 2673 }).bind(this))); | 2672 }).bind(this))); |
| 2674 } | 2673 } |
| 2675 containsValue(value) { | 2674 containsValue(value) { |
| 2676 if (dart.notNull(this[_isUpgraded])) | 2675 if (dart.notNull(this[_isUpgraded])) |
| 2677 return this[_upgradedMap].containsValue(value); | 2676 return dart.dcall(this[_upgradedMap].containsValue, value); |
| 2678 let keys = this[_computeKeys](); | 2677 let keys = dart.dcall(this[_computeKeys]); |
| 2679 for (let i = 0; dart.notNull(i) < dart.notNull(keys[dartx.length]); i = da
rt.notNull(i) + 1) { | 2678 for (let i = 0; dart.notNull(i) < dart.notNull(keys[dartx.length]); i = da
rt.notNull(i) + 1) { |
| 2680 let key = keys[dartx.get](i); | 2679 let key = keys[dartx.get](i); |
| 2681 if (dart.equals(this.get(key), value)) | 2680 if (dart.equals(this.get(key), value)) |
| 2682 return true; | 2681 return true; |
| 2683 } | 2682 } |
| 2684 return false; | 2683 return false; |
| 2685 } | 2684 } |
| 2686 containsKey(key) { | 2685 containsKey(key) { |
| 2687 if (dart.notNull(this[_isUpgraded])) | 2686 if (dart.notNull(this[_isUpgraded])) |
| 2688 return this[_upgradedMap].containsKey(key); | 2687 return dart.dcall(this[_upgradedMap].containsKey, key); |
| 2689 if (!(typeof key == 'string')) | 2688 if (!(typeof key == 'string')) |
| 2690 return false; | 2689 return false; |
| 2691 return _JsonMap._hasProperty(this[_original], dart.as(key, core.String)); | 2690 return dart.dcall(_JsonMap._hasProperty, this[_original], key); |
| 2692 } | 2691 } |
| 2693 putIfAbsent(key, ifAbsent) { | 2692 putIfAbsent(key, ifAbsent) { |
| 2694 if (dart.notNull(this.containsKey(key))) | 2693 if (dart.notNull(dart.dcall(this.containsKey, key))) |
| 2695 return this.get(key); | 2694 return this.get(key); |
| 2696 let value = ifAbsent(); | 2695 let value = ifAbsent(); |
| 2697 this.set(key, value); | 2696 this.set(key, value); |
| 2698 return value; | 2697 return value; |
| 2699 } | 2698 } |
| 2700 remove(key) { | 2699 remove(key) { |
| 2701 if (!dart.notNull(this[_isUpgraded]) && !dart.notNull(this.containsKey(key
))) | 2700 if (!dart.notNull(this[_isUpgraded]) && !dart.notNull(dart.dcall(this.cont
ainsKey, key))) |
| 2702 return null; | 2701 return null; |
| 2703 return this[_upgrade]().remove(key); | 2702 return dart.dcall(dart.dcall(this[_upgrade]).remove, key); |
| 2704 } | 2703 } |
| 2705 clear() { | 2704 clear() { |
| 2706 if (dart.notNull(this[_isUpgraded])) { | 2705 if (dart.notNull(this[_isUpgraded])) { |
| 2707 this[_upgradedMap].clear(); | 2706 dart.dcall(this[_upgradedMap].clear); |
| 2708 } else { | 2707 } else { |
| 2709 if (this[_data] != null) { | 2708 if (this[_data] != null) { |
| 2710 dart.dsend(this[_data], 'clear'); | 2709 dart.dsend(this[_data], 'clear'); |
| 2711 } | 2710 } |
| 2712 this[_original] = this[_processed] = null; | 2711 this[_original] = this[_processed] = null; |
| 2713 this[_data] = dart.map(); | 2712 this[_data] = dart.map(); |
| 2714 } | 2713 } |
| 2715 } | 2714 } |
| 2716 forEach(f) { | 2715 forEach(f) { |
| 2717 if (dart.notNull(this[_isUpgraded])) | 2716 if (dart.notNull(this[_isUpgraded])) |
| 2718 return this[_upgradedMap].forEach(f); | 2717 return dart.dcall(this[_upgradedMap].forEach, f); |
| 2719 let keys = this[_computeKeys](); | 2718 let keys = dart.dcall(this[_computeKeys]); |
| 2720 for (let i = 0; dart.notNull(i) < dart.notNull(keys[dartx.length]); i = da
rt.notNull(i) + 1) { | 2719 for (let i = 0; dart.notNull(i) < dart.notNull(keys[dartx.length]); i = da
rt.notNull(i) + 1) { |
| 2721 let key = keys[dartx.get](i); | 2720 let key = keys[dartx.get](i); |
| 2722 let value = _JsonMap._getProperty(this[_processed], key); | 2721 let value = dart.dcall(_JsonMap._getProperty, this[_processed], key); |
| 2723 if (dart.notNull(_JsonMap._isUnprocessed(value))) { | 2722 if (dart.notNull(dart.dcall(_JsonMap._isUnprocessed, value))) { |
| 2724 value = _convertJsonToDartLazy(_JsonMap._getProperty(this[_original],
key)); | 2723 value = dart.dcall(_convertJsonToDartLazy, dart.dcall(_JsonMap._getPro
perty, this[_original], key)); |
| 2725 _JsonMap._setProperty(this[_processed], key, value); | 2724 dart.dcall(_JsonMap._setProperty, this[_processed], key, value); |
| 2726 } | 2725 } |
| 2727 dart.dcall(f, key, value); | 2726 dart.dcall(f, key, value); |
| 2728 if (!dart.notNull(core.identical(keys, this[_data]))) { | 2727 if (!dart.notNull(dart.dcall(core.identical, keys, this[_data]))) { |
| 2729 dart.throw(new core.ConcurrentModificationError(this)); | 2728 dart.throw(new core.ConcurrentModificationError(this)); |
| 2730 } | 2729 } |
| 2731 } | 2730 } |
| 2732 } | 2731 } |
| 2733 toString() { | 2732 toString() { |
| 2734 return collection.Maps.mapToString(this); | 2733 return dart.dcall(collection.Maps.mapToString, this); |
| 2735 } | 2734 } |
| 2736 get [_isUpgraded]() { | 2735 get [_isUpgraded]() { |
| 2737 return this[_processed] == null; | 2736 return this[_processed] == null; |
| 2738 } | 2737 } |
| 2739 get [_upgradedMap]() { | 2738 get [_upgradedMap]() { |
| 2740 dart.assert(this[_isUpgraded]); | 2739 dart.assert(this[_isUpgraded]); |
| 2741 return dart.as(this[_data], core.Map); | 2740 return dart.as(this[_data], core.Map); |
| 2742 } | 2741 } |
| 2743 [_computeKeys]() { | 2742 [_computeKeys]() { |
| 2744 dart.assert(!dart.notNull(this[_isUpgraded])); | 2743 dart.assert(!dart.notNull(this[_isUpgraded])); |
| 2745 let keys = dart.as(this[_data], core.List); | 2744 let keys = dart.as(this[_data], core.List); |
| 2746 if (keys == null) { | 2745 if (keys == null) { |
| 2747 keys = this[_data] = _JsonMap._getPropertyNames(this[_original]); | 2746 keys = this[_data] = dart.dcall(_JsonMap._getPropertyNames, this[_origin
al]); |
| 2748 } | 2747 } |
| 2749 return dart.as(keys, core.List$(core.String)); | 2748 return dart.as(keys, core.List$(core.String)); |
| 2750 } | 2749 } |
| 2751 [_upgrade]() { | 2750 [_upgrade]() { |
| 2752 if (dart.notNull(this[_isUpgraded])) | 2751 if (dart.notNull(this[_isUpgraded])) |
| 2753 return this[_upgradedMap]; | 2752 return this[_upgradedMap]; |
| 2754 let result = dart.map(); | 2753 let result = dart.map(); |
| 2755 let keys = this[_computeKeys](); | 2754 let keys = dart.dcall(this[_computeKeys]); |
| 2756 for (let i = 0; dart.notNull(i) < dart.notNull(keys[dartx.length]); i = da
rt.notNull(i) + 1) { | 2755 for (let i = 0; dart.notNull(i) < dart.notNull(keys[dartx.length]); i = da
rt.notNull(i) + 1) { |
| 2757 let key = keys[dartx.get](i); | 2756 let key = keys[dartx.get](i); |
| 2758 result.set(key, this.get(key)); | 2757 result.set(key, this.get(key)); |
| 2759 } | 2758 } |
| 2760 if (dart.notNull(keys[dartx.isEmpty])) { | 2759 if (dart.notNull(keys[dartx.isEmpty])) { |
| 2761 keys[dartx.add](null); | 2760 dart.dcall(keys[dartx.add], null); |
| 2762 } else { | 2761 } else { |
| 2763 keys[dartx.clear](); | 2762 dart.dcall(keys[dartx.clear]); |
| 2764 } | 2763 } |
| 2765 this[_original] = this[_processed] = null; | 2764 this[_original] = this[_processed] = null; |
| 2766 this[_data] = result; | 2765 this[_data] = result; |
| 2767 dart.assert(this[_isUpgraded]); | 2766 dart.assert(this[_isUpgraded]); |
| 2768 return result; | 2767 return result; |
| 2769 } | 2768 } |
| 2770 [_process](key) { | 2769 [_process](key) { |
| 2771 if (!dart.notNull(_JsonMap._hasProperty(this[_original], key))) | 2770 if (!dart.notNull(dart.dcall(_JsonMap._hasProperty, this[_original], key))
) |
| 2772 return null; | 2771 return null; |
| 2773 let result = _convertJsonToDartLazy(_JsonMap._getProperty(this[_original],
key)); | 2772 let result = dart.dcall(_convertJsonToDartLazy, dart.dcall(_JsonMap._getPr
operty, this[_original], key)); |
| 2774 return _JsonMap._setProperty(this[_processed], key, result); | 2773 return dart.dcall(_JsonMap._setProperty, this[_processed], key, result); |
| 2775 } | 2774 } |
| 2776 static _hasProperty(object, key) { | 2775 static _hasProperty(object, key) { |
| 2777 return Object.prototype.hasOwnProperty.call(object, key); | 2776 return dart.as(Object.prototype.hasOwnProperty.call(object, key), core.boo
l); |
| 2778 } | 2777 } |
| 2779 static _getProperty(object, key) { | 2778 static _getProperty(object, key) { |
| 2780 return object[key]; | 2779 return object[key]; |
| 2781 } | 2780 } |
| 2782 static _setProperty(object, key, value) { | 2781 static _setProperty(object, key, value) { |
| 2783 return object[key] = value; | 2782 return object[key] = value; |
| 2784 } | 2783 } |
| 2785 static _getPropertyNames(object) { | 2784 static _getPropertyNames(object) { |
| 2786 return dart.as(Object.keys(object), core.List); | 2785 return dart.as(Object.keys(object), core.List); |
| 2787 } | 2786 } |
| 2788 static _isUnprocessed(object) { | 2787 static _isUnprocessed(object) { |
| 2789 return typeof object == "undefined"; | 2788 return dart.as(typeof object == "undefined", core.bool); |
| 2790 } | 2789 } |
| 2791 static _newJavaScriptObject() { | 2790 static _newJavaScriptObject() { |
| 2792 return Object.create(null); | 2791 return Object.create(null); |
| 2793 } | 2792 } |
| 2794 } | 2793 } |
| 2795 _JsonMap[dart.implements] = () => [collection.LinkedHashMap]; | 2794 _JsonMap[dart.implements] = () => [collection.LinkedHashMap]; |
| 2796 dart.setSignature(_JsonMap, { | 2795 dart.setSignature(_JsonMap, { |
| 2797 constructors: () => ({_JsonMap: [_JsonMap, [dart.dynamic]]}), | 2796 constructors: () => ({_JsonMap: [_JsonMap, [dart.dynamic]]}), |
| 2798 methods: () => ({ | 2797 methods: () => ({ |
| 2799 get: [dart.dynamic, [core.Object]], | 2798 get: [dart.dynamic, [core.Object]], |
| 2800 set: [dart.void, [dart.dynamic, dart.dynamic]], | 2799 set: [dart.dynamic, [dart.dynamic, dart.dynamic]], |
| 2801 addAll: [dart.void, [core.Map]], | 2800 addAll: [dart.void, [core.Map]], |
| 2802 containsValue: [core.bool, [core.Object]], | 2801 containsValue: [core.bool, [core.Object]], |
| 2803 containsKey: [core.bool, [core.Object]], | 2802 containsKey: [core.bool, [core.Object]], |
| 2804 putIfAbsent: [dart.dynamic, [dart.dynamic, dart.functionType(dart.dynamic,
[])]], | 2803 putIfAbsent: [dart.dynamic, [dart.dynamic, dart.functionType(dart.dynamic,
[])]], |
| 2805 remove: [dart.dynamic, [core.Object]], | 2804 remove: [dart.dynamic, [core.Object]], |
| 2806 clear: [dart.void, []], | 2805 clear: [dart.void, []], |
| 2807 forEach: [dart.void, [dart.functionType(dart.void, [dart.dynamic, dart.dyn
amic])]], | 2806 forEach: [dart.void, [dart.functionType(dart.void, [dart.dynamic, dart.dyn
amic])]], |
| 2808 [_computeKeys]: [core.List$(core.String), []], | 2807 [_computeKeys]: [core.List$(core.String), []], |
| 2809 [_upgrade]: [core.Map, []], | 2808 [_upgrade]: [core.Map, []], |
| 2810 [_process]: [dart.dynamic, [core.String]] | 2809 [_process]: [dart.dynamic, [core.String]] |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2822 let _parent = Symbol('_parent'); | 2821 let _parent = Symbol('_parent'); |
| 2823 class _JsonMapKeyIterable extends _internal.ListIterable { | 2822 class _JsonMapKeyIterable extends _internal.ListIterable { |
| 2824 _JsonMapKeyIterable(parent) { | 2823 _JsonMapKeyIterable(parent) { |
| 2825 this[_parent] = parent; | 2824 this[_parent] = parent; |
| 2826 super.ListIterable(); | 2825 super.ListIterable(); |
| 2827 } | 2826 } |
| 2828 get length() { | 2827 get length() { |
| 2829 return this[_parent].length; | 2828 return this[_parent].length; |
| 2830 } | 2829 } |
| 2831 elementAt(index) { | 2830 elementAt(index) { |
| 2832 return dart.notNull(this[_parent][_isUpgraded]) ? dart.as(this[_parent].ke
ys[dartx.elementAt](index), core.String) : this[_parent][_computeKeys]()[dartx.g
et](index); | 2831 return dart.notNull(this[_parent][_isUpgraded]) ? dart.as(dart.dcall(this[
_parent].keys[dartx.elementAt], index), core.String) : dart.dcall(this[_parent][
_computeKeys])[dartx.get](index); |
| 2833 } | 2832 } |
| 2834 get iterator() { | 2833 get iterator() { |
| 2835 return dart.notNull(this[_parent][_isUpgraded]) ? this[_parent].keys[dartx
.iterator] : this[_parent][_computeKeys]()[dartx.iterator]; | 2834 return dart.notNull(this[_parent][_isUpgraded]) ? this[_parent].keys[dartx
.iterator] : dart.dcall(this[_parent][_computeKeys])[dartx.iterator]; |
| 2836 } | 2835 } |
| 2837 contains(key) { | 2836 contains(key) { |
| 2838 return this[_parent].containsKey(key); | 2837 return dart.dcall(this[_parent].containsKey, key); |
| 2839 } | 2838 } |
| 2840 } | 2839 } |
| 2841 dart.setSignature(_JsonMapKeyIterable, { | 2840 dart.setSignature(_JsonMapKeyIterable, { |
| 2842 constructors: () => ({_JsonMapKeyIterable: [_JsonMapKeyIterable, [_JsonMap]]
}), | 2841 constructors: () => ({_JsonMapKeyIterable: [_JsonMapKeyIterable, [_JsonMap]]
}), |
| 2843 methods: () => ({elementAt: [core.String, [core.int]]}) | 2842 methods: () => ({elementAt: [core.String, [core.int]]}) |
| 2844 }); | 2843 }); |
| 2845 dart.defineExtensionMembers(_JsonMapKeyIterable, ['elementAt', 'contains', 'le
ngth', 'iterator']); | 2844 dart.defineExtensionMembers(_JsonMapKeyIterable, ['elementAt', 'contains', 'le
ngth', 'iterator']); |
| 2846 class _JsonDecoderSink extends _StringSinkConversionSink { | 2845 class _JsonDecoderSink extends _StringSinkConversionSink { |
| 2847 _JsonDecoderSink(reviver, sink) { | 2846 _JsonDecoderSink(reviver, sink) { |
| 2848 this[_reviver] = reviver; | 2847 this[_reviver] = reviver; |
| 2849 this[_sink] = sink; | 2848 this[_sink] = sink; |
| 2850 super._StringSinkConversionSink(new core.StringBuffer()); | 2849 super._StringSinkConversionSink(new core.StringBuffer()); |
| 2851 } | 2850 } |
| 2852 close() { | 2851 close() { |
| 2853 super.close(); | 2852 dart.dcall(super.close); |
| 2854 let buffer = dart.as(this[_stringSink], core.StringBuffer); | 2853 let buffer = dart.as(this[_stringSink], core.StringBuffer); |
| 2855 let accumulated = dart.toString(buffer); | 2854 let accumulated = dart.dcall(buffer.toString); |
| 2856 buffer.clear(); | 2855 dart.dcall(buffer.clear); |
| 2857 let decoded = _parseJson(accumulated, this[_reviver]); | 2856 let decoded = dart.dcall(_parseJson, accumulated, this[_reviver]); |
| 2858 this[_sink].add(decoded); | 2857 dart.dcall(this[_sink].add, decoded); |
| 2859 this[_sink].close(); | 2858 dart.dcall(this[_sink].close); |
| 2860 } | 2859 } |
| 2861 } | 2860 } |
| 2862 dart.setSignature(_JsonDecoderSink, { | 2861 dart.setSignature(_JsonDecoderSink, { |
| 2863 constructors: () => ({_JsonDecoderSink: [_JsonDecoderSink, [_Reviver, core.S
ink$(core.Object)]]}) | 2862 constructors: () => ({_JsonDecoderSink: [_JsonDecoderSink, [_Reviver, core.S
ink$(core.Object)]]}) |
| 2864 }); | 2863 }); |
| 2865 // Exports: | 2864 // Exports: |
| 2866 exports.Codec$ = Codec$; | 2865 exports.Codec$ = Codec$; |
| 2867 exports.Codec = Codec; | 2866 exports.Codec = Codec; |
| 2868 exports.Encoding = Encoding; | 2867 exports.Encoding = Encoding; |
| 2869 exports.AsciiCodec = AsciiCodec; | 2868 exports.AsciiCodec = AsciiCodec; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 2895 exports.LineSplitter = LineSplitter; | 2894 exports.LineSplitter = LineSplitter; |
| 2896 exports.StringConversionSink = StringConversionSink; | 2895 exports.StringConversionSink = StringConversionSink; |
| 2897 exports.ClosableStringSink = ClosableStringSink; | 2896 exports.ClosableStringSink = ClosableStringSink; |
| 2898 exports.UNICODE_REPLACEMENT_CHARACTER_RUNE = UNICODE_REPLACEMENT_CHARACTER_RUN
E; | 2897 exports.UNICODE_REPLACEMENT_CHARACTER_RUNE = UNICODE_REPLACEMENT_CHARACTER_RUN
E; |
| 2899 exports.UNICODE_BOM_CHARACTER_RUNE = UNICODE_BOM_CHARACTER_RUNE; | 2898 exports.UNICODE_BOM_CHARACTER_RUNE = UNICODE_BOM_CHARACTER_RUNE; |
| 2900 exports.Utf8Codec = Utf8Codec; | 2899 exports.Utf8Codec = Utf8Codec; |
| 2901 exports.UTF8 = UTF8; | 2900 exports.UTF8 = UTF8; |
| 2902 exports.Utf8Encoder = Utf8Encoder; | 2901 exports.Utf8Encoder = Utf8Encoder; |
| 2903 exports.Utf8Decoder = Utf8Decoder; | 2902 exports.Utf8Decoder = Utf8Decoder; |
| 2904 }); | 2903 }); |
| OLD | NEW |