| OLD | NEW |
| 1 var convert; | 1 var convert; |
| 2 (function(exports) { | 2 (function(exports) { |
| 3 'use strict'; | 3 'use strict'; |
| 4 let ASCII = new AsciiCodec(); | 4 let ASCII = new AsciiCodec(); |
| 5 let _ASCII_MASK = 127; | 5 let _ASCII_MASK = 127; |
| 6 let _allowInvalid = Symbol('_allowInvalid'); | 6 let _allowInvalid = Symbol('_allowInvalid'); |
| 7 let _nameToEncoding = Symbol('_nameToEncoding'); | 7 let _nameToEncoding = Symbol('_nameToEncoding'); |
| 8 let Codec$ = dart.generic(function(S, T) { | 8 let Codec$ = dart.generic(function(S, T) { |
| 9 class Codec extends core.Object { | 9 class Codec extends core.Object { |
| 10 Codec() { | 10 Codec() { |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 core.RangeError.checkValidRange(start, end, stringLength); | 104 core.RangeError.checkValidRange(start, end, stringLength); |
| 105 if (end == null) | 105 if (end == null) |
| 106 end = stringLength; | 106 end = stringLength; |
| 107 let length = dart.notNull(end) - dart.notNull(start); | 107 let length = dart.notNull(end) - dart.notNull(start); |
| 108 let result = new typed_data.Uint8List(length); | 108 let result = new typed_data.Uint8List(length); |
| 109 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull(i
) + 1) { | 109 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull(i
) + 1) { |
| 110 let codeUnit = string.codeUnitAt(dart.notNull(start) + dart.notNull(i)); | 110 let codeUnit = string.codeUnitAt(dart.notNull(start) + dart.notNull(i)); |
| 111 if ((dart.notNull(codeUnit) & ~dart.notNull(this[_subsetMask])) != 0) { | 111 if ((dart.notNull(codeUnit) & ~dart.notNull(this[_subsetMask])) != 0) { |
| 112 throw new core.ArgumentError("String contains invalid characters."); | 112 throw new core.ArgumentError("String contains invalid characters."); |
| 113 } | 113 } |
| 114 result.set(i, codeUnit); | 114 result[core.$set](i, codeUnit); |
| 115 } | 115 } |
| 116 return dart.as(result, core.List$(core.int)); | 116 return dart.as(result, core.List$(core.int)); |
| 117 } | 117 } |
| 118 startChunkedConversion(sink) { | 118 startChunkedConversion(sink) { |
| 119 if (!dart.is(sink, ByteConversionSink)) { | 119 if (!dart.is(sink, ByteConversionSink)) { |
| 120 sink = new ByteConversionSink.from(sink); | 120 sink = new ByteConversionSink.from(sink); |
| 121 } | 121 } |
| 122 return new _UnicodeSubsetEncoderSink(this[_subsetMask], dart.as(sink, Byte
ConversionSink)); | 122 return new _UnicodeSubsetEncoderSink(this[_subsetMask], dart.as(sink, Byte
ConversionSink)); |
| 123 } | 123 } |
| 124 bind(stream) { | 124 bind(stream) { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 155 this[_sink].close(); | 155 this[_sink].close(); |
| 156 } | 156 } |
| 157 addSlice(source, start, end, isLast) { | 157 addSlice(source, start, end, isLast) { |
| 158 core.RangeError.checkValidRange(start, end, source.length); | 158 core.RangeError.checkValidRange(start, end, source.length); |
| 159 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { | 159 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { |
| 160 let codeUnit = source.codeUnitAt(i); | 160 let codeUnit = source.codeUnitAt(i); |
| 161 if ((dart.notNull(codeUnit) & ~dart.notNull(this[_subsetMask])) != 0) { | 161 if ((dart.notNull(codeUnit) & ~dart.notNull(this[_subsetMask])) != 0) { |
| 162 throw new core.ArgumentError(`Source contains invalid character with c
ode point: ${codeUnit}.`); | 162 throw new core.ArgumentError(`Source contains invalid character with c
ode point: ${codeUnit}.`); |
| 163 } | 163 } |
| 164 } | 164 } |
| 165 this[_sink].add(source.codeUnits.sublist(start, end)); | 165 this[_sink].add(source.codeUnits[core.$sublist](start, end)); |
| 166 if (isLast) { | 166 if (isLast) { |
| 167 this.close(); | 167 this.close(); |
| 168 } | 168 } |
| 169 } | 169 } |
| 170 } | 170 } |
| 171 let _convertInvalid = Symbol('_convertInvalid'); | 171 let _convertInvalid = Symbol('_convertInvalid'); |
| 172 class _UnicodeSubsetDecoder extends Converter$(core.List$(core.int), core.Stri
ng) { | 172 class _UnicodeSubsetDecoder extends Converter$(core.List$(core.int), core.Stri
ng) { |
| 173 _UnicodeSubsetDecoder(allowInvalid$, subsetMask) { | 173 _UnicodeSubsetDecoder(allowInvalid$, subsetMask) { |
| 174 this[_allowInvalid] = allowInvalid$; | 174 this[_allowInvalid] = allowInvalid$; |
| 175 this[_subsetMask] = subsetMask; | 175 this[_subsetMask] = subsetMask; |
| 176 super.Converter(); | 176 super.Converter(); |
| 177 } | 177 } |
| 178 convert(bytes, start, end) { | 178 convert(bytes, start, end) { |
| 179 if (start === void 0) | 179 if (start === void 0) |
| 180 start = 0; | 180 start = 0; |
| 181 if (end === void 0) | 181 if (end === void 0) |
| 182 end = null; | 182 end = null; |
| 183 let byteCount = bytes.length; | 183 let byteCount = bytes[core.$length]; |
| 184 core.RangeError.checkValidRange(start, end, byteCount); | 184 core.RangeError.checkValidRange(start, end, byteCount); |
| 185 if (end == null) | 185 if (end == null) |
| 186 end = byteCount; | 186 end = byteCount; |
| 187 let length = dart.notNull(end) - dart.notNull(start); | 187 let length = dart.notNull(end) - dart.notNull(start); |
| 188 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { | 188 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { |
| 189 let byte = bytes.get(i); | 189 let byte = bytes[core.$get](i); |
| 190 if ((dart.notNull(byte) & ~dart.notNull(this[_subsetMask])) != 0) { | 190 if ((dart.notNull(byte) & ~dart.notNull(this[_subsetMask])) != 0) { |
| 191 if (!dart.notNull(this[_allowInvalid])) { | 191 if (!dart.notNull(this[_allowInvalid])) { |
| 192 throw new core.FormatException(`Invalid value in input: ${byte}`); | 192 throw new core.FormatException(`Invalid value in input: ${byte}`); |
| 193 } | 193 } |
| 194 return this[_convertInvalid](bytes, start, end); | 194 return this[_convertInvalid](bytes, start, end); |
| 195 } | 195 } |
| 196 } | 196 } |
| 197 return new core.String.fromCharCodes(bytes, start, end); | 197 return new core.String.fromCharCodes(bytes, start, end); |
| 198 } | 198 } |
| 199 [_convertInvalid](bytes, start, end) { | 199 [_convertInvalid](bytes, start, end) { |
| 200 let buffer = new core.StringBuffer(); | 200 let buffer = new core.StringBuffer(); |
| 201 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { | 201 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { |
| 202 let value = bytes.get(i); | 202 let value = bytes[core.$get](i); |
| 203 if ((dart.notNull(value) & ~dart.notNull(this[_subsetMask])) != 0) | 203 if ((dart.notNull(value) & ~dart.notNull(this[_subsetMask])) != 0) |
| 204 value = 65533; | 204 value = 65533; |
| 205 buffer.writeCharCode(value); | 205 buffer.writeCharCode(value); |
| 206 } | 206 } |
| 207 return buffer.toString(); | 207 return buffer.toString(); |
| 208 } | 208 } |
| 209 bind(stream) { | 209 bind(stream) { |
| 210 return dart.as(super.bind(stream), async.Stream$(core.String)); | 210 return dart.as(super.bind(stream), async.Stream$(core.String)); |
| 211 } | 211 } |
| 212 } | 212 } |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 return new _ByteCallbackSink(callback); | 251 return new _ByteCallbackSink(callback); |
| 252 } | 252 } |
| 253 from(sink) { | 253 from(sink) { |
| 254 return new _ByteAdapterSink(sink); | 254 return new _ByteAdapterSink(sink); |
| 255 } | 255 } |
| 256 } | 256 } |
| 257 dart.defineNamedConstructor(ByteConversionSink, 'withCallback'); | 257 dart.defineNamedConstructor(ByteConversionSink, 'withCallback'); |
| 258 dart.defineNamedConstructor(ByteConversionSink, 'from'); | 258 dart.defineNamedConstructor(ByteConversionSink, 'from'); |
| 259 class ByteConversionSinkBase extends ByteConversionSink { | 259 class ByteConversionSinkBase extends ByteConversionSink { |
| 260 addSlice(chunk, start, end, isLast) { | 260 addSlice(chunk, start, end, isLast) { |
| 261 this.add(chunk.sublist(start, end)); | 261 this.add(chunk[core.$sublist](start, end)); |
| 262 if (isLast) | 262 if (isLast) |
| 263 this.close(); | 263 this.close(); |
| 264 } | 264 } |
| 265 } | 265 } |
| 266 class _ErrorHandlingAsciiDecoderSink extends ByteConversionSinkBase { | 266 class _ErrorHandlingAsciiDecoderSink extends ByteConversionSinkBase { |
| 267 _ErrorHandlingAsciiDecoderSink(utf8Sink) { | 267 _ErrorHandlingAsciiDecoderSink(utf8Sink) { |
| 268 this[_utf8Sink] = utf8Sink; | 268 this[_utf8Sink] = utf8Sink; |
| 269 super.ByteConversionSinkBase(); | 269 super.ByteConversionSinkBase(); |
| 270 } | 270 } |
| 271 close() { | 271 close() { |
| 272 this[_utf8Sink].close(); | 272 this[_utf8Sink].close(); |
| 273 } | 273 } |
| 274 add(source) { | 274 add(source) { |
| 275 this.addSlice(source, 0, source.length, false); | 275 this.addSlice(source, 0, source[core.$length], false); |
| 276 } | 276 } |
| 277 addSlice(source, start, end, isLast) { | 277 addSlice(source, start, end, isLast) { |
| 278 core.RangeError.checkValidRange(start, end, source.length); | 278 core.RangeError.checkValidRange(start, end, source[core.$length]); |
| 279 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { | 279 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { |
| 280 if ((dart.notNull(source.get(i)) & ~dart.notNull(_ASCII_MASK)) != 0) { | 280 if ((dart.notNull(source[core.$get](i)) & ~dart.notNull(_ASCII_MASK)) !=
0) { |
| 281 if (dart.notNull(i) > dart.notNull(start)) | 281 if (dart.notNull(i) > dart.notNull(start)) |
| 282 this[_utf8Sink].addSlice(source, start, i, false); | 282 this[_utf8Sink].addSlice(source, start, i, false); |
| 283 this[_utf8Sink].add(/* Unimplemented const */new core.List$(core.int).
from([239, 191, 189])); | 283 this[_utf8Sink].add(/* Unimplemented const */new core.List$(core.int).
from([239, 191, 189])); |
| 284 start = dart.notNull(i) + 1; | 284 start = dart.notNull(i) + 1; |
| 285 } | 285 } |
| 286 } | 286 } |
| 287 if (dart.notNull(start) < dart.notNull(end)) { | 287 if (dart.notNull(start) < dart.notNull(end)) { |
| 288 this[_utf8Sink].addSlice(source, start, end, isLast); | 288 this[_utf8Sink].addSlice(source, start, end, isLast); |
| 289 } else if (isLast) { | 289 } else if (isLast) { |
| 290 this.close(); | 290 this.close(); |
| 291 } | 291 } |
| 292 } | 292 } |
| 293 } | 293 } |
| 294 class _SimpleAsciiDecoderSink extends ByteConversionSinkBase { | 294 class _SimpleAsciiDecoderSink extends ByteConversionSinkBase { |
| 295 _SimpleAsciiDecoderSink(sink$) { | 295 _SimpleAsciiDecoderSink(sink$) { |
| 296 this[_sink] = sink$; | 296 this[_sink] = sink$; |
| 297 super.ByteConversionSinkBase(); | 297 super.ByteConversionSinkBase(); |
| 298 } | 298 } |
| 299 close() { | 299 close() { |
| 300 this[_sink].close(); | 300 this[_sink].close(); |
| 301 } | 301 } |
| 302 add(source) { | 302 add(source) { |
| 303 for (let i = 0; dart.notNull(i) < dart.notNull(source.length); i = dart.no
tNull(i) + 1) { | 303 for (let i = 0; dart.notNull(i) < dart.notNull(source[core.$length]); i =
dart.notNull(i) + 1) { |
| 304 if ((dart.notNull(source.get(i)) & ~dart.notNull(_ASCII_MASK)) != 0) { | 304 if ((dart.notNull(source[core.$get](i)) & ~dart.notNull(_ASCII_MASK)) !=
0) { |
| 305 throw new core.FormatException("Source contains non-ASCII bytes."); | 305 throw new core.FormatException("Source contains non-ASCII bytes."); |
| 306 } | 306 } |
| 307 } | 307 } |
| 308 this[_sink].add(new core.String.fromCharCodes(source)); | 308 this[_sink].add(new core.String.fromCharCodes(source)); |
| 309 } | 309 } |
| 310 addSlice(source, start, end, isLast) { | 310 addSlice(source, start, end, isLast) { |
| 311 let length = source.length; | 311 let length = source[core.$length]; |
| 312 core.RangeError.checkValidRange(start, end, length); | 312 core.RangeError.checkValidRange(start, end, length); |
| 313 if (dart.notNull(start) < dart.notNull(end)) { | 313 if (dart.notNull(start) < dart.notNull(end)) { |
| 314 if (start != 0 || end != length) { | 314 if (start != 0 || end != length) { |
| 315 source = source.sublist(start, end); | 315 source = source[core.$sublist](start, end); |
| 316 } | 316 } |
| 317 this.add(source); | 317 this.add(source); |
| 318 } | 318 } |
| 319 if (isLast) | 319 if (isLast) |
| 320 this.close(); | 320 this.close(); |
| 321 } | 321 } |
| 322 } | 322 } |
| 323 class _ByteAdapterSink extends ByteConversionSinkBase { | 323 class _ByteAdapterSink extends ByteConversionSinkBase { |
| 324 _ByteAdapterSink(sink$) { | 324 _ByteAdapterSink(sink$) { |
| 325 this[_sink] = sink$; | 325 this[_sink] = sink$; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 338 let _bufferIndex = Symbol('_bufferIndex'); | 338 let _bufferIndex = Symbol('_bufferIndex'); |
| 339 let _roundToPowerOf2 = Symbol('_roundToPowerOf2'); | 339 let _roundToPowerOf2 = Symbol('_roundToPowerOf2'); |
| 340 class _ByteCallbackSink extends ByteConversionSinkBase { | 340 class _ByteCallbackSink extends ByteConversionSinkBase { |
| 341 _ByteCallbackSink(callback) { | 341 _ByteCallbackSink(callback) { |
| 342 this[_buffer] = new typed_data.Uint8List(_ByteCallbackSink[_INITIAL_BUFFER
_SIZE]); | 342 this[_buffer] = new typed_data.Uint8List(_ByteCallbackSink[_INITIAL_BUFFER
_SIZE]); |
| 343 this[_callback] = callback; | 343 this[_callback] = callback; |
| 344 this[_bufferIndex] = 0; | 344 this[_bufferIndex] = 0; |
| 345 super.ByteConversionSinkBase(); | 345 super.ByteConversionSinkBase(); |
| 346 } | 346 } |
| 347 add(chunk) { | 347 add(chunk) { |
| 348 let freeCount = dart.notNull(this[_buffer].length) - dart.notNull(this[_bu
fferIndex]); | 348 let freeCount = dart.notNull(this[_buffer][core.$length]) - dart.notNull(t
his[_bufferIndex]); |
| 349 if (dart.notNull(chunk.length) > dart.notNull(freeCount)) { | 349 if (dart.notNull(chunk[core.$length]) > dart.notNull(freeCount)) { |
| 350 let oldLength = this[_buffer].length; | 350 let oldLength = this[_buffer][core.$length]; |
| 351 let newLength = dart.notNull(_ByteCallbackSink[_roundToPowerOf2](dart.no
tNull(chunk.length) + dart.notNull(oldLength))) * 2; | 351 let newLength = dart.notNull(_ByteCallbackSink[_roundToPowerOf2](dart.no
tNull(chunk[core.$length]) + dart.notNull(oldLength))) * 2; |
| 352 let grown = new typed_data.Uint8List(newLength); | 352 let grown = new typed_data.Uint8List(newLength); |
| 353 grown.setRange(0, this[_buffer].length, this[_buffer]); | 353 grown[core.$setRange](0, this[_buffer][core.$length], this[_buffer]); |
| 354 this[_buffer] = grown; | 354 this[_buffer] = grown; |
| 355 } | 355 } |
| 356 this[_buffer].setRange(this[_bufferIndex], dart.notNull(this[_bufferIndex]
) + dart.notNull(chunk.length), chunk); | 356 this[_buffer][core.$setRange](this[_bufferIndex], dart.notNull(this[_buffe
rIndex]) + dart.notNull(chunk[core.$length]), chunk); |
| 357 this[_bufferIndex] = chunk.length; | 357 this[_bufferIndex] = chunk[core.$length]; |
| 358 } | 358 } |
| 359 static [_roundToPowerOf2](v) { | 359 static [_roundToPowerOf2](v) { |
| 360 dart.assert(dart.notNull(v) > 0); | 360 dart.assert(dart.notNull(v) > 0); |
| 361 v = dart.notNull(v) - 1; | 361 v = dart.notNull(v) - 1; |
| 362 v = dart.notNull(v) >> 1; | 362 v = dart.notNull(v) >> 1; |
| 363 v = dart.notNull(v) >> 2; | 363 v = dart.notNull(v) >> 2; |
| 364 v = dart.notNull(v) >> 4; | 364 v = dart.notNull(v) >> 4; |
| 365 v = dart.notNull(v) >> 8; | 365 v = dart.notNull(v) >> 8; |
| 366 v = dart.notNull(v) >> 16; | 366 v = dart.notNull(v) >> 16; |
| 367 v = dart.notNull(v) + 1; | 367 v = dart.notNull(v) + 1; |
| 368 return v; | 368 return v; |
| 369 } | 369 } |
| 370 close() { | 370 close() { |
| 371 this[_callback](this[_buffer].sublist(0, this[_bufferIndex])); | 371 this[_callback](this[_buffer][core.$sublist](0, this[_bufferIndex])); |
| 372 } | 372 } |
| 373 } | 373 } |
| 374 _ByteCallbackSink._INITIAL_BUFFER_SIZE = 1024; | 374 _ByteCallbackSink._INITIAL_BUFFER_SIZE = 1024; |
| 375 let _accumulated = Symbol('_accumulated'); | 375 let _accumulated = Symbol('_accumulated'); |
| 376 let _SimpleCallbackSink$ = dart.generic(function(T) { | 376 let _SimpleCallbackSink$ = dart.generic(function(T) { |
| 377 class _SimpleCallbackSink extends ChunkedConversionSink$(T) { | 377 class _SimpleCallbackSink extends ChunkedConversionSink$(T) { |
| 378 _SimpleCallbackSink(callback$) { | 378 _SimpleCallbackSink(callback$) { |
| 379 this[_accumulated] = new core.List$(T).from([]); | 379 this[_accumulated] = new core.List$(T).from([]); |
| 380 this[_callback] = callback$; | 380 this[_callback] = callback$; |
| 381 super.ChunkedConversionSink(); | 381 super.ChunkedConversionSink(); |
| 382 } | 382 } |
| 383 add(chunk) { | 383 add(chunk) { |
| 384 this[_accumulated].add(chunk); | 384 this[_accumulated][core.$add](chunk); |
| 385 } | 385 } |
| 386 close() { | 386 close() { |
| 387 this[_callback](this[_accumulated]); | 387 this[_callback](this[_accumulated]); |
| 388 } | 388 } |
| 389 } | 389 } |
| 390 return _SimpleCallbackSink; | 390 return _SimpleCallbackSink; |
| 391 }); | 391 }); |
| 392 let _SimpleCallbackSink = _SimpleCallbackSink$(dart.dynamic); | 392 let _SimpleCallbackSink = _SimpleCallbackSink$(dart.dynamic); |
| 393 let _EventSinkAdapter$ = dart.generic(function(T) { | 393 let _EventSinkAdapter$ = dart.generic(function(T) { |
| 394 class _EventSinkAdapter extends core.Object { | 394 class _EventSinkAdapter extends core.Object { |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 731 break checkAscii; | 731 break checkAscii; |
| 732 } | 732 } |
| 733 return string.codeUnits; | 733 return string.codeUnits; |
| 734 } | 734 } |
| 735 return UTF8.encode(string); | 735 return UTF8.encode(string); |
| 736 } | 736 } |
| 737 convert(object) { | 737 convert(object) { |
| 738 let bytes = dart.as(new core.List.from([]), core.List$(core.List$(core.int
))); | 738 let bytes = dart.as(new core.List.from([]), core.List$(core.List$(core.int
))); |
| 739 // Function addChunk: (Uint8List, int, int) → void | 739 // Function addChunk: (Uint8List, int, int) → void |
| 740 function addChunk(chunk, start, end) { | 740 function addChunk(chunk, start, end) { |
| 741 if (dart.notNull(start) > 0 || dart.notNull(end) < dart.notNull(chunk.le
ngth)) { | 741 if (dart.notNull(start) > 0 || dart.notNull(end) < dart.notNull(chunk[co
re.$length])) { |
| 742 let length = dart.notNull(end) - dart.notNull(start); | 742 let length = dart.notNull(end) - dart.notNull(start); |
| 743 chunk = new typed_data.Uint8List.view(chunk.buffer, dart.notNull(chunk
.offsetInBytes) + dart.notNull(start), length); | 743 chunk = new typed_data.Uint8List.view(chunk.buffer, dart.notNull(chunk
.offsetInBytes) + dart.notNull(start), length); |
| 744 } | 744 } |
| 745 bytes.add(chunk); | 745 bytes[core.$add](chunk); |
| 746 } | 746 } |
| 747 _JsonUtf8Stringifier.stringify(object, this[_indent], dart.as(this[_toEnco
dable$], dart.throw_("Unimplemented type (Object) → dynamic")), this[_bufferSize
], addChunk); | 747 _JsonUtf8Stringifier.stringify(object, this[_indent], dart.as(this[_toEnco
dable$], dart.throw_("Unimplemented type (Object) → dynamic")), this[_bufferSize
], addChunk); |
| 748 if (bytes.length == 1) | 748 if (bytes[core.$length] == 1) |
| 749 return bytes.get(0); | 749 return bytes[core.$get](0); |
| 750 let length = 0; | 750 let length = 0; |
| 751 for (let i = 0; dart.notNull(i) < dart.notNull(bytes.length); i = dart.not
Null(i) + 1) { | 751 for (let i = 0; dart.notNull(i) < dart.notNull(bytes[core.$length]); i = d
art.notNull(i) + 1) { |
| 752 length = bytes.get(i).length; | 752 length = bytes[core.$get](i)[core.$length]; |
| 753 } | 753 } |
| 754 let result = new typed_data.Uint8List(length); | 754 let result = new typed_data.Uint8List(length); |
| 755 for (let i = 0, offset = 0; dart.notNull(i) < dart.notNull(bytes.length);
i = dart.notNull(i) + 1) { | 755 for (let i = 0, offset = 0; dart.notNull(i) < dart.notNull(bytes[core.$len
gth]); i = dart.notNull(i) + 1) { |
| 756 let byteList = bytes.get(i); | 756 let byteList = bytes[core.$get](i); |
| 757 let end = dart.notNull(offset) + dart.notNull(byteList.length); | 757 let end = dart.notNull(offset) + dart.notNull(byteList[core.$length]); |
| 758 result.setRange(offset, end, byteList); | 758 result[core.$setRange](offset, end, byteList); |
| 759 offset = end; | 759 offset = end; |
| 760 } | 760 } |
| 761 return result; | 761 return result; |
| 762 } | 762 } |
| 763 startChunkedConversion(sink) { | 763 startChunkedConversion(sink) { |
| 764 let byteSink = null; | 764 let byteSink = null; |
| 765 if (dart.is(sink, ByteConversionSink)) { | 765 if (dart.is(sink, ByteConversionSink)) { |
| 766 byteSink = sink; | 766 byteSink = sink; |
| 767 } else { | 767 } else { |
| 768 byteSink = new ByteConversionSink.from(sink); | 768 byteSink = new ByteConversionSink.from(sink); |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 930 this.writeCharCode(charCode); | 930 this.writeCharCode(charCode); |
| 931 } | 931 } |
| 932 } | 932 } |
| 933 if (offset == 0) { | 933 if (offset == 0) { |
| 934 this.writeString(s); | 934 this.writeString(s); |
| 935 } else if (dart.notNull(offset) < dart.notNull(length)) { | 935 } else if (dart.notNull(offset) < dart.notNull(length)) { |
| 936 this.writeStringSlice(s, offset, length); | 936 this.writeStringSlice(s, offset, length); |
| 937 } | 937 } |
| 938 } | 938 } |
| 939 [_checkCycle](object) { | 939 [_checkCycle](object) { |
| 940 for (let i = 0; dart.notNull(i) < dart.notNull(this[_seen].length); i = da
rt.notNull(i) + 1) { | 940 for (let i = 0; dart.notNull(i) < dart.notNull(this[_seen][core.$length]);
i = dart.notNull(i) + 1) { |
| 941 if (core.identical(object, this[_seen].get(i))) { | 941 if (core.identical(object, this[_seen][core.$get](i))) { |
| 942 throw new JsonCyclicError(object); | 942 throw new JsonCyclicError(object); |
| 943 } | 943 } |
| 944 } | 944 } |
| 945 this[_seen].add(object); | 945 this[_seen][core.$add](object); |
| 946 } | 946 } |
| 947 [_removeSeen](object) { | 947 [_removeSeen](object) { |
| 948 dart.assert(!dart.notNull(this[_seen].isEmpty)); | 948 dart.assert(!dart.notNull(this[_seen][core.$isEmpty])); |
| 949 dart.assert(core.identical(this[_seen].last, object)); | 949 dart.assert(core.identical(this[_seen][core.$last], object)); |
| 950 this[_seen].removeLast(); | 950 this[_seen][core.$removeLast](); |
| 951 } | 951 } |
| 952 writeObject(object) { | 952 writeObject(object) { |
| 953 if (this.writeJsonValue(object)) | 953 if (this.writeJsonValue(object)) |
| 954 return; | 954 return; |
| 955 this[_checkCycle](object); | 955 this[_checkCycle](object); |
| 956 try { | 956 try { |
| 957 let customJson = dart.dinvokef(this[_toEncodable$], object); | 957 let customJson = dart.dinvokef(this[_toEncodable$], object); |
| 958 if (!dart.notNull(this.writeJsonValue(customJson))) { | 958 if (!dart.notNull(this.writeJsonValue(customJson))) { |
| 959 throw new JsonUnsupportedObjectError(object); | 959 throw new JsonUnsupportedObjectError(object); |
| 960 } | 960 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 993 this[_checkCycle](object); | 993 this[_checkCycle](object); |
| 994 this.writeMap(dart.as(object, core.Map$(core.String, core.Object))); | 994 this.writeMap(dart.as(object, core.Map$(core.String, core.Object))); |
| 995 this[_removeSeen](object); | 995 this[_removeSeen](object); |
| 996 return true; | 996 return true; |
| 997 } else { | 997 } else { |
| 998 return false; | 998 return false; |
| 999 } | 999 } |
| 1000 } | 1000 } |
| 1001 writeList(list) { | 1001 writeList(list) { |
| 1002 this.writeString('['); | 1002 this.writeString('['); |
| 1003 if (dart.notNull(list.length) > 0) { | 1003 if (dart.notNull(list[core.$length]) > 0) { |
| 1004 this.writeObject(list.get(0)); | 1004 this.writeObject(list[core.$get](0)); |
| 1005 for (let i = 1; dart.notNull(i) < dart.notNull(list.length); i = dart.no
tNull(i) + 1) { | 1005 for (let i = 1; dart.notNull(i) < dart.notNull(list[core.$length]); i =
dart.notNull(i) + 1) { |
| 1006 this.writeString(','); | 1006 this.writeString(','); |
| 1007 this.writeObject(list.get(i)); | 1007 this.writeObject(list[core.$get](i)); |
| 1008 } | 1008 } |
| 1009 } | 1009 } |
| 1010 this.writeString(']'); | 1010 this.writeString(']'); |
| 1011 } | 1011 } |
| 1012 writeMap(map) { | 1012 writeMap(map) { |
| 1013 this.writeString('{'); | 1013 this.writeString('{'); |
| 1014 let separator = '"'; | 1014 let separator = '"'; |
| 1015 map.forEach(dart.closureWrap(((key, value) => { | 1015 map.forEach(dart.closureWrap(((key, value) => { |
| 1016 this.writeString(separator); | 1016 this.writeString(separator); |
| 1017 separator = ',"'; | 1017 separator = ',"'; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1035 _JsonStringifier.CHAR_n = 110; | 1035 _JsonStringifier.CHAR_n = 110; |
| 1036 _JsonStringifier.CHAR_r = 114; | 1036 _JsonStringifier.CHAR_r = 114; |
| 1037 _JsonStringifier.CHAR_t = 116; | 1037 _JsonStringifier.CHAR_t = 116; |
| 1038 _JsonStringifier.CHAR_u = 117; | 1038 _JsonStringifier.CHAR_u = 117; |
| 1039 let _indentLevel = Symbol('_indentLevel'); | 1039 let _indentLevel = Symbol('_indentLevel'); |
| 1040 class _JsonPrettyPrintMixin extends core.Object { | 1040 class _JsonPrettyPrintMixin extends core.Object { |
| 1041 _JsonPrettyPrintMixin() { | 1041 _JsonPrettyPrintMixin() { |
| 1042 this[_indentLevel] = 0; | 1042 this[_indentLevel] = 0; |
| 1043 } | 1043 } |
| 1044 writeList(list) { | 1044 writeList(list) { |
| 1045 if (list.isEmpty) { | 1045 if (list[core.$isEmpty]) { |
| 1046 this.writeString('[]'); | 1046 this.writeString('[]'); |
| 1047 } else { | 1047 } else { |
| 1048 this.writeString('[\n'); | 1048 this.writeString('[\n'); |
| 1049 this[_indentLevel] = dart.notNull(this[_indentLevel]) + 1; | 1049 this[_indentLevel] = dart.notNull(this[_indentLevel]) + 1; |
| 1050 this.writeIndentation(this[_indentLevel]); | 1050 this.writeIndentation(this[_indentLevel]); |
| 1051 this.writeObject(list.get(0)); | 1051 this.writeObject(list[core.$get](0)); |
| 1052 for (let i = 1; dart.notNull(i) < dart.notNull(list.length); i = dart.no
tNull(i) + 1) { | 1052 for (let i = 1; dart.notNull(i) < dart.notNull(list[core.$length]); i =
dart.notNull(i) + 1) { |
| 1053 this.writeString(',\n'); | 1053 this.writeString(',\n'); |
| 1054 this.writeIndentation(this[_indentLevel]); | 1054 this.writeIndentation(this[_indentLevel]); |
| 1055 this.writeObject(list.get(i)); | 1055 this.writeObject(list[core.$get](i)); |
| 1056 } | 1056 } |
| 1057 this.writeString('\n'); | 1057 this.writeString('\n'); |
| 1058 this[_indentLevel] = dart.notNull(this[_indentLevel]) - 1; | 1058 this[_indentLevel] = dart.notNull(this[_indentLevel]) - 1; |
| 1059 this.writeIndentation(this[_indentLevel]); | 1059 this.writeIndentation(this[_indentLevel]); |
| 1060 this.writeString(']'); | 1060 this.writeString(']'); |
| 1061 } | 1061 } |
| 1062 } | 1062 } |
| 1063 writeMap(map) { | 1063 writeMap(map) { |
| 1064 if (map.isEmpty) { | 1064 if (map.isEmpty) { |
| 1065 this.writeString('{}'); | 1065 this.writeString('{}'); |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1208 } | 1208 } |
| 1209 writeFourByteCharCode(charCode) { | 1209 writeFourByteCharCode(charCode) { |
| 1210 dart.assert(dart.notNull(charCode) <= 1114111); | 1210 dart.assert(dart.notNull(charCode) <= 1114111); |
| 1211 this.writeByte(240 | dart.notNull(charCode) >> 18); | 1211 this.writeByte(240 | dart.notNull(charCode) >> 18); |
| 1212 this.writeByte(128 | dart.notNull(charCode) >> 12 & 63); | 1212 this.writeByte(128 | dart.notNull(charCode) >> 12 & 63); |
| 1213 this.writeByte(128 | dart.notNull(charCode) >> 6 & 63); | 1213 this.writeByte(128 | dart.notNull(charCode) >> 6 & 63); |
| 1214 this.writeByte(128 | dart.notNull(charCode) & 63); | 1214 this.writeByte(128 | dart.notNull(charCode) & 63); |
| 1215 } | 1215 } |
| 1216 writeByte(byte) { | 1216 writeByte(byte) { |
| 1217 dart.assert(dart.notNull(byte) <= 255); | 1217 dart.assert(dart.notNull(byte) <= 255); |
| 1218 if (this.index == this.buffer.length) { | 1218 if (this.index == this.buffer[core.$length]) { |
| 1219 dart.dinvokef(this.addChunk, this.buffer, 0, this.index); | 1219 dart.dinvokef(this.addChunk, this.buffer, 0, this.index); |
| 1220 this.buffer = new typed_data.Uint8List(this.bufferSize); | 1220 this.buffer = new typed_data.Uint8List(this.bufferSize); |
| 1221 this.index = 0; | 1221 this.index = 0; |
| 1222 } | 1222 } |
| 1223 this.buffer.set(((x$) => this.index = dart.notNull(x$) + 1, x$).bind(this)
(this.index), byte); | 1223 this.buffer[core.$set](((x$) => this.index = dart.notNull(x$) + 1, x$).bin
d(this)(this.index), byte); |
| 1224 } | 1224 } |
| 1225 } | 1225 } |
| 1226 class _JsonUtf8StringifierPretty extends dart.mixin(_JsonUtf8Stringifier, _Jso
nPrettyPrintMixin) { | 1226 class _JsonUtf8StringifierPretty extends dart.mixin(_JsonUtf8Stringifier, _Jso
nPrettyPrintMixin) { |
| 1227 _JsonUtf8StringifierPretty(toEncodableFunction, indent, bufferSize, addChunk
) { | 1227 _JsonUtf8StringifierPretty(toEncodableFunction, indent, bufferSize, addChunk
) { |
| 1228 this.indent = indent; | 1228 this.indent = indent; |
| 1229 super._JsonUtf8Stringifier(toEncodableFunction, dart.as(bufferSize, core.i
nt), dart.as(addChunk, core.Function)); | 1229 super._JsonUtf8Stringifier(toEncodableFunction, dart.as(bufferSize, core.i
nt), dart.as(addChunk, core.Function)); |
| 1230 } | 1230 } |
| 1231 writeIndentation(count) { | 1231 writeIndentation(count) { |
| 1232 let indent = this.indent; | 1232 let indent = this.indent; |
| 1233 let indentLength = indent.length; | 1233 let indentLength = indent[core.$length]; |
| 1234 if (indentLength == 1) { | 1234 if (indentLength == 1) { |
| 1235 let char = indent.get(0); | 1235 let char = indent[core.$get](0); |
| 1236 while (dart.notNull(count) > 0) { | 1236 while (dart.notNull(count) > 0) { |
| 1237 this.writeByte(char); | 1237 this.writeByte(char); |
| 1238 count = 1; | 1238 count = 1; |
| 1239 } | 1239 } |
| 1240 return; | 1240 return; |
| 1241 } | 1241 } |
| 1242 while (dart.notNull(count) > 0) { | 1242 while (dart.notNull(count) > 0) { |
| 1243 count = dart.notNull(count) - 1; | 1243 count = dart.notNull(count) - 1; |
| 1244 let end = dart.notNull(this.index) + dart.notNull(indentLength); | 1244 let end = dart.notNull(this.index) + dart.notNull(indentLength); |
| 1245 if (dart.notNull(end) <= dart.notNull(this.buffer.length)) { | 1245 if (dart.notNull(end) <= dart.notNull(this.buffer[core.$length])) { |
| 1246 this.buffer.setRange(this.index, end, indent); | 1246 this.buffer[core.$setRange](this.index, end, indent); |
| 1247 this.index = end; | 1247 this.index = end; |
| 1248 } else { | 1248 } else { |
| 1249 for (let i = 0; dart.notNull(i) < dart.notNull(indentLength); i = dart
.notNull(i) + 1) { | 1249 for (let i = 0; dart.notNull(i) < dart.notNull(indentLength); i = dart
.notNull(i) + 1) { |
| 1250 this.writeByte(indent.get(i)); | 1250 this.writeByte(indent[core.$get](i)); |
| 1251 } | 1251 } |
| 1252 } | 1252 } |
| 1253 } | 1253 } |
| 1254 } | 1254 } |
| 1255 } | 1255 } |
| 1256 let LATIN1 = new Latin1Codec(); | 1256 let LATIN1 = new Latin1Codec(); |
| 1257 let _LATIN1_MASK = 255; | 1257 let _LATIN1_MASK = 255; |
| 1258 class Latin1Codec extends Encoding { | 1258 class Latin1Codec extends Encoding { |
| 1259 Latin1Codec(opts) { | 1259 Latin1Codec(opts) { |
| 1260 let allowInvalid = opts && 'allowInvalid' in opts ? opts.allowInvalid : fa
lse; | 1260 let allowInvalid = opts && 'allowInvalid' in opts ? opts.allowInvalid : fa
lse; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1306 let _addSliceToSink = Symbol('_addSliceToSink'); | 1306 let _addSliceToSink = Symbol('_addSliceToSink'); |
| 1307 class _Latin1DecoderSink extends ByteConversionSinkBase { | 1307 class _Latin1DecoderSink extends ByteConversionSinkBase { |
| 1308 _Latin1DecoderSink(sink$) { | 1308 _Latin1DecoderSink(sink$) { |
| 1309 this[_sink] = sink$; | 1309 this[_sink] = sink$; |
| 1310 super.ByteConversionSinkBase(); | 1310 super.ByteConversionSinkBase(); |
| 1311 } | 1311 } |
| 1312 close() { | 1312 close() { |
| 1313 this[_sink].close(); | 1313 this[_sink].close(); |
| 1314 } | 1314 } |
| 1315 add(source) { | 1315 add(source) { |
| 1316 this.addSlice(source, 0, source.length, false); | 1316 this.addSlice(source, 0, source[core.$length], false); |
| 1317 } | 1317 } |
| 1318 [_addSliceToSink](source, start, end, isLast) { | 1318 [_addSliceToSink](source, start, end, isLast) { |
| 1319 this[_sink].add(new core.String.fromCharCodes(source, start, end)); | 1319 this[_sink].add(new core.String.fromCharCodes(source, start, end)); |
| 1320 if (isLast) | 1320 if (isLast) |
| 1321 this.close(); | 1321 this.close(); |
| 1322 } | 1322 } |
| 1323 addSlice(source, start, end, isLast) { | 1323 addSlice(source, start, end, isLast) { |
| 1324 core.RangeError.checkValidRange(start, end, source.length); | 1324 core.RangeError.checkValidRange(start, end, source[core.$length]); |
| 1325 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { | 1325 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { |
| 1326 let char = source.get(i); | 1326 let char = source[core.$get](i); |
| 1327 if (dart.notNull(char) > dart.notNull(_LATIN1_MASK) || dart.notNull(char
) < 0) { | 1327 if (dart.notNull(char) > dart.notNull(_LATIN1_MASK) || dart.notNull(char
) < 0) { |
| 1328 throw new core.FormatException("Source contains non-Latin-1 characters
."); | 1328 throw new core.FormatException("Source contains non-Latin-1 characters
."); |
| 1329 } | 1329 } |
| 1330 } | 1330 } |
| 1331 if (dart.notNull(start) < dart.notNull(end)) { | 1331 if (dart.notNull(start) < dart.notNull(end)) { |
| 1332 this[_addSliceToSink](source, start, end, isLast); | 1332 this[_addSliceToSink](source, start, end, isLast); |
| 1333 } | 1333 } |
| 1334 if (isLast) { | 1334 if (isLast) { |
| 1335 this.close(); | 1335 this.close(); |
| 1336 } | 1336 } |
| 1337 } | 1337 } |
| 1338 } | 1338 } |
| 1339 class _Latin1AllowInvalidDecoderSink extends _Latin1DecoderSink { | 1339 class _Latin1AllowInvalidDecoderSink extends _Latin1DecoderSink { |
| 1340 _Latin1AllowInvalidDecoderSink(sink) { | 1340 _Latin1AllowInvalidDecoderSink(sink) { |
| 1341 super._Latin1DecoderSink(sink); | 1341 super._Latin1DecoderSink(sink); |
| 1342 } | 1342 } |
| 1343 addSlice(source, start, end, isLast) { | 1343 addSlice(source, start, end, isLast) { |
| 1344 core.RangeError.checkValidRange(start, end, source.length); | 1344 core.RangeError.checkValidRange(start, end, source[core.$length]); |
| 1345 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { | 1345 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { |
| 1346 let char = source.get(i); | 1346 let char = source[core.$get](i); |
| 1347 if (dart.notNull(char) > dart.notNull(_LATIN1_MASK) || dart.notNull(char
) < 0) { | 1347 if (dart.notNull(char) > dart.notNull(_LATIN1_MASK) || dart.notNull(char
) < 0) { |
| 1348 if (dart.notNull(i) > dart.notNull(start)) | 1348 if (dart.notNull(i) > dart.notNull(start)) |
| 1349 this[_addSliceToSink](source, start, i, false); | 1349 this[_addSliceToSink](source, start, i, false); |
| 1350 this[_addSliceToSink](dart.as(/* Unimplemented const */new core.List.f
rom([65533]), core.List$(core.int)), 0, 1, false); | 1350 this[_addSliceToSink](dart.as(/* Unimplemented const */new core.List.f
rom([65533]), core.List$(core.int)), 0, 1, false); |
| 1351 start = dart.notNull(i) + 1; | 1351 start = dart.notNull(i) + 1; |
| 1352 } | 1352 } |
| 1353 } | 1353 } |
| 1354 if (dart.notNull(start) < dart.notNull(end)) { | 1354 if (dart.notNull(start) < dart.notNull(end)) { |
| 1355 this[_addSliceToSink](source, start, end, isLast); | 1355 this[_addSliceToSink](source, start, end, isLast); |
| 1356 } | 1356 } |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1513 o = ""; | 1513 o = ""; |
| 1514 this[_buffer].writeln(o); | 1514 this[_buffer].writeln(o); |
| 1515 if (dart.notNull(this[_buffer].length) > dart.notNull(_StringConversionSin
kAsStringSinkAdapter[_MIN_STRING_SIZE])) | 1515 if (dart.notNull(this[_buffer].length) > dart.notNull(_StringConversionSin
kAsStringSinkAdapter[_MIN_STRING_SIZE])) |
| 1516 this[_flush](); | 1516 this[_flush](); |
| 1517 } | 1517 } |
| 1518 writeAll(objects, separator) { | 1518 writeAll(objects, separator) { |
| 1519 if (separator === void 0) | 1519 if (separator === void 0) |
| 1520 separator = ""; | 1520 separator = ""; |
| 1521 if (this[_buffer].isNotEmpty) | 1521 if (this[_buffer].isNotEmpty) |
| 1522 this[_flush](); | 1522 this[_flush](); |
| 1523 let iterator = objects.iterator; | 1523 let iterator = objects[core.$iterator]; |
| 1524 if (!dart.notNull(iterator.moveNext())) | 1524 if (!dart.notNull(iterator.moveNext())) |
| 1525 return; | 1525 return; |
| 1526 if (separator.isEmpty) { | 1526 if (separator.isEmpty) { |
| 1527 do { | 1527 do { |
| 1528 this[_chunkedSink].add(dart.as(dart.dinvoke(iterator.current, 'toStrin
g'), core.String)); | 1528 this[_chunkedSink].add(dart.as(dart.dinvoke(iterator.current, 'toStrin
g'), core.String)); |
| 1529 } while (iterator.moveNext()); | 1529 } while (iterator.moveNext()); |
| 1530 } else { | 1530 } else { |
| 1531 this[_chunkedSink].add(dart.as(dart.dinvoke(iterator.current, 'toString'
), core.String)); | 1531 this[_chunkedSink].add(dart.as(dart.dinvoke(iterator.current, 'toString'
), core.String)); |
| 1532 while (iterator.moveNext()) { | 1532 while (iterator.moveNext()) { |
| 1533 this.write(separator); | 1533 this.write(separator); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1613 this[_sink] = sink$; | 1613 this[_sink] = sink$; |
| 1614 this[_decoder] = new _Utf8Decoder(stringSink, allowMalformed); | 1614 this[_decoder] = new _Utf8Decoder(stringSink, allowMalformed); |
| 1615 super.ByteConversionSink(); | 1615 super.ByteConversionSink(); |
| 1616 } | 1616 } |
| 1617 close() { | 1617 close() { |
| 1618 this[_decoder].close(); | 1618 this[_decoder].close(); |
| 1619 if (this[_sink] != null) | 1619 if (this[_sink] != null) |
| 1620 this[_sink].close(); | 1620 this[_sink].close(); |
| 1621 } | 1621 } |
| 1622 add(chunk) { | 1622 add(chunk) { |
| 1623 this.addSlice(chunk, 0, chunk.length, false); | 1623 this.addSlice(chunk, 0, chunk[core.$length], false); |
| 1624 } | 1624 } |
| 1625 addSlice(codeUnits, startIndex, endIndex, isLast) { | 1625 addSlice(codeUnits, startIndex, endIndex, isLast) { |
| 1626 this[_decoder].convert(codeUnits, startIndex, endIndex); | 1626 this[_decoder].convert(codeUnits, startIndex, endIndex); |
| 1627 if (isLast) | 1627 if (isLast) |
| 1628 this.close(); | 1628 this.close(); |
| 1629 } | 1629 } |
| 1630 } | 1630 } |
| 1631 class _Utf8ConversionSink extends ByteConversionSink { | 1631 class _Utf8ConversionSink extends ByteConversionSink { |
| 1632 _Utf8ConversionSink(sink, allowMalformed) { | 1632 _Utf8ConversionSink(sink, allowMalformed) { |
| 1633 this[_$](sink, new core.StringBuffer(), allowMalformed); | 1633 this[_$](sink, new core.StringBuffer(), allowMalformed); |
| 1634 } | 1634 } |
| 1635 [_$](chunkedSink, stringBuffer, allowMalformed) { | 1635 [_$](chunkedSink, stringBuffer, allowMalformed) { |
| 1636 this[_chunkedSink] = chunkedSink; | 1636 this[_chunkedSink] = chunkedSink; |
| 1637 this[_decoder] = new _Utf8Decoder(stringBuffer, allowMalformed); | 1637 this[_decoder] = new _Utf8Decoder(stringBuffer, allowMalformed); |
| 1638 this[_buffer] = stringBuffer; | 1638 this[_buffer] = stringBuffer; |
| 1639 super.ByteConversionSink(); | 1639 super.ByteConversionSink(); |
| 1640 } | 1640 } |
| 1641 close() { | 1641 close() { |
| 1642 this[_decoder].close(); | 1642 this[_decoder].close(); |
| 1643 if (this[_buffer].isNotEmpty) { | 1643 if (this[_buffer].isNotEmpty) { |
| 1644 let accumulated = this[_buffer].toString(); | 1644 let accumulated = this[_buffer].toString(); |
| 1645 this[_buffer].clear(); | 1645 this[_buffer].clear(); |
| 1646 this[_chunkedSink].addSlice(accumulated, 0, accumulated.length, true); | 1646 this[_chunkedSink].addSlice(accumulated, 0, accumulated.length, true); |
| 1647 } else { | 1647 } else { |
| 1648 this[_chunkedSink].close(); | 1648 this[_chunkedSink].close(); |
| 1649 } | 1649 } |
| 1650 } | 1650 } |
| 1651 add(chunk) { | 1651 add(chunk) { |
| 1652 this.addSlice(chunk, 0, chunk.length, false); | 1652 this.addSlice(chunk, 0, chunk[core.$length], false); |
| 1653 } | 1653 } |
| 1654 addSlice(chunk, startIndex, endIndex, isLast) { | 1654 addSlice(chunk, startIndex, endIndex, isLast) { |
| 1655 this[_decoder].convert(chunk, startIndex, endIndex); | 1655 this[_decoder].convert(chunk, startIndex, endIndex); |
| 1656 if (this[_buffer].isNotEmpty) { | 1656 if (this[_buffer].isNotEmpty) { |
| 1657 let accumulated = this[_buffer].toString(); | 1657 let accumulated = this[_buffer].toString(); |
| 1658 this[_chunkedSink].addSlice(accumulated, 0, accumulated.length, isLast); | 1658 this[_chunkedSink].addSlice(accumulated, 0, accumulated.length, isLast); |
| 1659 this[_buffer].clear(); | 1659 this[_buffer].clear(); |
| 1660 return; | 1660 return; |
| 1661 } | 1661 } |
| 1662 if (isLast) | 1662 if (isLast) |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1708 return new typed_data.Uint8List(0); | 1708 return new typed_data.Uint8List(0); |
| 1709 let encoder = new _Utf8Encoder.withBufferSize(dart.notNull(length) * 3); | 1709 let encoder = new _Utf8Encoder.withBufferSize(dart.notNull(length) * 3); |
| 1710 let endPosition = encoder._fillBuffer(string, start, end); | 1710 let endPosition = encoder._fillBuffer(string, start, end); |
| 1711 dart.assert(dart.notNull(endPosition) >= dart.notNull(end) - 1); | 1711 dart.assert(dart.notNull(endPosition) >= dart.notNull(end) - 1); |
| 1712 if (endPosition != end) { | 1712 if (endPosition != end) { |
| 1713 let lastCodeUnit = string.codeUnitAt(dart.notNull(end) - 1); | 1713 let lastCodeUnit = string.codeUnitAt(dart.notNull(end) - 1); |
| 1714 dart.assert(_isLeadSurrogate(lastCodeUnit)); | 1714 dart.assert(_isLeadSurrogate(lastCodeUnit)); |
| 1715 let wasCombined = encoder._writeSurrogate(lastCodeUnit, 0); | 1715 let wasCombined = encoder._writeSurrogate(lastCodeUnit, 0); |
| 1716 dart.assert(!dart.notNull(wasCombined)); | 1716 dart.assert(!dart.notNull(wasCombined)); |
| 1717 } | 1717 } |
| 1718 return encoder[_buffer].sublist(0, encoder[_bufferIndex]); | 1718 return encoder[_buffer][core.$sublist](0, encoder[_bufferIndex]); |
| 1719 } | 1719 } |
| 1720 startChunkedConversion(sink) { | 1720 startChunkedConversion(sink) { |
| 1721 if (!dart.is(sink, ByteConversionSink)) { | 1721 if (!dart.is(sink, ByteConversionSink)) { |
| 1722 sink = new ByteConversionSink.from(sink); | 1722 sink = new ByteConversionSink.from(sink); |
| 1723 } | 1723 } |
| 1724 return new _Utf8EncoderSink(dart.as(sink, ByteConversionSink)); | 1724 return new _Utf8EncoderSink(dart.as(sink, ByteConversionSink)); |
| 1725 } | 1725 } |
| 1726 bind(stream) { | 1726 bind(stream) { |
| 1727 return dart.as(super.bind(stream), async.Stream$(core.List$(core.int))); | 1727 return dart.as(super.bind(stream), async.Stream$(core.List$(core.int))); |
| 1728 } | 1728 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1741 this[_bufferIndex] = 0; | 1741 this[_bufferIndex] = 0; |
| 1742 } | 1742 } |
| 1743 static [_createBuffer](size) { | 1743 static [_createBuffer](size) { |
| 1744 return new typed_data.Uint8List(size); | 1744 return new typed_data.Uint8List(size); |
| 1745 } | 1745 } |
| 1746 [_writeSurrogate](leadingSurrogate, nextCodeUnit) { | 1746 [_writeSurrogate](leadingSurrogate, nextCodeUnit) { |
| 1747 if (_isTailSurrogate(nextCodeUnit)) { | 1747 if (_isTailSurrogate(nextCodeUnit)) { |
| 1748 let rune = _combineSurrogatePair(leadingSurrogate, nextCodeUnit); | 1748 let rune = _combineSurrogatePair(leadingSurrogate, nextCodeUnit); |
| 1749 dart.assert(dart.notNull(rune) > dart.notNull(_THREE_BYTE_LIMIT)); | 1749 dart.assert(dart.notNull(rune) > dart.notNull(_THREE_BYTE_LIMIT)); |
| 1750 dart.assert(dart.notNull(rune) <= dart.notNull(_FOUR_BYTE_LIMIT)); | 1750 dart.assert(dart.notNull(rune) <= dart.notNull(_FOUR_BYTE_LIMIT)); |
| 1751 this[_buffer].set(((x$) => this[_bufferIndex] = dart.notNull(x$) + 1, x$
).bind(this)(this[_bufferIndex]), 240 | dart.notNull(rune) >> 18); | 1751 this[_buffer][core.$set](((x$) => this[_bufferIndex] = dart.notNull(x$)
+ 1, x$).bind(this)(this[_bufferIndex]), 240 | dart.notNull(rune) >> 18); |
| 1752 this[_buffer].set(((x$) => this[_bufferIndex] = dart.notNull(x$) + 1, x$
).bind(this)(this[_bufferIndex]), 128 | dart.notNull(rune) >> 12 & 63); | 1752 this[_buffer][core.$set](((x$) => this[_bufferIndex] = dart.notNull(x$)
+ 1, x$).bind(this)(this[_bufferIndex]), 128 | dart.notNull(rune) >> 12 & 63); |
| 1753 this[_buffer].set(((x$) => this[_bufferIndex] = dart.notNull(x$) + 1, x$
).bind(this)(this[_bufferIndex]), 128 | dart.notNull(rune) >> 6 & 63); | 1753 this[_buffer][core.$set](((x$) => this[_bufferIndex] = dart.notNull(x$)
+ 1, x$).bind(this)(this[_bufferIndex]), 128 | dart.notNull(rune) >> 6 & 63); |
| 1754 this[_buffer].set(((x$) => this[_bufferIndex] = dart.notNull(x$) + 1, x$
).bind(this)(this[_bufferIndex]), 128 | dart.notNull(rune) & 63); | 1754 this[_buffer][core.$set](((x$) => this[_bufferIndex] = dart.notNull(x$)
+ 1, x$).bind(this)(this[_bufferIndex]), 128 | dart.notNull(rune) & 63); |
| 1755 return true; | 1755 return true; |
| 1756 } else { | 1756 } else { |
| 1757 this[_buffer].set(((x$) => this[_bufferIndex] = dart.notNull(x$) + 1, x$
).bind(this)(this[_bufferIndex]), 224 | dart.notNull(leadingSurrogate) >> 12); | 1757 this[_buffer][core.$set](((x$) => this[_bufferIndex] = dart.notNull(x$)
+ 1, x$).bind(this)(this[_bufferIndex]), 224 | dart.notNull(leadingSurrogate) >>
12); |
| 1758 this[_buffer].set(((x$) => this[_bufferIndex] = dart.notNull(x$) + 1, x$
).bind(this)(this[_bufferIndex]), 128 | dart.notNull(leadingSurrogate) >> 6 & 63
); | 1758 this[_buffer][core.$set](((x$) => this[_bufferIndex] = dart.notNull(x$)
+ 1, x$).bind(this)(this[_bufferIndex]), 128 | dart.notNull(leadingSurrogate) >>
6 & 63); |
| 1759 this[_buffer].set(((x$) => this[_bufferIndex] = dart.notNull(x$) + 1, x$
).bind(this)(this[_bufferIndex]), 128 | dart.notNull(leadingSurrogate) & 63); | 1759 this[_buffer][core.$set](((x$) => this[_bufferIndex] = dart.notNull(x$)
+ 1, x$).bind(this)(this[_bufferIndex]), 128 | dart.notNull(leadingSurrogate) &
63); |
| 1760 return false; | 1760 return false; |
| 1761 } | 1761 } |
| 1762 } | 1762 } |
| 1763 [_fillBuffer](str, start, end) { | 1763 [_fillBuffer](str, start, end) { |
| 1764 if (start != end && dart.notNull(_isLeadSurrogate(str.codeUnitAt(dart.notN
ull(end) - 1)))) { | 1764 if (start != end && dart.notNull(_isLeadSurrogate(str.codeUnitAt(dart.notN
ull(end) - 1)))) { |
| 1765 end = dart.notNull(end) - 1; | 1765 end = dart.notNull(end) - 1; |
| 1766 } | 1766 } |
| 1767 let stringIndex = null; | 1767 let stringIndex = null; |
| 1768 for (stringIndex = start; dart.notNull(stringIndex) < dart.notNull(end); s
tringIndex = dart.notNull(stringIndex) + 1) { | 1768 for (stringIndex = start; dart.notNull(stringIndex) < dart.notNull(end); s
tringIndex = dart.notNull(stringIndex) + 1) { |
| 1769 let codeUnit = str.codeUnitAt(stringIndex); | 1769 let codeUnit = str.codeUnitAt(stringIndex); |
| 1770 if (dart.notNull(codeUnit) <= dart.notNull(_ONE_BYTE_LIMIT)) { | 1770 if (dart.notNull(codeUnit) <= dart.notNull(_ONE_BYTE_LIMIT)) { |
| 1771 if (dart.notNull(this[_bufferIndex]) >= dart.notNull(this[_buffer].len
gth)) | 1771 if (dart.notNull(this[_bufferIndex]) >= dart.notNull(this[_buffer][cor
e.$length])) |
| 1772 break; | 1772 break; |
| 1773 this[_buffer].set(((x$) => this[_bufferIndex] = dart.notNull(x$) + 1,
x$).bind(this)(this[_bufferIndex]), codeUnit); | 1773 this[_buffer][core.$set](((x$) => this[_bufferIndex] = dart.notNull(x$
) + 1, x$).bind(this)(this[_bufferIndex]), codeUnit); |
| 1774 } else if (_isLeadSurrogate(codeUnit)) { | 1774 } else if (_isLeadSurrogate(codeUnit)) { |
| 1775 if (dart.notNull(this[_bufferIndex]) + 3 >= dart.notNull(this[_buffer]
.length)) | 1775 if (dart.notNull(this[_bufferIndex]) + 3 >= dart.notNull(this[_buffer]
[core.$length])) |
| 1776 break; | 1776 break; |
| 1777 let nextCodeUnit = str.codeUnitAt(dart.notNull(stringIndex) + 1); | 1777 let nextCodeUnit = str.codeUnitAt(dart.notNull(stringIndex) + 1); |
| 1778 let wasCombined = this[_writeSurrogate](codeUnit, nextCodeUnit); | 1778 let wasCombined = this[_writeSurrogate](codeUnit, nextCodeUnit); |
| 1779 if (wasCombined) | 1779 if (wasCombined) |
| 1780 stringIndex = dart.notNull(stringIndex) + 1; | 1780 stringIndex = dart.notNull(stringIndex) + 1; |
| 1781 } else { | 1781 } else { |
| 1782 let rune = codeUnit; | 1782 let rune = codeUnit; |
| 1783 if (dart.notNull(rune) <= dart.notNull(_TWO_BYTE_LIMIT)) { | 1783 if (dart.notNull(rune) <= dart.notNull(_TWO_BYTE_LIMIT)) { |
| 1784 if (dart.notNull(this[_bufferIndex]) + 1 >= dart.notNull(this[_buffe
r].length)) | 1784 if (dart.notNull(this[_bufferIndex]) + 1 >= dart.notNull(this[_buffe
r][core.$length])) |
| 1785 break; | 1785 break; |
| 1786 this[_buffer].set(((x$) => this[_bufferIndex] = dart.notNull(x$) + 1
, x$).bind(this)(this[_bufferIndex]), 192 | dart.notNull(rune) >> 6); | 1786 this[_buffer][core.$set](((x$) => this[_bufferIndex] = dart.notNull(
x$) + 1, x$).bind(this)(this[_bufferIndex]), 192 | dart.notNull(rune) >> 6); |
| 1787 this[_buffer].set(((x$) => this[_bufferIndex] = dart.notNull(x$) + 1
, x$).bind(this)(this[_bufferIndex]), 128 | dart.notNull(rune) & 63); | 1787 this[_buffer][core.$set](((x$) => this[_bufferIndex] = dart.notNull(
x$) + 1, x$).bind(this)(this[_bufferIndex]), 128 | dart.notNull(rune) & 63); |
| 1788 } else { | 1788 } else { |
| 1789 dart.assert(dart.notNull(rune) <= dart.notNull(_THREE_BYTE_LIMIT)); | 1789 dart.assert(dart.notNull(rune) <= dart.notNull(_THREE_BYTE_LIMIT)); |
| 1790 if (dart.notNull(this[_bufferIndex]) + 2 >= dart.notNull(this[_buffe
r].length)) | 1790 if (dart.notNull(this[_bufferIndex]) + 2 >= dart.notNull(this[_buffe
r][core.$length])) |
| 1791 break; | 1791 break; |
| 1792 this[_buffer].set(((x$) => this[_bufferIndex] = dart.notNull(x$) + 1
, x$).bind(this)(this[_bufferIndex]), 224 | dart.notNull(rune) >> 12); | 1792 this[_buffer][core.$set](((x$) => this[_bufferIndex] = dart.notNull(
x$) + 1, x$).bind(this)(this[_bufferIndex]), 224 | dart.notNull(rune) >> 12); |
| 1793 this[_buffer].set(((x$) => this[_bufferIndex] = dart.notNull(x$) + 1
, x$).bind(this)(this[_bufferIndex]), 128 | dart.notNull(rune) >> 6 & 63); | 1793 this[_buffer][core.$set](((x$) => this[_bufferIndex] = dart.notNull(
x$) + 1, x$).bind(this)(this[_bufferIndex]), 128 | dart.notNull(rune) >> 6 & 63)
; |
| 1794 this[_buffer].set(((x$) => this[_bufferIndex] = dart.notNull(x$) + 1
, x$).bind(this)(this[_bufferIndex]), 128 | dart.notNull(rune) & 63); | 1794 this[_buffer][core.$set](((x$) => this[_bufferIndex] = dart.notNull(
x$) + 1, x$).bind(this)(this[_bufferIndex]), 128 | dart.notNull(rune) & 63); |
| 1795 } | 1795 } |
| 1796 } | 1796 } |
| 1797 } | 1797 } |
| 1798 return stringIndex; | 1798 return stringIndex; |
| 1799 } | 1799 } |
| 1800 } | 1800 } |
| 1801 dart.defineNamedConstructor(_Utf8Encoder, 'withBufferSize'); | 1801 dart.defineNamedConstructor(_Utf8Encoder, 'withBufferSize'); |
| 1802 _Utf8Encoder._DEFAULT_BYTE_BUFFER_SIZE = 1024; | 1802 _Utf8Encoder._DEFAULT_BYTE_BUFFER_SIZE = 1024; |
| 1803 class _Utf8EncoderSink extends dart.mixin(_Utf8Encoder, StringConversionSinkMi
xin) { | 1803 class _Utf8EncoderSink extends dart.mixin(_Utf8Encoder, StringConversionSinkMi
xin) { |
| 1804 _Utf8EncoderSink(sink$) { | 1804 _Utf8EncoderSink(sink$) { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1827 let wasCombined = this[_writeSurrogate](this[_carry], nextCodeUnit); | 1827 let wasCombined = this[_writeSurrogate](this[_carry], nextCodeUnit); |
| 1828 dart.assert(!dart.notNull(wasCombined) || start != end); | 1828 dart.assert(!dart.notNull(wasCombined) || start != end); |
| 1829 if (wasCombined) | 1829 if (wasCombined) |
| 1830 start = dart.notNull(start) + 1; | 1830 start = dart.notNull(start) + 1; |
| 1831 this[_carry] = 0; | 1831 this[_carry] = 0; |
| 1832 } | 1832 } |
| 1833 do { | 1833 do { |
| 1834 start = this[_fillBuffer](str, start, end); | 1834 start = this[_fillBuffer](str, start, end); |
| 1835 let isLastSlice = dart.notNull(isLast) && start == end; | 1835 let isLastSlice = dart.notNull(isLast) && start == end; |
| 1836 if (start == dart.notNull(end) - 1 && dart.notNull(_isLeadSurrogate(str.
codeUnitAt(start)))) { | 1836 if (start == dart.notNull(end) - 1 && dart.notNull(_isLeadSurrogate(str.
codeUnitAt(start)))) { |
| 1837 if (dart.notNull(isLast) && dart.notNull(this[_bufferIndex]) < dart.no
tNull(this[_buffer].length) - 3) { | 1837 if (dart.notNull(isLast) && dart.notNull(this[_bufferIndex]) < dart.no
tNull(this[_buffer][core.$length]) - 3) { |
| 1838 let hasBeenCombined = this[_writeSurrogate](str.codeUnitAt(start), 0
); | 1838 let hasBeenCombined = this[_writeSurrogate](str.codeUnitAt(start), 0
); |
| 1839 dart.assert(!dart.notNull(hasBeenCombined)); | 1839 dart.assert(!dart.notNull(hasBeenCombined)); |
| 1840 } else { | 1840 } else { |
| 1841 this[_carry] = str.codeUnitAt(start); | 1841 this[_carry] = str.codeUnitAt(start); |
| 1842 } | 1842 } |
| 1843 start = dart.notNull(start) + 1; | 1843 start = dart.notNull(start) + 1; |
| 1844 } | 1844 } |
| 1845 this[_sink].addSlice(this[_buffer], 0, this[_bufferIndex], isLastSlice); | 1845 this[_sink].addSlice(this[_buffer], 0, this[_bufferIndex], isLastSlice); |
| 1846 this[_bufferIndex] = 0; | 1846 this[_bufferIndex] = 0; |
| 1847 } while (dart.notNull(start) < dart.notNull(end)); | 1847 } while (dart.notNull(start) < dart.notNull(end)); |
| 1848 if (isLast) | 1848 if (isLast) |
| 1849 this.close(); | 1849 this.close(); |
| 1850 } | 1850 } |
| 1851 } | 1851 } |
| 1852 class Utf8Decoder extends Converter$(core.List$(core.int), core.String) { | 1852 class Utf8Decoder extends Converter$(core.List$(core.int), core.String) { |
| 1853 Utf8Decoder(opts) { | 1853 Utf8Decoder(opts) { |
| 1854 let allowMalformed = opts && 'allowMalformed' in opts ? opts.allowMalforme
d : false; | 1854 let allowMalformed = opts && 'allowMalformed' in opts ? opts.allowMalforme
d : false; |
| 1855 this[_allowMalformed] = allowMalformed; | 1855 this[_allowMalformed] = allowMalformed; |
| 1856 super.Converter(); | 1856 super.Converter(); |
| 1857 } | 1857 } |
| 1858 convert(codeUnits, start, end) { | 1858 convert(codeUnits, start, end) { |
| 1859 if (start === void 0) | 1859 if (start === void 0) |
| 1860 start = 0; | 1860 start = 0; |
| 1861 if (end === void 0) | 1861 if (end === void 0) |
| 1862 end = null; | 1862 end = null; |
| 1863 let length = codeUnits.length; | 1863 let length = codeUnits[core.$length]; |
| 1864 core.RangeError.checkValidRange(start, end, length); | 1864 core.RangeError.checkValidRange(start, end, length); |
| 1865 if (end == null) | 1865 if (end == null) |
| 1866 end = length; | 1866 end = length; |
| 1867 let buffer = new core.StringBuffer(); | 1867 let buffer = new core.StringBuffer(); |
| 1868 let decoder = new _Utf8Decoder(buffer, this[_allowMalformed]); | 1868 let decoder = new _Utf8Decoder(buffer, this[_allowMalformed]); |
| 1869 decoder.convert(codeUnits, start, end); | 1869 decoder.convert(codeUnits, start, end); |
| 1870 decoder.close(); | 1870 decoder.close(); |
| 1871 return buffer.toString(); | 1871 return buffer.toString(); |
| 1872 } | 1872 } |
| 1873 startChunkedConversion(sink) { | 1873 startChunkedConversion(sink) { |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1968 } | 1968 } |
| 1969 let i = startIndex; | 1969 let i = startIndex; |
| 1970 loop: | 1970 loop: |
| 1971 while (true) { | 1971 while (true) { |
| 1972 multibyte: | 1972 multibyte: |
| 1973 if (dart.notNull(expectedUnits) > 0) { | 1973 if (dart.notNull(expectedUnits) > 0) { |
| 1974 do { | 1974 do { |
| 1975 if (i == endIndex) { | 1975 if (i == endIndex) { |
| 1976 break loop; | 1976 break loop; |
| 1977 } | 1977 } |
| 1978 let unit = codeUnits.get(i); | 1978 let unit = codeUnits[core.$get](i); |
| 1979 if ((dart.notNull(unit) & 192) != 128) { | 1979 if ((dart.notNull(unit) & 192) != 128) { |
| 1980 expectedUnits = 0; | 1980 expectedUnits = 0; |
| 1981 if (!dart.notNull(this[_allowMalformed])) { | 1981 if (!dart.notNull(this[_allowMalformed])) { |
| 1982 throw new core.FormatException(`Bad UTF-8 encoding 0x${unit.
toRadixString(16)}`); | 1982 throw new core.FormatException(`Bad UTF-8 encoding 0x${unit.
toRadixString(16)}`); |
| 1983 } | 1983 } |
| 1984 this[_isFirstCharacter] = false; | 1984 this[_isFirstCharacter] = false; |
| 1985 this[_stringSink].writeCharCode(UNICODE_REPLACEMENT_CHARACTER_
RUNE); | 1985 this[_stringSink].writeCharCode(UNICODE_REPLACEMENT_CHARACTER_
RUNE); |
| 1986 break multibyte; | 1986 break multibyte; |
| 1987 } else { | 1987 } else { |
| 1988 value = dart.notNull(value) << 6 | dart.notNull(unit) & 63; | 1988 value = dart.notNull(value) << 6 | dart.notNull(unit) & 63; |
| 1989 expectedUnits = dart.notNull(expectedUnits) - 1; | 1989 expectedUnits = dart.notNull(expectedUnits) - 1; |
| 1990 i = dart.notNull(i) + 1; | 1990 i = dart.notNull(i) + 1; |
| 1991 } | 1991 } |
| 1992 } while (dart.notNull(expectedUnits) > 0); | 1992 } while (dart.notNull(expectedUnits) > 0); |
| 1993 if (dart.notNull(value) <= dart.notNull(_Utf8Decoder[_LIMITS].get(
dart.notNull(extraUnits) - 1))) { | 1993 if (dart.notNull(value) <= dart.notNull(_Utf8Decoder[_LIMITS][core
.$get](dart.notNull(extraUnits) - 1))) { |
| 1994 if (!dart.notNull(this[_allowMalformed])) { | 1994 if (!dart.notNull(this[_allowMalformed])) { |
| 1995 throw new core.FormatException(`Overlong encoding of 0x${value
.toRadixString(16)}`); | 1995 throw new core.FormatException(`Overlong encoding of 0x${value
.toRadixString(16)}`); |
| 1996 } | 1996 } |
| 1997 expectedUnits = extraUnits = 0; | 1997 expectedUnits = extraUnits = 0; |
| 1998 value = UNICODE_REPLACEMENT_CHARACTER_RUNE; | 1998 value = UNICODE_REPLACEMENT_CHARACTER_RUNE; |
| 1999 } | 1999 } |
| 2000 if (dart.notNull(value) > dart.notNull(_FOUR_BYTE_LIMIT)) { | 2000 if (dart.notNull(value) > dart.notNull(_FOUR_BYTE_LIMIT)) { |
| 2001 if (!dart.notNull(this[_allowMalformed])) { | 2001 if (!dart.notNull(this[_allowMalformed])) { |
| 2002 throw new core.FormatException("Character outside valid Unicod
e range: " + `0x${value.toRadixString(16)}`); | 2002 throw new core.FormatException("Character outside valid Unicod
e range: " + `0x${value.toRadixString(16)}`); |
| 2003 } | 2003 } |
| 2004 value = UNICODE_REPLACEMENT_CHARACTER_RUNE; | 2004 value = UNICODE_REPLACEMENT_CHARACTER_RUNE; |
| 2005 } | 2005 } |
| 2006 if (!dart.notNull(this[_isFirstCharacter]) || value != UNICODE_BOM
_CHARACTER_RUNE) { | 2006 if (!dart.notNull(this[_isFirstCharacter]) || value != UNICODE_BOM
_CHARACTER_RUNE) { |
| 2007 this[_stringSink].writeCharCode(value); | 2007 this[_stringSink].writeCharCode(value); |
| 2008 } | 2008 } |
| 2009 this[_isFirstCharacter] = false; | 2009 this[_isFirstCharacter] = false; |
| 2010 } | 2010 } |
| 2011 while (dart.notNull(i) < dart.notNull(endIndex)) { | 2011 while (dart.notNull(i) < dart.notNull(endIndex)) { |
| 2012 let oneBytes = scanOneByteCharacters(codeUnits, i); | 2012 let oneBytes = scanOneByteCharacters(codeUnits, i); |
| 2013 if (dart.notNull(oneBytes) > 0) { | 2013 if (dart.notNull(oneBytes) > 0) { |
| 2014 this[_isFirstCharacter] = false; | 2014 this[_isFirstCharacter] = false; |
| 2015 addSingleBytes(i, dart.notNull(i) + dart.notNull(oneBytes)); | 2015 addSingleBytes(i, dart.notNull(i) + dart.notNull(oneBytes)); |
| 2016 i = oneBytes; | 2016 i = oneBytes; |
| 2017 if (i == endIndex) | 2017 if (i == endIndex) |
| 2018 break; | 2018 break; |
| 2019 } | 2019 } |
| 2020 let unit = codeUnits.get(((x$) => i = dart.notNull(x$) + 1, x$)(i)); | 2020 let unit = codeUnits[core.$get](((x$) => i = dart.notNull(x$) + 1, x
$)(i)); |
| 2021 if (dart.notNull(unit) < 0) { | 2021 if (dart.notNull(unit) < 0) { |
| 2022 if (!dart.notNull(this[_allowMalformed])) { | 2022 if (!dart.notNull(this[_allowMalformed])) { |
| 2023 throw new core.FormatException(`Negative UTF-8 code unit: -0x${(
-dart.notNull(unit)).toRadixString(16)}`); | 2023 throw new core.FormatException(`Negative UTF-8 code unit: -0x${(
-dart.notNull(unit)).toRadixString(16)}`); |
| 2024 } | 2024 } |
| 2025 this[_stringSink].writeCharCode(UNICODE_REPLACEMENT_CHARACTER_RUNE
); | 2025 this[_stringSink].writeCharCode(UNICODE_REPLACEMENT_CHARACTER_RUNE
); |
| 2026 } else { | 2026 } else { |
| 2027 dart.assert(dart.notNull(unit) > dart.notNull(_ONE_BYTE_LIMIT)); | 2027 dart.assert(dart.notNull(unit) > dart.notNull(_ONE_BYTE_LIMIT)); |
| 2028 if ((dart.notNull(unit) & 224) == 192) { | 2028 if ((dart.notNull(unit) & 224) == 192) { |
| 2029 value = dart.notNull(unit) & 31; | 2029 value = dart.notNull(unit) & 31; |
| 2030 expectedUnits = extraUnits = 1; | 2030 expectedUnits = extraUnits = 1; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2072 if (Object.getPrototypeOf(e) === Array.prototype) { | 2072 if (Object.getPrototypeOf(e) === Array.prototype) { |
| 2073 for (let i = 0; dart.notNull(i) < e.length; i = dart.notNull(i) + 1) { | 2073 for (let i = 0; dart.notNull(i) < e.length; i = dart.notNull(i) + 1) { |
| 2074 let item = e[i]; | 2074 let item = e[i]; |
| 2075 e[i] = dart.dinvokef(reviver, i, walk(item)); | 2075 e[i] = dart.dinvokef(reviver, i, walk(item)); |
| 2076 } | 2076 } |
| 2077 return e; | 2077 return e; |
| 2078 } | 2078 } |
| 2079 let map = new _JsonMap(e); | 2079 let map = new _JsonMap(e); |
| 2080 let processed = map[_processed]; | 2080 let processed = map[_processed]; |
| 2081 let keys = map._computeKeys(); | 2081 let keys = map._computeKeys(); |
| 2082 for (let i = 0; dart.notNull(i) < dart.notNull(keys.length); i = dart.notN
ull(i) + 1) { | 2082 for (let i = 0; dart.notNull(i) < dart.notNull(keys[core.$length]); i = da
rt.notNull(i) + 1) { |
| 2083 let key = keys.get(i); | 2083 let key = keys[core.$get](i); |
| 2084 let revived = dart.dinvokef(reviver, key, walk(e[key])); | 2084 let revived = dart.dinvokef(reviver, key, walk(e[key])); |
| 2085 processed[key] = revived; | 2085 processed[key] = revived; |
| 2086 } | 2086 } |
| 2087 map[_original] = processed; | 2087 map[_original] = processed; |
| 2088 return map; | 2088 return map; |
| 2089 } | 2089 } |
| 2090 return dart.dinvokef(reviver, null, walk(json)); | 2090 return dart.dinvokef(reviver, null, walk(json)); |
| 2091 } | 2091 } |
| 2092 // Function _convertJsonToDartLazy: (dynamic) → dynamic | 2092 // Function _convertJsonToDartLazy: (dynamic) → dynamic |
| 2093 function _convertJsonToDartLazy(object) { | 2093 function _convertJsonToDartLazy(object) { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2129 } else if (!(typeof key == 'string')) { | 2129 } else if (!(typeof key == 'string')) { |
| 2130 return null; | 2130 return null; |
| 2131 } else { | 2131 } else { |
| 2132 let result = _JsonMap[_getProperty](this[_processed], dart.as(key, core.
String)); | 2132 let result = _JsonMap[_getProperty](this[_processed], dart.as(key, core.
String)); |
| 2133 if (_JsonMap[_isUnprocessed](result)) | 2133 if (_JsonMap[_isUnprocessed](result)) |
| 2134 result = this[_process](dart.as(key, core.String)); | 2134 result = this[_process](dart.as(key, core.String)); |
| 2135 return result; | 2135 return result; |
| 2136 } | 2136 } |
| 2137 } | 2137 } |
| 2138 get length() { | 2138 get length() { |
| 2139 return this[_isUpgraded] ? this[_upgradedMap].length : this[_computeKeys](
).length; | 2139 return this[_isUpgraded] ? this[_upgradedMap].length : this[_computeKeys](
)[core.$length]; |
| 2140 } | 2140 } |
| 2141 get isEmpty() { | 2141 get isEmpty() { |
| 2142 return this.length == 0; | 2142 return this.length == 0; |
| 2143 } | 2143 } |
| 2144 get isNotEmpty() { | 2144 get isNotEmpty() { |
| 2145 return dart.notNull(this.length) > 0; | 2145 return dart.notNull(this.length) > 0; |
| 2146 } | 2146 } |
| 2147 get keys() { | 2147 get keys() { |
| 2148 if (this[_isUpgraded]) | 2148 if (this[_isUpgraded]) |
| 2149 return this[_upgradedMap].keys; | 2149 return this[_upgradedMap].keys; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 2170 } | 2170 } |
| 2171 addAll(other) { | 2171 addAll(other) { |
| 2172 other.forEach(((key, value) => { | 2172 other.forEach(((key, value) => { |
| 2173 this.set(key, value); | 2173 this.set(key, value); |
| 2174 }).bind(this)); | 2174 }).bind(this)); |
| 2175 } | 2175 } |
| 2176 containsValue(value) { | 2176 containsValue(value) { |
| 2177 if (this[_isUpgraded]) | 2177 if (this[_isUpgraded]) |
| 2178 return this[_upgradedMap].containsValue(value); | 2178 return this[_upgradedMap].containsValue(value); |
| 2179 let keys = this[_computeKeys](); | 2179 let keys = this[_computeKeys](); |
| 2180 for (let i = 0; dart.notNull(i) < dart.notNull(keys.length); i = dart.notN
ull(i) + 1) { | 2180 for (let i = 0; dart.notNull(i) < dart.notNull(keys[core.$length]); i = da
rt.notNull(i) + 1) { |
| 2181 let key = keys.get(i); | 2181 let key = keys[core.$get](i); |
| 2182 if (dart.equals(this.get(key), value)) | 2182 if (dart.equals(this.get(key), value)) |
| 2183 return true; | 2183 return true; |
| 2184 } | 2184 } |
| 2185 return false; | 2185 return false; |
| 2186 } | 2186 } |
| 2187 containsKey(key) { | 2187 containsKey(key) { |
| 2188 if (this[_isUpgraded]) | 2188 if (this[_isUpgraded]) |
| 2189 return this[_upgradedMap].containsKey(key); | 2189 return this[_upgradedMap].containsKey(key); |
| 2190 if (!(typeof key == 'string')) | 2190 if (!(typeof key == 'string')) |
| 2191 return false; | 2191 return false; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 2211 dart.dinvoke(this[_data], 'clear'); | 2211 dart.dinvoke(this[_data], 'clear'); |
| 2212 } | 2212 } |
| 2213 this[_original] = this[_processed] = null; | 2213 this[_original] = this[_processed] = null; |
| 2214 this[_data] = dart.map(); | 2214 this[_data] = dart.map(); |
| 2215 } | 2215 } |
| 2216 } | 2216 } |
| 2217 forEach(f) { | 2217 forEach(f) { |
| 2218 if (this[_isUpgraded]) | 2218 if (this[_isUpgraded]) |
| 2219 return this[_upgradedMap].forEach(f); | 2219 return this[_upgradedMap].forEach(f); |
| 2220 let keys = this[_computeKeys](); | 2220 let keys = this[_computeKeys](); |
| 2221 for (let i = 0; dart.notNull(i) < dart.notNull(keys.length); i = dart.notN
ull(i) + 1) { | 2221 for (let i = 0; dart.notNull(i) < dart.notNull(keys[core.$length]); i = da
rt.notNull(i) + 1) { |
| 2222 let key = keys.get(i); | 2222 let key = keys[core.$get](i); |
| 2223 let value = _JsonMap[_getProperty](this[_processed], key); | 2223 let value = _JsonMap[_getProperty](this[_processed], key); |
| 2224 if (_JsonMap[_isUnprocessed](value)) { | 2224 if (_JsonMap[_isUnprocessed](value)) { |
| 2225 value = _convertJsonToDartLazy(_JsonMap[_getProperty](this[_original],
key)); | 2225 value = _convertJsonToDartLazy(_JsonMap[_getProperty](this[_original],
key)); |
| 2226 _JsonMap[_setProperty](this[_processed], key, value); | 2226 _JsonMap[_setProperty](this[_processed], key, value); |
| 2227 } | 2227 } |
| 2228 dart.dinvokef(f, key, value); | 2228 dart.dinvokef(f, key, value); |
| 2229 if (!dart.notNull(core.identical(keys, this[_data]))) { | 2229 if (!dart.notNull(core.identical(keys, this[_data]))) { |
| 2230 throw new core.ConcurrentModificationError(this); | 2230 throw new core.ConcurrentModificationError(this); |
| 2231 } | 2231 } |
| 2232 } | 2232 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 2247 if (keys == null) { | 2247 if (keys == null) { |
| 2248 keys = this[_data] = _JsonMap[_getPropertyNames](this[_original]); | 2248 keys = this[_data] = _JsonMap[_getPropertyNames](this[_original]); |
| 2249 } | 2249 } |
| 2250 return dart.as(keys, core.List$(core.String)); | 2250 return dart.as(keys, core.List$(core.String)); |
| 2251 } | 2251 } |
| 2252 [_upgrade]() { | 2252 [_upgrade]() { |
| 2253 if (this[_isUpgraded]) | 2253 if (this[_isUpgraded]) |
| 2254 return this[_upgradedMap]; | 2254 return this[_upgradedMap]; |
| 2255 let result = dart.map(); | 2255 let result = dart.map(); |
| 2256 let keys = this[_computeKeys](); | 2256 let keys = this[_computeKeys](); |
| 2257 for (let i = 0; dart.notNull(i) < dart.notNull(keys.length); i = dart.notN
ull(i) + 1) { | 2257 for (let i = 0; dart.notNull(i) < dart.notNull(keys[core.$length]); i = da
rt.notNull(i) + 1) { |
| 2258 let key = keys.get(i); | 2258 let key = keys[core.$get](i); |
| 2259 result.set(key, this.get(key)); | 2259 result.set(key, this.get(key)); |
| 2260 } | 2260 } |
| 2261 if (keys.isEmpty) { | 2261 if (keys[core.$isEmpty]) { |
| 2262 keys.add(null); | 2262 keys[core.$add](null); |
| 2263 } else { | 2263 } else { |
| 2264 keys.clear(); | 2264 keys[core.$clear](); |
| 2265 } | 2265 } |
| 2266 this[_original] = this[_processed] = null; | 2266 this[_original] = this[_processed] = null; |
| 2267 this[_data] = result; | 2267 this[_data] = result; |
| 2268 dart.assert(this[_isUpgraded]); | 2268 dart.assert(this[_isUpgraded]); |
| 2269 return result; | 2269 return result; |
| 2270 } | 2270 } |
| 2271 [_process](key) { | 2271 [_process](key) { |
| 2272 if (!dart.notNull(_JsonMap[_hasProperty](this[_original], key))) | 2272 if (!dart.notNull(_JsonMap[_hasProperty](this[_original], key))) |
| 2273 return null; | 2273 return null; |
| 2274 let result = _convertJsonToDartLazy(_JsonMap[_getProperty](this[_original]
, key)); | 2274 let result = _convertJsonToDartLazy(_JsonMap[_getProperty](this[_original]
, key)); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 2293 return Object.create(null); | 2293 return Object.create(null); |
| 2294 } | 2294 } |
| 2295 } | 2295 } |
| 2296 _JsonMap[dart.implements] = () => [collection.LinkedHashMap]; | 2296 _JsonMap[dart.implements] = () => [collection.LinkedHashMap]; |
| 2297 let _parent = Symbol('_parent'); | 2297 let _parent = Symbol('_parent'); |
| 2298 class _JsonMapKeyIterable extends _internal.ListIterable { | 2298 class _JsonMapKeyIterable extends _internal.ListIterable { |
| 2299 _JsonMapKeyIterable(parent) { | 2299 _JsonMapKeyIterable(parent) { |
| 2300 this[_parent] = parent; | 2300 this[_parent] = parent; |
| 2301 super.ListIterable(); | 2301 super.ListIterable(); |
| 2302 } | 2302 } |
| 2303 get length() { | 2303 get [core.$length]() { |
| 2304 return this[_parent].length; | 2304 return this[_parent].length; |
| 2305 } | 2305 } |
| 2306 elementAt(index) { | 2306 [core.$elementAt](index) { |
| 2307 return dart.as(this[_parent][_isUpgraded] ? this[_parent].keys.elementAt(i
ndex) : this[_parent]._computeKeys().get(index), core.String); | 2307 return dart.as(this[_parent][_isUpgraded] ? this[_parent].keys[core.$eleme
ntAt](index) : this[_parent]._computeKeys()[core.$get](index), core.String); |
| 2308 } | 2308 } |
| 2309 get iterator() { | 2309 get [core.$iterator]() { |
| 2310 return dart.as(this[_parent][_isUpgraded] ? this[_parent].keys.iterator :
this[_parent]._computeKeys().iterator, core.Iterator); | 2310 return dart.as(this[_parent][_isUpgraded] ? this[_parent].keys[core.$itera
tor] : this[_parent]._computeKeys()[core.$iterator], core.Iterator); |
| 2311 } | 2311 } |
| 2312 contains(key) { | 2312 [core.$contains](key) { |
| 2313 return this[_parent].containsKey(key); | 2313 return this[_parent].containsKey(key); |
| 2314 } | 2314 } |
| 2315 } | 2315 } |
| 2316 class _JsonDecoderSink extends _StringSinkConversionSink { | 2316 class _JsonDecoderSink extends _StringSinkConversionSink { |
| 2317 _JsonDecoderSink(reviver$, sink$) { | 2317 _JsonDecoderSink(reviver$, sink$) { |
| 2318 this[_reviver] = reviver$; | 2318 this[_reviver] = reviver$; |
| 2319 this[_sink] = sink$; | 2319 this[_sink] = sink$; |
| 2320 super._StringSinkConversionSink(new core.StringBuffer()); | 2320 super._StringSinkConversionSink(new core.StringBuffer()); |
| 2321 } | 2321 } |
| 2322 close() { | 2322 close() { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2362 exports.LineSplitter = LineSplitter; | 2362 exports.LineSplitter = LineSplitter; |
| 2363 exports.StringConversionSink = StringConversionSink; | 2363 exports.StringConversionSink = StringConversionSink; |
| 2364 exports.ClosableStringSink = ClosableStringSink; | 2364 exports.ClosableStringSink = ClosableStringSink; |
| 2365 exports.UNICODE_REPLACEMENT_CHARACTER_RUNE = UNICODE_REPLACEMENT_CHARACTER_RUN
E; | 2365 exports.UNICODE_REPLACEMENT_CHARACTER_RUNE = UNICODE_REPLACEMENT_CHARACTER_RUN
E; |
| 2366 exports.UNICODE_BOM_CHARACTER_RUNE = UNICODE_BOM_CHARACTER_RUNE; | 2366 exports.UNICODE_BOM_CHARACTER_RUNE = UNICODE_BOM_CHARACTER_RUNE; |
| 2367 exports.UTF8 = UTF8; | 2367 exports.UTF8 = UTF8; |
| 2368 exports.Utf8Codec = Utf8Codec; | 2368 exports.Utf8Codec = Utf8Codec; |
| 2369 exports.Utf8Encoder = Utf8Encoder; | 2369 exports.Utf8Encoder = Utf8Encoder; |
| 2370 exports.Utf8Decoder = Utf8Decoder; | 2370 exports.Utf8Decoder = Utf8Decoder; |
| 2371 })(convert || (convert = {})); | 2371 })(convert || (convert = {})); |
| OLD | NEW |