| OLD | NEW |
| 1 var convert; | 1 var convert; |
| 2 (function(exports) { | 2 (function(exports) { |
| 3 'use strict'; | 3 'use strict'; |
| 4 let _processed = Symbol('_processed'); | 4 let _processed = Symbol('_processed'); |
| 5 let _original = Symbol('_original'); | 5 let _original = Symbol('_original'); |
| 6 // Function _convertJsonToDart: (dynamic, (dynamic, dynamic) → dynamic) → dyna
mic | 6 // Function _convertJsonToDart: (dynamic, (dynamic, dynamic) → dynamic) → dyna
mic |
| 7 function _convertJsonToDart(json, reviver) { | 7 function _convertJsonToDart(json, reviver) { |
| 8 dart.assert(reviver !== null); | 8 dart.assert(reviver !== null); |
| 9 // Function walk: (dynamic) → dynamic | 9 // Function walk: (dynamic) → dynamic |
| 10 function walk(e) { | 10 function walk(e) { |
| 11 if (e == null || typeof e != "object") { | 11 if (e == null || typeof e != "object") { |
| 12 return e; | 12 return e; |
| 13 } | 13 } |
| 14 if (Object.getPrototypeOf(e) === Array.prototype) { | 14 if (Object.getPrototypeOf(e) === Array.prototype) { |
| 15 for (let i = 0; dart.notNull(i) < e.length; dart.notNull(i)++) { | 15 for (let i = 0; dart.notNull(i) < e.length; i = dart.notNull(i) + 1) { |
| 16 let item = e[i]; | 16 let item = e[i]; |
| 17 e[i] = reviver(i, walk(item)); | 17 e[i] = reviver(i, walk(item)); |
| 18 } | 18 } |
| 19 return e; | 19 return e; |
| 20 } | 20 } |
| 21 let map = new _JsonMap(e); | 21 let map = new _JsonMap(e); |
| 22 let processed = map[_processed]; | 22 let processed = map[_processed]; |
| 23 let keys = map._computeKeys(); | 23 let keys = map._computeKeys(); |
| 24 for (let i = 0; dart.notNull(i) < dart.notNull(keys.length); dart.notNull(
i)++) { | 24 for (let i = 0; dart.notNull(i) < dart.notNull(keys.length); i = dart.notN
ull(i) + 1) { |
| 25 let key = keys.get(i); | 25 let key = keys.get(i); |
| 26 let revived = reviver(key, walk(e[key])); | 26 let revived = reviver(key, walk(e[key])); |
| 27 processed[key] = revived; | 27 processed[key] = revived; |
| 28 } | 28 } |
| 29 map[_original] = processed; | 29 map[_original] = processed; |
| 30 return map; | 30 return map; |
| 31 } | 31 } |
| 32 return reviver(null, walk(json)); | 32 return reviver(null, walk(json)); |
| 33 } | 33 } |
| 34 // Function _convertJsonToDartLazy: (dynamic) → dynamic | 34 // Function _convertJsonToDartLazy: (dynamic) → dynamic |
| 35 function _convertJsonToDartLazy(object) { | 35 function _convertJsonToDartLazy(object) { |
| 36 if (object === null) | 36 if (object === null) |
| 37 return null; | 37 return null; |
| 38 if (typeof object != "object") { | 38 if (typeof object != "object") { |
| 39 return object; | 39 return object; |
| 40 } | 40 } |
| 41 if (Object.getPrototypeOf(object) !== Array.prototype) { | 41 if (Object.getPrototypeOf(object) !== Array.prototype) { |
| 42 return new _JsonMap(object); | 42 return new _JsonMap(object); |
| 43 } | 43 } |
| 44 for (let i = 0; dart.notNull(i) < object.length; dart.notNull(i)++) { | 44 for (let i = 0; dart.notNull(i) < object.length; i = dart.notNull(i) + 1) { |
| 45 let item = object[i]; | 45 let item = object[i]; |
| 46 object[i] = _convertJsonToDartLazy(item); | 46 object[i] = _convertJsonToDartLazy(item); |
| 47 } | 47 } |
| 48 return object; | 48 return object; |
| 49 } | 49 } |
| 50 let _data = Symbol('_data'); | 50 let _data = Symbol('_data'); |
| 51 let _isUpgraded = Symbol('_isUpgraded'); | 51 let _isUpgraded = Symbol('_isUpgraded'); |
| 52 let _upgradedMap = Symbol('_upgradedMap'); | 52 let _upgradedMap = Symbol('_upgradedMap'); |
| 53 let _process = Symbol('_process'); | 53 let _process = Symbol('_process'); |
| 54 let _computeKeys = Symbol('_computeKeys'); | 54 let _computeKeys = Symbol('_computeKeys'); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 } | 112 } |
| 113 addAll(other) { | 113 addAll(other) { |
| 114 other.forEach(((key, value) => { | 114 other.forEach(((key, value) => { |
| 115 this.set(key, value); | 115 this.set(key, value); |
| 116 }).bind(this)); | 116 }).bind(this)); |
| 117 } | 117 } |
| 118 containsValue(value) { | 118 containsValue(value) { |
| 119 if (this[_isUpgraded]) | 119 if (this[_isUpgraded]) |
| 120 return this[_upgradedMap].containsValue(value); | 120 return this[_upgradedMap].containsValue(value); |
| 121 let keys = this[_computeKeys](); | 121 let keys = this[_computeKeys](); |
| 122 for (let i = 0; dart.notNull(i) < dart.notNull(keys.length); dart.notNull(
i)++) { | 122 for (let i = 0; dart.notNull(i) < dart.notNull(keys.length); i = dart.notN
ull(i) + 1) { |
| 123 let key = keys.get(i); | 123 let key = keys.get(i); |
| 124 if (dart.equals(this.get(key), value)) | 124 if (dart.equals(this.get(key), value)) |
| 125 return true; | 125 return true; |
| 126 } | 126 } |
| 127 return false; | 127 return false; |
| 128 } | 128 } |
| 129 containsKey(key) { | 129 containsKey(key) { |
| 130 if (this[_isUpgraded]) | 130 if (this[_isUpgraded]) |
| 131 return this[_upgradedMap].containsKey(key); | 131 return this[_upgradedMap].containsKey(key); |
| 132 if (!(typeof key == string)) | 132 if (!(typeof key == string)) |
| (...skipping 20 matching lines...) Expand all Loading... |
| 153 dart.dinvoke(this[_data], 'clear'); | 153 dart.dinvoke(this[_data], 'clear'); |
| 154 } | 154 } |
| 155 this[_original] = this[_processed] = null; | 155 this[_original] = this[_processed] = null; |
| 156 this[_data] = dart.map(); | 156 this[_data] = dart.map(); |
| 157 } | 157 } |
| 158 } | 158 } |
| 159 forEach(f) { | 159 forEach(f) { |
| 160 if (this[_isUpgraded]) | 160 if (this[_isUpgraded]) |
| 161 return this[_upgradedMap].forEach(f); | 161 return this[_upgradedMap].forEach(f); |
| 162 let keys = this[_computeKeys](); | 162 let keys = this[_computeKeys](); |
| 163 for (let i = 0; dart.notNull(i) < dart.notNull(keys.length); dart.notNull(
i)++) { | 163 for (let i = 0; dart.notNull(i) < dart.notNull(keys.length); i = dart.notN
ull(i) + 1) { |
| 164 let key = keys.get(i); | 164 let key = keys.get(i); |
| 165 let value = _getProperty(this[_processed], key); | 165 let value = _getProperty(this[_processed], key); |
| 166 if (_isUnprocessed(value)) { | 166 if (_isUnprocessed(value)) { |
| 167 value = _convertJsonToDartLazy(_getProperty(this[_original], key)); | 167 value = _convertJsonToDartLazy(_getProperty(this[_original], key)); |
| 168 _setProperty(this[_processed], key, value); | 168 _setProperty(this[_processed], key, value); |
| 169 } | 169 } |
| 170 f(key, value); | 170 f(key, value); |
| 171 if (!dart.notNull(core.identical(keys, this[_data]))) { | 171 if (!dart.notNull(core.identical(keys, this[_data]))) { |
| 172 throw new core.ConcurrentModificationError(this); | 172 throw new core.ConcurrentModificationError(this); |
| 173 } | 173 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 189 if (keys === null) { | 189 if (keys === null) { |
| 190 keys = this[_data] = _getPropertyNames(this[_original]); | 190 keys = this[_data] = _getPropertyNames(this[_original]); |
| 191 } | 191 } |
| 192 return dart.as(keys, core.List$(core.String)); | 192 return dart.as(keys, core.List$(core.String)); |
| 193 } | 193 } |
| 194 [_upgrade]() { | 194 [_upgrade]() { |
| 195 if (this[_isUpgraded]) | 195 if (this[_isUpgraded]) |
| 196 return this[_upgradedMap]; | 196 return this[_upgradedMap]; |
| 197 let result = dart.map(); | 197 let result = dart.map(); |
| 198 let keys = this[_computeKeys](); | 198 let keys = this[_computeKeys](); |
| 199 for (let i = 0; dart.notNull(i) < dart.notNull(keys.length); dart.notNull(
i)++) { | 199 for (let i = 0; dart.notNull(i) < dart.notNull(keys.length); i = dart.notN
ull(i) + 1) { |
| 200 let key = keys.get(i); | 200 let key = keys.get(i); |
| 201 result.set(key, this.get(key)); | 201 result.set(key, this.get(key)); |
| 202 } | 202 } |
| 203 if (keys.isEmpty) { | 203 if (keys.isEmpty) { |
| 204 keys.add(null); | 204 keys.add(null); |
| 205 } else { | 205 } else { |
| 206 keys.clear(); | 206 keys.clear(); |
| 207 } | 207 } |
| 208 this[_original] = this[_processed] = null; | 208 this[_original] = this[_processed] = null; |
| 209 this[_data] = result; | 209 this[_data] = result; |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 if (start === void 0) | 312 if (start === void 0) |
| 313 start = 0; | 313 start = 0; |
| 314 if (end === void 0) | 314 if (end === void 0) |
| 315 end = null; | 315 end = null; |
| 316 let stringLength = string.length; | 316 let stringLength = string.length; |
| 317 core.RangeError.checkValidRange(start, end, stringLength); | 317 core.RangeError.checkValidRange(start, end, stringLength); |
| 318 if (end === null) | 318 if (end === null) |
| 319 end = stringLength; | 319 end = stringLength; |
| 320 let length = dart.notNull(end) - dart.notNull(start); | 320 let length = dart.notNull(end) - dart.notNull(start); |
| 321 let result = new typed_data.Uint8List(length); | 321 let result = new typed_data.Uint8List(length); |
| 322 for (let i = 0; dart.notNull(i) < dart.notNull(length); dart.notNull(i)++)
{ | 322 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull(i
) + 1) { |
| 323 let codeUnit = string.codeUnitAt(dart.notNull(start) + dart.notNull(i)); | 323 let codeUnit = string.codeUnitAt(dart.notNull(start) + dart.notNull(i)); |
| 324 if ((dart.notNull(codeUnit) & ~dart.notNull(this[_subsetMask])) !== 0) { | 324 if ((dart.notNull(codeUnit) & ~dart.notNull(this[_subsetMask])) !== 0) { |
| 325 throw new core.ArgumentError("String contains invalid characters."); | 325 throw new core.ArgumentError("String contains invalid characters."); |
| 326 } | 326 } |
| 327 result.set(i, codeUnit); | 327 result.set(i, codeUnit); |
| 328 } | 328 } |
| 329 return dart.as(result, core.List$(core.int)); | 329 return dart.as(result, core.List$(core.int)); |
| 330 } | 330 } |
| 331 startChunkedConversion(sink) { | 331 startChunkedConversion(sink) { |
| 332 if (!dart.is(sink, ByteConversionSink)) { | 332 if (!dart.is(sink, ByteConversionSink)) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 347 _UnicodeSubsetEncoderSink($_subsetMask, $_sink) { | 347 _UnicodeSubsetEncoderSink($_subsetMask, $_sink) { |
| 348 this[_subsetMask] = $_subsetMask; | 348 this[_subsetMask] = $_subsetMask; |
| 349 this[_sink] = $_sink; | 349 this[_sink] = $_sink; |
| 350 super.StringConversionSinkBase(); | 350 super.StringConversionSinkBase(); |
| 351 } | 351 } |
| 352 close() { | 352 close() { |
| 353 this[_sink].close(); | 353 this[_sink].close(); |
| 354 } | 354 } |
| 355 addSlice(source, start, end, isLast) { | 355 addSlice(source, start, end, isLast) { |
| 356 core.RangeError.checkValidRange(start, end, source.length); | 356 core.RangeError.checkValidRange(start, end, source.length); |
| 357 for (let i = start; dart.notNull(i) < dart.notNull(end); dart.notNull(i)++
) { | 357 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { |
| 358 let codeUnit = source.codeUnitAt(i); | 358 let codeUnit = source.codeUnitAt(i); |
| 359 if ((dart.notNull(codeUnit) & ~dart.notNull(this[_subsetMask])) !== 0) { | 359 if ((dart.notNull(codeUnit) & ~dart.notNull(this[_subsetMask])) !== 0) { |
| 360 throw new core.ArgumentError(`Source contains invalid character with c
ode point: ${codeUnit}.`); | 360 throw new core.ArgumentError(`Source contains invalid character with c
ode point: ${codeUnit}.`); |
| 361 } | 361 } |
| 362 } | 362 } |
| 363 this[_sink].add(source.codeUnits.sublist(start, end)); | 363 this[_sink].add(source.codeUnits.sublist(start, end)); |
| 364 if (isLast) { | 364 if (isLast) { |
| 365 this.close(); | 365 this.close(); |
| 366 } | 366 } |
| 367 } | 367 } |
| 368 } | 368 } |
| 369 let _convertInvalid = Symbol('_convertInvalid'); | 369 let _convertInvalid = Symbol('_convertInvalid'); |
| 370 class _UnicodeSubsetDecoder extends Converter$(core.List$(core.int), core.Stri
ng) { | 370 class _UnicodeSubsetDecoder extends Converter$(core.List$(core.int), core.Stri
ng) { |
| 371 _UnicodeSubsetDecoder($_allowInvalid, $_subsetMask) { | 371 _UnicodeSubsetDecoder($_allowInvalid, $_subsetMask) { |
| 372 this[_allowInvalid] = $_allowInvalid; | 372 this[_allowInvalid] = $_allowInvalid; |
| 373 this[_subsetMask] = $_subsetMask; | 373 this[_subsetMask] = $_subsetMask; |
| 374 super.Converter(); | 374 super.Converter(); |
| 375 } | 375 } |
| 376 convert(bytes, start, end) { | 376 convert(bytes, start, end) { |
| 377 if (start === void 0) | 377 if (start === void 0) |
| 378 start = 0; | 378 start = 0; |
| 379 if (end === void 0) | 379 if (end === void 0) |
| 380 end = null; | 380 end = null; |
| 381 let byteCount = bytes.length; | 381 let byteCount = bytes.length; |
| 382 core.RangeError.checkValidRange(start, end, byteCount); | 382 core.RangeError.checkValidRange(start, end, byteCount); |
| 383 if (end === null) | 383 if (end === null) |
| 384 end = byteCount; | 384 end = byteCount; |
| 385 let length = dart.notNull(end) - dart.notNull(start); | 385 let length = dart.notNull(end) - dart.notNull(start); |
| 386 for (let i = start; dart.notNull(i) < dart.notNull(end); dart.notNull(i)++
) { | 386 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { |
| 387 let byte = bytes.get(i); | 387 let byte = bytes.get(i); |
| 388 if ((dart.notNull(byte) & ~dart.notNull(this[_subsetMask])) !== 0) { | 388 if ((dart.notNull(byte) & ~dart.notNull(this[_subsetMask])) !== 0) { |
| 389 if (!dart.notNull(this[_allowInvalid])) { | 389 if (!dart.notNull(this[_allowInvalid])) { |
| 390 throw new core.FormatException(`Invalid value in input: ${byte}`); | 390 throw new core.FormatException(`Invalid value in input: ${byte}`); |
| 391 } | 391 } |
| 392 return this[_convertInvalid](bytes, start, end); | 392 return this[_convertInvalid](bytes, start, end); |
| 393 } | 393 } |
| 394 } | 394 } |
| 395 return new core.String.fromCharCodes(bytes, start, end); | 395 return new core.String.fromCharCodes(bytes, start, end); |
| 396 } | 396 } |
| 397 [_convertInvalid](bytes, start, end) { | 397 [_convertInvalid](bytes, start, end) { |
| 398 let buffer = new core.StringBuffer(); | 398 let buffer = new core.StringBuffer(); |
| 399 for (let i = start; dart.notNull(i) < dart.notNull(end); dart.notNull(i)++
) { | 399 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { |
| 400 let value = bytes.get(i); | 400 let value = bytes.get(i); |
| 401 if ((dart.notNull(value) & ~dart.notNull(this[_subsetMask])) !== 0) | 401 if ((dart.notNull(value) & ~dart.notNull(this[_subsetMask])) !== 0) |
| 402 value = 65533; | 402 value = 65533; |
| 403 buffer.writeCharCode(value); | 403 buffer.writeCharCode(value); |
| 404 } | 404 } |
| 405 return buffer.toString(); | 405 return buffer.toString(); |
| 406 } | 406 } |
| 407 bind(stream) { | 407 bind(stream) { |
| 408 return dart.as(super.bind(stream), async.Stream$(core.String)); | 408 return dart.as(super.bind(stream), async.Stream$(core.String)); |
| 409 } | 409 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 434 super.ByteConversionSinkBase(); | 434 super.ByteConversionSinkBase(); |
| 435 } | 435 } |
| 436 close() { | 436 close() { |
| 437 this[_utf8Sink].close(); | 437 this[_utf8Sink].close(); |
| 438 } | 438 } |
| 439 add(source) { | 439 add(source) { |
| 440 this.addSlice(source, 0, source.length, false); | 440 this.addSlice(source, 0, source.length, false); |
| 441 } | 441 } |
| 442 addSlice(source, start, end, isLast) { | 442 addSlice(source, start, end, isLast) { |
| 443 core.RangeError.checkValidRange(start, end, source.length); | 443 core.RangeError.checkValidRange(start, end, source.length); |
| 444 for (let i = start; dart.notNull(i) < dart.notNull(end); dart.notNull(i)++
) { | 444 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { |
| 445 if ((dart.notNull(source.get(i)) & ~dart.notNull(_ASCII_MASK)) !== 0) { | 445 if ((dart.notNull(source.get(i)) & ~dart.notNull(_ASCII_MASK)) !== 0) { |
| 446 if (dart.notNull(i) > dart.notNull(start)) | 446 if (dart.notNull(i) > dart.notNull(start)) |
| 447 this[_utf8Sink].addSlice(source, start, i, false); | 447 this[_utf8Sink].addSlice(source, start, i, false); |
| 448 this[_utf8Sink].add(/* Unimplemented const */new List.from([239, 191,
189])); | 448 this[_utf8Sink].add(/* Unimplemented const */new List.from([239, 191,
189])); |
| 449 start = dart.notNull(i) + 1; | 449 start = dart.notNull(i) + 1; |
| 450 } | 450 } |
| 451 } | 451 } |
| 452 if (dart.notNull(start) < dart.notNull(end)) { | 452 if (dart.notNull(start) < dart.notNull(end)) { |
| 453 this[_utf8Sink].addSlice(source, start, end, isLast); | 453 this[_utf8Sink].addSlice(source, start, end, isLast); |
| 454 } else if (isLast) { | 454 } else if (isLast) { |
| 455 this.close(); | 455 this.close(); |
| 456 } | 456 } |
| 457 } | 457 } |
| 458 } | 458 } |
| 459 class _SimpleAsciiDecoderSink extends ByteConversionSinkBase { | 459 class _SimpleAsciiDecoderSink extends ByteConversionSinkBase { |
| 460 _SimpleAsciiDecoderSink($_sink) { | 460 _SimpleAsciiDecoderSink($_sink) { |
| 461 this[_sink] = $_sink; | 461 this[_sink] = $_sink; |
| 462 super.ByteConversionSinkBase(); | 462 super.ByteConversionSinkBase(); |
| 463 } | 463 } |
| 464 close() { | 464 close() { |
| 465 this[_sink].close(); | 465 this[_sink].close(); |
| 466 } | 466 } |
| 467 add(source) { | 467 add(source) { |
| 468 for (let i = 0; dart.notNull(i) < dart.notNull(source.length); dart.notNul
l(i)++) { | 468 for (let i = 0; dart.notNull(i) < dart.notNull(source.length); i = dart.no
tNull(i) + 1) { |
| 469 if ((dart.notNull(source.get(i)) & ~dart.notNull(_ASCII_MASK)) !== 0) { | 469 if ((dart.notNull(source.get(i)) & ~dart.notNull(_ASCII_MASK)) !== 0) { |
| 470 throw new core.FormatException("Source contains non-ASCII bytes."); | 470 throw new core.FormatException("Source contains non-ASCII bytes."); |
| 471 } | 471 } |
| 472 } | 472 } |
| 473 this[_sink].add(new core.String.fromCharCodes(source)); | 473 this[_sink].add(new core.String.fromCharCodes(source)); |
| 474 } | 474 } |
| 475 addSlice(source, start, end, isLast) { | 475 addSlice(source, start, end, isLast) { |
| 476 let length = source.length; | 476 let length = source.length; |
| 477 core.RangeError.checkValidRange(start, end, length); | 477 core.RangeError.checkValidRange(start, end, length); |
| 478 if (dart.notNull(start) < dart.notNull(end)) { | 478 if (dart.notNull(start) < dart.notNull(end)) { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 let newLength = dart.notNull(_roundToPowerOf2(dart.notNull(chunk.length)
+ dart.notNull(oldLength))) * 2; | 535 let newLength = dart.notNull(_roundToPowerOf2(dart.notNull(chunk.length)
+ dart.notNull(oldLength))) * 2; |
| 536 let grown = new typed_data.Uint8List(newLength); | 536 let grown = new typed_data.Uint8List(newLength); |
| 537 grown.setRange(0, this[_buffer].length, this[_buffer]); | 537 grown.setRange(0, this[_buffer].length, this[_buffer]); |
| 538 this[_buffer] = grown; | 538 this[_buffer] = grown; |
| 539 } | 539 } |
| 540 this[_buffer].setRange(this[_bufferIndex], dart.notNull(this[_bufferIndex]
) + dart.notNull(chunk.length), chunk); | 540 this[_buffer].setRange(this[_bufferIndex], dart.notNull(this[_bufferIndex]
) + dart.notNull(chunk.length), chunk); |
| 541 this[_bufferIndex] = chunk.length; | 541 this[_bufferIndex] = chunk.length; |
| 542 } | 542 } |
| 543 static [_roundToPowerOf2](v) { | 543 static [_roundToPowerOf2](v) { |
| 544 dart.assert(dart.notNull(v) > 0); | 544 dart.assert(dart.notNull(v) > 0); |
| 545 dart.notNull(v)--; | 545 v = dart.notNull(v) - 1; |
| 546 v = dart.notNull(v) >> 1; | 546 v = dart.notNull(v) >> 1; |
| 547 v = dart.notNull(v) >> 2; | 547 v = dart.notNull(v) >> 2; |
| 548 v = dart.notNull(v) >> 4; | 548 v = dart.notNull(v) >> 4; |
| 549 v = dart.notNull(v) >> 8; | 549 v = dart.notNull(v) >> 8; |
| 550 v = dart.notNull(v) >> 16; | 550 v = dart.notNull(v) >> 16; |
| 551 dart.notNull(v)++; | 551 v = dart.notNull(v) + 1; |
| 552 return v; | 552 return v; |
| 553 } | 553 } |
| 554 close() { | 554 close() { |
| 555 this[_callback](this[_buffer].sublist(0, this[_bufferIndex])); | 555 this[_callback](this[_buffer].sublist(0, this[_bufferIndex])); |
| 556 } | 556 } |
| 557 } | 557 } |
| 558 _ByteCallbackSink._INITIAL_BUFFER_SIZE = 1024; | 558 _ByteCallbackSink._INITIAL_BUFFER_SIZE = 1024; |
| 559 let ChunkedConversionSink$ = dart.generic(function(T) { | 559 let ChunkedConversionSink$ = dart.generic(function(T) { |
| 560 class ChunkedConversionSink extends dart.Object { | 560 class ChunkedConversionSink extends dart.Object { |
| 561 ChunkedConversionSink() { | 561 ChunkedConversionSink() { |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 mode = HtmlEscapeMode.UNKNOWN; | 762 mode = HtmlEscapeMode.UNKNOWN; |
| 763 this.mode = mode; | 763 this.mode = mode; |
| 764 super.Converter(); | 764 super.Converter(); |
| 765 } | 765 } |
| 766 convert(text) { | 766 convert(text) { |
| 767 let val = this[_convert](text, 0, text.length); | 767 let val = this[_convert](text, 0, text.length); |
| 768 return val === null ? text : val; | 768 return val === null ? text : val; |
| 769 } | 769 } |
| 770 [_convert](text, start, end) { | 770 [_convert](text, start, end) { |
| 771 let result = null; | 771 let result = null; |
| 772 for (let i = start; dart.notNull(i) < dart.notNull(end); dart.notNull(i)++
) { | 772 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { |
| 773 let ch = text.get(i); | 773 let ch = text.get(i); |
| 774 let replace = null; | 774 let replace = null; |
| 775 switch (ch) { | 775 switch (ch) { |
| 776 case '&': | 776 case '&': |
| 777 replace = '&'; | 777 replace = '&'; |
| 778 break; | 778 break; |
| 779 case ' ': | 779 case ' ': |
| 780 replace = ' '; | 780 replace = ' '; |
| 781 break; | 781 break; |
| 782 case '"': | 782 case '"': |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 954 this[_toEncodable] = toEncodable; | 954 this[_toEncodable] = toEncodable; |
| 955 this[_bufferSize] = bufferSize; | 955 this[_bufferSize] = bufferSize; |
| 956 super.Converter(); | 956 super.Converter(); |
| 957 } | 957 } |
| 958 static [_utf8Encode](string) { | 958 static [_utf8Encode](string) { |
| 959 if (string === null) | 959 if (string === null) |
| 960 return null; | 960 return null; |
| 961 if (string.isEmpty) | 961 if (string.isEmpty) |
| 962 return new typed_data.Uint8List(0); | 962 return new typed_data.Uint8List(0); |
| 963 checkAscii: { | 963 checkAscii: { |
| 964 for (let i = 0; dart.notNull(i) < dart.notNull(string.length); dart.notN
ull(i)++) { | 964 for (let i = 0; dart.notNull(i) < dart.notNull(string.length); i = dart.
notNull(i) + 1) { |
| 965 if (dart.notNull(string.codeUnitAt(i)) >= 128) | 965 if (dart.notNull(string.codeUnitAt(i)) >= 128) |
| 966 break checkAscii; | 966 break checkAscii; |
| 967 } | 967 } |
| 968 return string.codeUnits; | 968 return string.codeUnits; |
| 969 } | 969 } |
| 970 return UTF8.encode(string); | 970 return UTF8.encode(string); |
| 971 } | 971 } |
| 972 convert(object) { | 972 convert(object) { |
| 973 let bytes = dart.as(new List.from([]), core.List$(core.List$(core.int))); | 973 let bytes = dart.as(new List.from([]), core.List$(core.List$(core.int))); |
| 974 // Function addChunk: (Uint8List, int, int) → void | 974 // Function addChunk: (Uint8List, int, int) → void |
| 975 function addChunk(chunk, start, end) { | 975 function addChunk(chunk, start, end) { |
| 976 if (dart.notNull(start) > 0 || dart.notNull(end) < dart.notNull(chunk.le
ngth)) { | 976 if (dart.notNull(start) > 0 || dart.notNull(end) < dart.notNull(chunk.le
ngth)) { |
| 977 let length = dart.notNull(end) - dart.notNull(start); | 977 let length = dart.notNull(end) - dart.notNull(start); |
| 978 chunk = new typed_data.Uint8List.view(chunk.buffer, dart.notNull(chunk
.offsetInBytes) + dart.notNull(start), length); | 978 chunk = new typed_data.Uint8List.view(chunk.buffer, dart.notNull(chunk
.offsetInBytes) + dart.notNull(start), length); |
| 979 } | 979 } |
| 980 bytes.add(chunk); | 980 bytes.add(chunk); |
| 981 } | 981 } |
| 982 _JsonUtf8Stringifier.stringify(object, this[_indent], dart.as(this[_toEnco
dable], dart.throw_("Unimplemented type (Object) → dynamic")), this[_bufferSize]
, addChunk); | 982 _JsonUtf8Stringifier.stringify(object, this[_indent], dart.as(this[_toEnco
dable], dart.throw_("Unimplemented type (Object) → dynamic")), this[_bufferSize]
, addChunk); |
| 983 if (bytes.length === 1) | 983 if (bytes.length === 1) |
| 984 return bytes.get(0); | 984 return bytes.get(0); |
| 985 let length = 0; | 985 let length = 0; |
| 986 for (let i = 0; dart.notNull(i) < dart.notNull(bytes.length); dart.notNull
(i)++) { | 986 for (let i = 0; dart.notNull(i) < dart.notNull(bytes.length); i = dart.not
Null(i) + 1) { |
| 987 length = bytes.get(i).length; | 987 length = bytes.get(i).length; |
| 988 } | 988 } |
| 989 let result = new typed_data.Uint8List(length); | 989 let result = new typed_data.Uint8List(length); |
| 990 for (let i = 0, offset = 0; dart.notNull(i) < dart.notNull(bytes.length);
dart.notNull(i)++) { | 990 for (let i = 0, offset = 0; dart.notNull(i) < dart.notNull(bytes.length);
i = dart.notNull(i) + 1) { |
| 991 let byteList = bytes.get(i); | 991 let byteList = bytes.get(i); |
| 992 let end = dart.notNull(offset) + dart.notNull(byteList.length); | 992 let end = dart.notNull(offset) + dart.notNull(byteList.length); |
| 993 result.setRange(offset, end, byteList); | 993 result.setRange(offset, end, byteList); |
| 994 offset = end; | 994 offset = end; |
| 995 } | 995 } |
| 996 return result; | 996 return result; |
| 997 } | 997 } |
| 998 startChunkedConversion(sink) { | 998 startChunkedConversion(sink) { |
| 999 let byteSink = null; | 999 let byteSink = null; |
| 1000 if (dart.is(sink, ByteConversionSink)) { | 1000 if (dart.is(sink, ByteConversionSink)) { |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1105 _JsonStringifier(_toEncodable) { | 1105 _JsonStringifier(_toEncodable) { |
| 1106 this[_seen] = new core.List(); | 1106 this[_seen] = new core.List(); |
| 1107 this[_toEncodable] = dart.as(_toEncodable !== null ? _toEncodable : _defau
ltToEncodable, core.Function); | 1107 this[_toEncodable] = dart.as(_toEncodable !== null ? _toEncodable : _defau
ltToEncodable, core.Function); |
| 1108 } | 1108 } |
| 1109 static hexDigit(x) { | 1109 static hexDigit(x) { |
| 1110 return dart.notNull(x) < 10 ? 48 + dart.notNull(x) : 87 + dart.notNull(x); | 1110 return dart.notNull(x) < 10 ? 48 + dart.notNull(x) : 87 + dart.notNull(x); |
| 1111 } | 1111 } |
| 1112 writeStringContent(s) { | 1112 writeStringContent(s) { |
| 1113 let offset = 0; | 1113 let offset = 0; |
| 1114 let length = s.length; | 1114 let length = s.length; |
| 1115 for (let i = 0; dart.notNull(i) < dart.notNull(length); dart.notNull(i)++)
{ | 1115 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull(i
) + 1) { |
| 1116 let charCode = s.codeUnitAt(i); | 1116 let charCode = s.codeUnitAt(i); |
| 1117 if (dart.notNull(charCode) > dart.notNull(BACKSLASH)) | 1117 if (dart.notNull(charCode) > dart.notNull(BACKSLASH)) |
| 1118 continue; | 1118 continue; |
| 1119 if (dart.notNull(charCode) < 32) { | 1119 if (dart.notNull(charCode) < 32) { |
| 1120 if (dart.notNull(i) > dart.notNull(offset)) | 1120 if (dart.notNull(i) > dart.notNull(offset)) |
| 1121 this.writeStringSlice(s, offset, i); | 1121 this.writeStringSlice(s, offset, i); |
| 1122 offset = dart.notNull(i) + 1; | 1122 offset = dart.notNull(i) + 1; |
| 1123 this.writeCharCode(BACKSLASH); | 1123 this.writeCharCode(BACKSLASH); |
| 1124 switch (charCode) { | 1124 switch (charCode) { |
| 1125 case BACKSPACE: | 1125 case BACKSPACE: |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1153 this.writeCharCode(charCode); | 1153 this.writeCharCode(charCode); |
| 1154 } | 1154 } |
| 1155 } | 1155 } |
| 1156 if (offset === 0) { | 1156 if (offset === 0) { |
| 1157 this.writeString(s); | 1157 this.writeString(s); |
| 1158 } else if (dart.notNull(offset) < dart.notNull(length)) { | 1158 } else if (dart.notNull(offset) < dart.notNull(length)) { |
| 1159 this.writeStringSlice(s, offset, length); | 1159 this.writeStringSlice(s, offset, length); |
| 1160 } | 1160 } |
| 1161 } | 1161 } |
| 1162 [_checkCycle](object) { | 1162 [_checkCycle](object) { |
| 1163 for (let i = 0; dart.notNull(i) < dart.notNull(this[_seen].length); dart.n
otNull(i)++) { | 1163 for (let i = 0; dart.notNull(i) < dart.notNull(this[_seen].length); i = da
rt.notNull(i) + 1) { |
| 1164 if (core.identical(object, this[_seen].get(i))) { | 1164 if (core.identical(object, this[_seen].get(i))) { |
| 1165 throw new JsonCyclicError(object); | 1165 throw new JsonCyclicError(object); |
| 1166 } | 1166 } |
| 1167 } | 1167 } |
| 1168 this[_seen].add(object); | 1168 this[_seen].add(object); |
| 1169 } | 1169 } |
| 1170 [_removeSeen](object) { | 1170 [_removeSeen](object) { |
| 1171 dart.assert(!dart.notNull(this[_seen].isEmpty)); | 1171 dart.assert(!dart.notNull(this[_seen].isEmpty)); |
| 1172 dart.assert(core.identical(this[_seen].last, object)); | 1172 dart.assert(core.identical(this[_seen].last, object)); |
| 1173 this[_seen].removeLast(); | 1173 this[_seen].removeLast(); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1218 this[_removeSeen](object); | 1218 this[_removeSeen](object); |
| 1219 return true; | 1219 return true; |
| 1220 } else { | 1220 } else { |
| 1221 return false; | 1221 return false; |
| 1222 } | 1222 } |
| 1223 } | 1223 } |
| 1224 writeList(list) { | 1224 writeList(list) { |
| 1225 this.writeString('['); | 1225 this.writeString('['); |
| 1226 if (dart.notNull(list.length) > 0) { | 1226 if (dart.notNull(list.length) > 0) { |
| 1227 this.writeObject(list.get(0)); | 1227 this.writeObject(list.get(0)); |
| 1228 for (let i = 1; dart.notNull(i) < dart.notNull(list.length); dart.notNul
l(i)++) { | 1228 for (let i = 1; dart.notNull(i) < dart.notNull(list.length); i = dart.no
tNull(i) + 1) { |
| 1229 this.writeString(','); | 1229 this.writeString(','); |
| 1230 this.writeObject(list.get(i)); | 1230 this.writeObject(list.get(i)); |
| 1231 } | 1231 } |
| 1232 } | 1232 } |
| 1233 this.writeString(']'); | 1233 this.writeString(']'); |
| 1234 } | 1234 } |
| 1235 writeMap(map) { | 1235 writeMap(map) { |
| 1236 this.writeString('{'); | 1236 this.writeString('{'); |
| 1237 let separator = '"'; | 1237 let separator = '"'; |
| 1238 map.forEach(((key, value) => { | 1238 map.forEach(((key, value) => { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1262 let _indentLevel = Symbol('_indentLevel'); | 1262 let _indentLevel = Symbol('_indentLevel'); |
| 1263 class _JsonPrettyPrintMixin extends dart.Object { | 1263 class _JsonPrettyPrintMixin extends dart.Object { |
| 1264 _JsonPrettyPrintMixin() { | 1264 _JsonPrettyPrintMixin() { |
| 1265 this[_indentLevel] = 0; | 1265 this[_indentLevel] = 0; |
| 1266 } | 1266 } |
| 1267 writeList(list) { | 1267 writeList(list) { |
| 1268 if (list.isEmpty) { | 1268 if (list.isEmpty) { |
| 1269 this.writeString('[]'); | 1269 this.writeString('[]'); |
| 1270 } else { | 1270 } else { |
| 1271 this.writeString('[\n'); | 1271 this.writeString('[\n'); |
| 1272 dart.notNull(this[_indentLevel])++; | 1272 this[_indentLevel] = dart.notNull(this[_indentLevel]) + 1; |
| 1273 this.writeIndentation(this[_indentLevel]); | 1273 this.writeIndentation(this[_indentLevel]); |
| 1274 this.writeObject(list.get(0)); | 1274 this.writeObject(list.get(0)); |
| 1275 for (let i = 1; dart.notNull(i) < dart.notNull(list.length); dart.notNul
l(i)++) { | 1275 for (let i = 1; dart.notNull(i) < dart.notNull(list.length); i = dart.no
tNull(i) + 1) { |
| 1276 this.writeString(',\n'); | 1276 this.writeString(',\n'); |
| 1277 this.writeIndentation(this[_indentLevel]); | 1277 this.writeIndentation(this[_indentLevel]); |
| 1278 this.writeObject(list.get(i)); | 1278 this.writeObject(list.get(i)); |
| 1279 } | 1279 } |
| 1280 this.writeString('\n'); | 1280 this.writeString('\n'); |
| 1281 dart.notNull(this[_indentLevel])--; | 1281 this[_indentLevel] = dart.notNull(this[_indentLevel]) - 1; |
| 1282 this.writeIndentation(this[_indentLevel]); | 1282 this.writeIndentation(this[_indentLevel]); |
| 1283 this.writeString(']'); | 1283 this.writeString(']'); |
| 1284 } | 1284 } |
| 1285 } | 1285 } |
| 1286 writeMap(map) { | 1286 writeMap(map) { |
| 1287 if (map.isEmpty) { | 1287 if (map.isEmpty) { |
| 1288 this.writeString('{}'); | 1288 this.writeString('{}'); |
| 1289 } else { | 1289 } else { |
| 1290 this.writeString('{\n'); | 1290 this.writeString('{\n'); |
| 1291 dart.notNull(this[_indentLevel])++; | 1291 this[_indentLevel] = dart.notNull(this[_indentLevel]) + 1; |
| 1292 let first = true; | 1292 let first = true; |
| 1293 map.forEach(dart.as(((key, value) => { | 1293 map.forEach(dart.as(((key, value) => { |
| 1294 if (!dart.notNull(first)) { | 1294 if (!dart.notNull(first)) { |
| 1295 this.writeString(",\n"); | 1295 this.writeString(",\n"); |
| 1296 } | 1296 } |
| 1297 this.writeIndentation(this[_indentLevel]); | 1297 this.writeIndentation(this[_indentLevel]); |
| 1298 this.writeString('"'); | 1298 this.writeString('"'); |
| 1299 this.writeStringContent(key); | 1299 this.writeStringContent(key); |
| 1300 this.writeString('": '); | 1300 this.writeString('": '); |
| 1301 this.writeObject(value); | 1301 this.writeObject(value); |
| 1302 first = false; | 1302 first = false; |
| 1303 }).bind(this), dart.throw_("Unimplemented type (dynamic, dynamic) → void
"))); | 1303 }).bind(this), dart.throw_("Unimplemented type (dynamic, dynamic) → void
"))); |
| 1304 this.writeString('\n'); | 1304 this.writeString('\n'); |
| 1305 dart.notNull(this[_indentLevel])--; | 1305 this[_indentLevel] = dart.notNull(this[_indentLevel]) - 1; |
| 1306 this.writeIndentation(this[_indentLevel]); | 1306 this.writeIndentation(this[_indentLevel]); |
| 1307 this.writeString('}'); | 1307 this.writeString('}'); |
| 1308 } | 1308 } |
| 1309 } | 1309 } |
| 1310 } | 1310 } |
| 1311 class _JsonStringStringifier extends _JsonStringifier { | 1311 class _JsonStringStringifier extends _JsonStringifier { |
| 1312 _JsonStringStringifier($_sink, _toEncodable) { | 1312 _JsonStringStringifier($_sink, _toEncodable) { |
| 1313 this[_sink] = $_sink; | 1313 this[_sink] = $_sink; |
| 1314 super._JsonStringifier(dart.as(_toEncodable, dart.throw_("Unimplemented ty
pe (Object) → Object"))); | 1314 super._JsonStringifier(dart.as(_toEncodable, dart.throw_("Unimplemented ty
pe (Object) → Object"))); |
| 1315 } | 1315 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1339 writeCharCode(charCode) { | 1339 writeCharCode(charCode) { |
| 1340 this[_sink].writeCharCode(charCode); | 1340 this[_sink].writeCharCode(charCode); |
| 1341 } | 1341 } |
| 1342 } | 1342 } |
| 1343 class _JsonStringStringifierPretty extends dart.mixin(_JsonStringStringifier,
_JsonPrettyPrintMixin) { | 1343 class _JsonStringStringifierPretty extends dart.mixin(_JsonStringStringifier,
_JsonPrettyPrintMixin) { |
| 1344 _JsonStringStringifierPretty(sink, toEncodable, $_indent) { | 1344 _JsonStringStringifierPretty(sink, toEncodable, $_indent) { |
| 1345 this[_indent] = $_indent; | 1345 this[_indent] = $_indent; |
| 1346 super._JsonStringStringifier(sink, toEncodable); | 1346 super._JsonStringStringifier(sink, toEncodable); |
| 1347 } | 1347 } |
| 1348 writeIndentation(count) { | 1348 writeIndentation(count) { |
| 1349 for (let i = 0; dart.notNull(i) < dart.notNull(count); dart.notNull(i)++) | 1349 for (let i = 0; dart.notNull(i) < dart.notNull(count); i = dart.notNull(i)
+ 1) |
| 1350 this.writeString(this[_indent]); | 1350 this.writeString(this[_indent]); |
| 1351 } | 1351 } |
| 1352 } | 1352 } |
| 1353 class _JsonUtf8Stringifier extends _JsonStringifier { | 1353 class _JsonUtf8Stringifier extends _JsonStringifier { |
| 1354 _JsonUtf8Stringifier(toEncodable, bufferSize, addChunk) { | 1354 _JsonUtf8Stringifier(toEncodable, bufferSize, addChunk) { |
| 1355 this.addChunk = addChunk; | 1355 this.addChunk = addChunk; |
| 1356 this.bufferSize = bufferSize; | 1356 this.bufferSize = bufferSize; |
| 1357 this.buffer = new typed_data.Uint8List(bufferSize); | 1357 this.buffer = new typed_data.Uint8List(bufferSize); |
| 1358 this.index = 0; | 1358 this.index = 0; |
| 1359 super._JsonStringifier(dart.as(toEncodable, dart.throw_("Unimplemented typ
e (Object) → Object"))); | 1359 super._JsonStringifier(dart.as(toEncodable, dart.throw_("Unimplemented typ
e (Object) → Object"))); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1372 if (dart.notNull(this.index) > 0) { | 1372 if (dart.notNull(this.index) > 0) { |
| 1373 dart.dinvokef(this.addChunk, this.buffer, 0, this.index); | 1373 dart.dinvokef(this.addChunk, this.buffer, 0, this.index); |
| 1374 } | 1374 } |
| 1375 this.buffer = null; | 1375 this.buffer = null; |
| 1376 this.index = 0; | 1376 this.index = 0; |
| 1377 } | 1377 } |
| 1378 writeNumber(number) { | 1378 writeNumber(number) { |
| 1379 this.writeAsciiString(number.toString()); | 1379 this.writeAsciiString(number.toString()); |
| 1380 } | 1380 } |
| 1381 writeAsciiString(string) { | 1381 writeAsciiString(string) { |
| 1382 for (let i = 0; dart.notNull(i) < dart.notNull(string.length); dart.notNul
l(i)++) { | 1382 for (let i = 0; dart.notNull(i) < dart.notNull(string.length); i = dart.no
tNull(i) + 1) { |
| 1383 let char = string.codeUnitAt(i); | 1383 let char = string.codeUnitAt(i); |
| 1384 dart.assert(dart.notNull(char) <= 127); | 1384 dart.assert(dart.notNull(char) <= 127); |
| 1385 this.writeByte(char); | 1385 this.writeByte(char); |
| 1386 } | 1386 } |
| 1387 } | 1387 } |
| 1388 writeString(string) { | 1388 writeString(string) { |
| 1389 this.writeStringSlice(string, 0, string.length); | 1389 this.writeStringSlice(string, 0, string.length); |
| 1390 } | 1390 } |
| 1391 writeStringSlice(string, start, end) { | 1391 writeStringSlice(string, start, end) { |
| 1392 for (let i = start; dart.notNull(i) < dart.notNull(end); dart.notNull(i)++
) { | 1392 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { |
| 1393 let char = string.codeUnitAt(i); | 1393 let char = string.codeUnitAt(i); |
| 1394 if (dart.notNull(char) <= 127) { | 1394 if (dart.notNull(char) <= 127) { |
| 1395 this.writeByte(char); | 1395 this.writeByte(char); |
| 1396 } else { | 1396 } else { |
| 1397 if ((dart.notNull(char) & 64512) === 55296 && dart.notNull(i) + 1 < da
rt.notNull(end)) { | 1397 if ((dart.notNull(char) & 64512) === 55296 && dart.notNull(i) + 1 < da
rt.notNull(end)) { |
| 1398 let nextChar = string.codeUnitAt(dart.notNull(i) + 1); | 1398 let nextChar = string.codeUnitAt(dart.notNull(i) + 1); |
| 1399 if ((dart.notNull(nextChar) & 64512) === 56320) { | 1399 if ((dart.notNull(nextChar) & 64512) === 56320) { |
| 1400 char = 65536 + ((dart.notNull(char) & 1023) << 10) + (dart.notNull
(nextChar) & 1023); | 1400 char = 65536 + ((dart.notNull(char) & 1023) << 10) + (dart.notNull
(nextChar) & 1023); |
| 1401 this.writeFourByteCharCode(char); | 1401 this.writeFourByteCharCode(char); |
| 1402 dart.notNull(i)++; | 1402 i = dart.notNull(i) + 1; |
| 1403 continue; | 1403 continue; |
| 1404 } | 1404 } |
| 1405 } | 1405 } |
| 1406 this.writeMultiByteCharCode(char); | 1406 this.writeMultiByteCharCode(char); |
| 1407 } | 1407 } |
| 1408 } | 1408 } |
| 1409 } | 1409 } |
| 1410 writeCharCode(charCode) { | 1410 writeCharCode(charCode) { |
| 1411 if (dart.notNull(charCode) <= 127) { | 1411 if (dart.notNull(charCode) <= 127) { |
| 1412 this.writeByte(charCode); | 1412 this.writeByte(charCode); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1435 this.writeByte(128 | dart.notNull(charCode) >> 6 & 63); | 1435 this.writeByte(128 | dart.notNull(charCode) >> 6 & 63); |
| 1436 this.writeByte(128 | dart.notNull(charCode) & 63); | 1436 this.writeByte(128 | dart.notNull(charCode) & 63); |
| 1437 } | 1437 } |
| 1438 writeByte(byte) { | 1438 writeByte(byte) { |
| 1439 dart.assert(dart.notNull(byte) <= 255); | 1439 dart.assert(dart.notNull(byte) <= 255); |
| 1440 if (this.index === this.buffer.length) { | 1440 if (this.index === this.buffer.length) { |
| 1441 dart.dinvokef(this.addChunk, this.buffer, 0, this.index); | 1441 dart.dinvokef(this.addChunk, this.buffer, 0, this.index); |
| 1442 this.buffer = new typed_data.Uint8List(this.bufferSize); | 1442 this.buffer = new typed_data.Uint8List(this.bufferSize); |
| 1443 this.index = 0; | 1443 this.index = 0; |
| 1444 } | 1444 } |
| 1445 this.buffer.set(dart.notNull(this.index)++, byte); | 1445 this.buffer.set((($tmp) => this.index = dart.notNull($tmp) + 1, $tmp).bind
(this)(this.index), byte); |
| 1446 } | 1446 } |
| 1447 } | 1447 } |
| 1448 class _JsonUtf8StringifierPretty extends dart.mixin(_JsonUtf8Stringifier, _Jso
nPrettyPrintMixin) { | 1448 class _JsonUtf8StringifierPretty extends dart.mixin(_JsonUtf8Stringifier, _Jso
nPrettyPrintMixin) { |
| 1449 _JsonUtf8StringifierPretty(toEncodableFunction, indent, bufferSize, addChunk
) { | 1449 _JsonUtf8StringifierPretty(toEncodableFunction, indent, bufferSize, addChunk
) { |
| 1450 this.indent = indent; | 1450 this.indent = indent; |
| 1451 super._JsonUtf8Stringifier(toEncodableFunction, dart.as(bufferSize, core.i
nt), dart.as(addChunk, core.Function)); | 1451 super._JsonUtf8Stringifier(toEncodableFunction, dart.as(bufferSize, core.i
nt), dart.as(addChunk, core.Function)); |
| 1452 } | 1452 } |
| 1453 writeIndentation(count) { | 1453 writeIndentation(count) { |
| 1454 let indent = this.indent; | 1454 let indent = this.indent; |
| 1455 let indentLength = indent.length; | 1455 let indentLength = indent.length; |
| 1456 if (indentLength === 1) { | 1456 if (indentLength === 1) { |
| 1457 let char = indent.get(0); | 1457 let char = indent.get(0); |
| 1458 while (dart.notNull(count) > 0) { | 1458 while (dart.notNull(count) > 0) { |
| 1459 this.writeByte(char); | 1459 this.writeByte(char); |
| 1460 count = 1; | 1460 count = 1; |
| 1461 } | 1461 } |
| 1462 return; | 1462 return; |
| 1463 } | 1463 } |
| 1464 while (dart.notNull(count) > 0) { | 1464 while (dart.notNull(count) > 0) { |
| 1465 dart.notNull(count)--; | 1465 count = dart.notNull(count) - 1; |
| 1466 let end = dart.notNull(this.index) + dart.notNull(indentLength); | 1466 let end = dart.notNull(this.index) + dart.notNull(indentLength); |
| 1467 if (dart.notNull(end) <= dart.notNull(this.buffer.length)) { | 1467 if (dart.notNull(end) <= dart.notNull(this.buffer.length)) { |
| 1468 this.buffer.setRange(this.index, end, indent); | 1468 this.buffer.setRange(this.index, end, indent); |
| 1469 this.index = end; | 1469 this.index = end; |
| 1470 } else { | 1470 } else { |
| 1471 for (let i = 0; dart.notNull(i) < dart.notNull(indentLength); dart.not
Null(i)++) { | 1471 for (let i = 0; dart.notNull(i) < dart.notNull(indentLength); i = dart
.notNull(i) + 1) { |
| 1472 this.writeByte(indent.get(i)); | 1472 this.writeByte(indent.get(i)); |
| 1473 } | 1473 } |
| 1474 } | 1474 } |
| 1475 } | 1475 } |
| 1476 } | 1476 } |
| 1477 } | 1477 } |
| 1478 let LATIN1 = new Latin1Codec(); | 1478 let LATIN1 = new Latin1Codec(); |
| 1479 let _LATIN1_MASK = 255; | 1479 let _LATIN1_MASK = 255; |
| 1480 class Latin1Codec extends Encoding { | 1480 class Latin1Codec extends Encoding { |
| 1481 Latin1Codec(opt$) { | 1481 Latin1Codec(opt$) { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1537 add(source) { | 1537 add(source) { |
| 1538 this.addSlice(source, 0, source.length, false); | 1538 this.addSlice(source, 0, source.length, false); |
| 1539 } | 1539 } |
| 1540 [_addSliceToSink](source, start, end, isLast) { | 1540 [_addSliceToSink](source, start, end, isLast) { |
| 1541 this[_sink].add(new core.String.fromCharCodes(source, start, end)); | 1541 this[_sink].add(new core.String.fromCharCodes(source, start, end)); |
| 1542 if (isLast) | 1542 if (isLast) |
| 1543 this.close(); | 1543 this.close(); |
| 1544 } | 1544 } |
| 1545 addSlice(source, start, end, isLast) { | 1545 addSlice(source, start, end, isLast) { |
| 1546 core.RangeError.checkValidRange(start, end, source.length); | 1546 core.RangeError.checkValidRange(start, end, source.length); |
| 1547 for (let i = start; dart.notNull(i) < dart.notNull(end); dart.notNull(i)++
) { | 1547 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { |
| 1548 let char = source.get(i); | 1548 let char = source.get(i); |
| 1549 if (dart.notNull(char) > dart.notNull(_LATIN1_MASK) || dart.notNull(char
) < 0) { | 1549 if (dart.notNull(char) > dart.notNull(_LATIN1_MASK) || dart.notNull(char
) < 0) { |
| 1550 throw new core.FormatException("Source contains non-Latin-1 characters
."); | 1550 throw new core.FormatException("Source contains non-Latin-1 characters
."); |
| 1551 } | 1551 } |
| 1552 } | 1552 } |
| 1553 if (dart.notNull(start) < dart.notNull(end)) { | 1553 if (dart.notNull(start) < dart.notNull(end)) { |
| 1554 this[_addSliceToSink](source, start, end, isLast); | 1554 this[_addSliceToSink](source, start, end, isLast); |
| 1555 } | 1555 } |
| 1556 if (isLast) { | 1556 if (isLast) { |
| 1557 this.close(); | 1557 this.close(); |
| 1558 } | 1558 } |
| 1559 } | 1559 } |
| 1560 } | 1560 } |
| 1561 class _Latin1AllowInvalidDecoderSink extends _Latin1DecoderSink { | 1561 class _Latin1AllowInvalidDecoderSink extends _Latin1DecoderSink { |
| 1562 _Latin1AllowInvalidDecoderSink(sink) { | 1562 _Latin1AllowInvalidDecoderSink(sink) { |
| 1563 super._Latin1DecoderSink(sink); | 1563 super._Latin1DecoderSink(sink); |
| 1564 } | 1564 } |
| 1565 addSlice(source, start, end, isLast) { | 1565 addSlice(source, start, end, isLast) { |
| 1566 core.RangeError.checkValidRange(start, end, source.length); | 1566 core.RangeError.checkValidRange(start, end, source.length); |
| 1567 for (let i = start; dart.notNull(i) < dart.notNull(end); dart.notNull(i)++
) { | 1567 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { |
| 1568 let char = source.get(i); | 1568 let char = source.get(i); |
| 1569 if (dart.notNull(char) > dart.notNull(_LATIN1_MASK) || dart.notNull(char
) < 0) { | 1569 if (dart.notNull(char) > dart.notNull(_LATIN1_MASK) || dart.notNull(char
) < 0) { |
| 1570 if (dart.notNull(i) > dart.notNull(start)) | 1570 if (dart.notNull(i) > dart.notNull(start)) |
| 1571 this[_addSliceToSink](source, start, i, false); | 1571 this[_addSliceToSink](source, start, i, false); |
| 1572 this[_addSliceToSink](dart.as(/* Unimplemented const */new List.from([
65533]), core.List$(core.int)), 0, 1, false); | 1572 this[_addSliceToSink](dart.as(/* Unimplemented const */new List.from([
65533]), core.List$(core.int)), 0, 1, false); |
| 1573 start = dart.notNull(i) + 1; | 1573 start = dart.notNull(i) + 1; |
| 1574 } | 1574 } |
| 1575 } | 1575 } |
| 1576 if (dart.notNull(start) < dart.notNull(end)) { | 1576 if (dart.notNull(start) < dart.notNull(end)) { |
| 1577 this[_addSliceToSink](source, start, end, isLast); | 1577 this[_addSliceToSink](source, start, end, isLast); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1633 skip = 2; | 1633 skip = 2; |
| 1634 } | 1634 } |
| 1635 } else if (!dart.notNull(isLast)) { | 1635 } else if (!dart.notNull(isLast)) { |
| 1636 return chunk.substring(start, end); | 1636 return chunk.substring(start, end); |
| 1637 } | 1637 } |
| 1638 } | 1638 } |
| 1639 if (dart.notNull(skip) > 0) { | 1639 if (dart.notNull(skip) > 0) { |
| 1640 adder(chunk.substring(start, pos)); | 1640 adder(chunk.substring(start, pos)); |
| 1641 start = pos = dart.notNull(pos) + dart.notNull(skip); | 1641 start = pos = dart.notNull(pos) + dart.notNull(skip); |
| 1642 } else { | 1642 } else { |
| 1643 dart.notNull(pos)++; | 1643 pos = dart.notNull(pos) + 1; |
| 1644 } | 1644 } |
| 1645 } | 1645 } |
| 1646 if (pos !== start) { | 1646 if (pos !== start) { |
| 1647 let carry = chunk.substring(start, pos); | 1647 let carry = chunk.substring(start, pos); |
| 1648 if (isLast) { | 1648 if (isLast) { |
| 1649 adder(carry); | 1649 adder(carry); |
| 1650 } else { | 1650 } else { |
| 1651 return carry; | 1651 return carry; |
| 1652 } | 1652 } |
| 1653 } | 1653 } |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1774 } | 1774 } |
| 1775 } | 1775 } |
| 1776 class _StringSinkConversionSink extends StringConversionSinkBase { | 1776 class _StringSinkConversionSink extends StringConversionSinkBase { |
| 1777 _StringSinkConversionSink($_stringSink) { | 1777 _StringSinkConversionSink($_stringSink) { |
| 1778 this[_stringSink] = $_stringSink; | 1778 this[_stringSink] = $_stringSink; |
| 1779 super.StringConversionSinkBase(); | 1779 super.StringConversionSinkBase(); |
| 1780 } | 1780 } |
| 1781 close() {} | 1781 close() {} |
| 1782 addSlice(str, start, end, isLast) { | 1782 addSlice(str, start, end, isLast) { |
| 1783 if (start !== 0 || end !== str.length) { | 1783 if (start !== 0 || end !== str.length) { |
| 1784 for (let i = start; dart.notNull(i) < dart.notNull(end); dart.notNull(i)
++) { | 1784 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNul
l(i) + 1) { |
| 1785 this[_stringSink].writeCharCode(str.codeUnitAt(i)); | 1785 this[_stringSink].writeCharCode(str.codeUnitAt(i)); |
| 1786 } | 1786 } |
| 1787 } else { | 1787 } else { |
| 1788 this[_stringSink].write(str); | 1788 this[_stringSink].write(str); |
| 1789 } | 1789 } |
| 1790 if (isLast) | 1790 if (isLast) |
| 1791 this.close(); | 1791 this.close(); |
| 1792 } | 1792 } |
| 1793 add(str) { | 1793 add(str) { |
| 1794 return this[_stringSink].write(str); | 1794 return this[_stringSink].write(str); |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1971 this[_bufferIndex] = 0; | 1971 this[_bufferIndex] = 0; |
| 1972 } | 1972 } |
| 1973 static [_createBuffer](size) { | 1973 static [_createBuffer](size) { |
| 1974 return new typed_data.Uint8List(size); | 1974 return new typed_data.Uint8List(size); |
| 1975 } | 1975 } |
| 1976 [_writeSurrogate](leadingSurrogate, nextCodeUnit) { | 1976 [_writeSurrogate](leadingSurrogate, nextCodeUnit) { |
| 1977 if (_isTailSurrogate(nextCodeUnit)) { | 1977 if (_isTailSurrogate(nextCodeUnit)) { |
| 1978 let rune = _combineSurrogatePair(leadingSurrogate, nextCodeUnit); | 1978 let rune = _combineSurrogatePair(leadingSurrogate, nextCodeUnit); |
| 1979 dart.assert(dart.notNull(rune) > dart.notNull(_THREE_BYTE_LIMIT)); | 1979 dart.assert(dart.notNull(rune) > dart.notNull(_THREE_BYTE_LIMIT)); |
| 1980 dart.assert(dart.notNull(rune) <= dart.notNull(_FOUR_BYTE_LIMIT)); | 1980 dart.assert(dart.notNull(rune) <= dart.notNull(_FOUR_BYTE_LIMIT)); |
| 1981 this[_buffer].set(dart.notNull(this[_bufferIndex])++, 240 | dart.notNull
(rune) >> 18); | 1981 this[_buffer].set((($tmp) => this[_bufferIndex] = dart.notNull($tmp) + 1
, $tmp).bind(this)(this[_bufferIndex]), 240 | dart.notNull(rune) >> 18); |
| 1982 this[_buffer].set(dart.notNull(this[_bufferIndex])++, 128 | dart.notNull
(rune) >> 12 & 63); | 1982 this[_buffer].set((($tmp) => this[_bufferIndex] = dart.notNull($tmp) + 1
, $tmp).bind(this)(this[_bufferIndex]), 128 | dart.notNull(rune) >> 12 & 63); |
| 1983 this[_buffer].set(dart.notNull(this[_bufferIndex])++, 128 | dart.notNull
(rune) >> 6 & 63); | 1983 this[_buffer].set((($tmp) => this[_bufferIndex] = dart.notNull($tmp) + 1
, $tmp).bind(this)(this[_bufferIndex]), 128 | dart.notNull(rune) >> 6 & 63); |
| 1984 this[_buffer].set(dart.notNull(this[_bufferIndex])++, 128 | dart.notNull
(rune) & 63); | 1984 this[_buffer].set((($tmp) => this[_bufferIndex] = dart.notNull($tmp) + 1
, $tmp).bind(this)(this[_bufferIndex]), 128 | dart.notNull(rune) & 63); |
| 1985 return true; | 1985 return true; |
| 1986 } else { | 1986 } else { |
| 1987 this[_buffer].set(dart.notNull(this[_bufferIndex])++, 224 | dart.notNull
(leadingSurrogate) >> 12); | 1987 this[_buffer].set((($tmp) => this[_bufferIndex] = dart.notNull($tmp) + 1
, $tmp).bind(this)(this[_bufferIndex]), 224 | dart.notNull(leadingSurrogate) >>
12); |
| 1988 this[_buffer].set(dart.notNull(this[_bufferIndex])++, 128 | dart.notNull
(leadingSurrogate) >> 6 & 63); | 1988 this[_buffer].set((($tmp) => this[_bufferIndex] = dart.notNull($tmp) + 1
, $tmp).bind(this)(this[_bufferIndex]), 128 | dart.notNull(leadingSurrogate) >>
6 & 63); |
| 1989 this[_buffer].set(dart.notNull(this[_bufferIndex])++, 128 | dart.notNull
(leadingSurrogate) & 63); | 1989 this[_buffer].set((($tmp) => this[_bufferIndex] = dart.notNull($tmp) + 1
, $tmp).bind(this)(this[_bufferIndex]), 128 | dart.notNull(leadingSurrogate) & 6
3); |
| 1990 return false; | 1990 return false; |
| 1991 } | 1991 } |
| 1992 } | 1992 } |
| 1993 [_fillBuffer](str, start, end) { | 1993 [_fillBuffer](str, start, end) { |
| 1994 if (start !== end && dart.notNull(_isLeadSurrogate(str.codeUnitAt(dart.not
Null(end) - 1)))) { | 1994 if (start !== end && dart.notNull(_isLeadSurrogate(str.codeUnitAt(dart.not
Null(end) - 1)))) { |
| 1995 dart.notNull(end)--; | 1995 end = dart.notNull(end) - 1; |
| 1996 } | 1996 } |
| 1997 let stringIndex = null; | 1997 let stringIndex = null; |
| 1998 for (stringIndex = start; dart.notNull(stringIndex) < dart.notNull(end); d
art.notNull(stringIndex)++) { | 1998 for (stringIndex = start; dart.notNull(stringIndex) < dart.notNull(end); s
tringIndex = dart.notNull(stringIndex) + 1) { |
| 1999 let codeUnit = str.codeUnitAt(stringIndex); | 1999 let codeUnit = str.codeUnitAt(stringIndex); |
| 2000 if (dart.notNull(codeUnit) <= dart.notNull(_ONE_BYTE_LIMIT)) { | 2000 if (dart.notNull(codeUnit) <= dart.notNull(_ONE_BYTE_LIMIT)) { |
| 2001 if (dart.notNull(this[_bufferIndex]) >= dart.notNull(this[_buffer].len
gth)) | 2001 if (dart.notNull(this[_bufferIndex]) >= dart.notNull(this[_buffer].len
gth)) |
| 2002 break; | 2002 break; |
| 2003 this[_buffer].set(dart.notNull(this[_bufferIndex])++, codeUnit); | 2003 this[_buffer].set((($tmp) => this[_bufferIndex] = dart.notNull($tmp) +
1, $tmp).bind(this)(this[_bufferIndex]), codeUnit); |
| 2004 } else if (_isLeadSurrogate(codeUnit)) { | 2004 } else if (_isLeadSurrogate(codeUnit)) { |
| 2005 if (dart.notNull(this[_bufferIndex]) + 3 >= dart.notNull(this[_buffer]
.length)) | 2005 if (dart.notNull(this[_bufferIndex]) + 3 >= dart.notNull(this[_buffer]
.length)) |
| 2006 break; | 2006 break; |
| 2007 let nextCodeUnit = str.codeUnitAt(dart.notNull(stringIndex) + 1); | 2007 let nextCodeUnit = str.codeUnitAt(dart.notNull(stringIndex) + 1); |
| 2008 let wasCombined = this[_writeSurrogate](codeUnit, nextCodeUnit); | 2008 let wasCombined = this[_writeSurrogate](codeUnit, nextCodeUnit); |
| 2009 if (wasCombined) | 2009 if (wasCombined) |
| 2010 dart.notNull(stringIndex)++; | 2010 stringIndex = dart.notNull(stringIndex) + 1; |
| 2011 } else { | 2011 } else { |
| 2012 let rune = codeUnit; | 2012 let rune = codeUnit; |
| 2013 if (dart.notNull(rune) <= dart.notNull(_TWO_BYTE_LIMIT)) { | 2013 if (dart.notNull(rune) <= dart.notNull(_TWO_BYTE_LIMIT)) { |
| 2014 if (dart.notNull(this[_bufferIndex]) + 1 >= dart.notNull(this[_buffe
r].length)) | 2014 if (dart.notNull(this[_bufferIndex]) + 1 >= dart.notNull(this[_buffe
r].length)) |
| 2015 break; | 2015 break; |
| 2016 this[_buffer].set(dart.notNull(this[_bufferIndex])++, 192 | dart.not
Null(rune) >> 6); | 2016 this[_buffer].set((($tmp) => this[_bufferIndex] = dart.notNull($tmp)
+ 1, $tmp).bind(this)(this[_bufferIndex]), 192 | dart.notNull(rune) >> 6); |
| 2017 this[_buffer].set(dart.notNull(this[_bufferIndex])++, 128 | dart.not
Null(rune) & 63); | 2017 this[_buffer].set((($tmp) => this[_bufferIndex] = dart.notNull($tmp)
+ 1, $tmp).bind(this)(this[_bufferIndex]), 128 | dart.notNull(rune) & 63); |
| 2018 } else { | 2018 } else { |
| 2019 dart.assert(dart.notNull(rune) <= dart.notNull(_THREE_BYTE_LIMIT)); | 2019 dart.assert(dart.notNull(rune) <= dart.notNull(_THREE_BYTE_LIMIT)); |
| 2020 if (dart.notNull(this[_bufferIndex]) + 2 >= dart.notNull(this[_buffe
r].length)) | 2020 if (dart.notNull(this[_bufferIndex]) + 2 >= dart.notNull(this[_buffe
r].length)) |
| 2021 break; | 2021 break; |
| 2022 this[_buffer].set(dart.notNull(this[_bufferIndex])++, 224 | dart.not
Null(rune) >> 12); | 2022 this[_buffer].set((($tmp) => this[_bufferIndex] = dart.notNull($tmp)
+ 1, $tmp).bind(this)(this[_bufferIndex]), 224 | dart.notNull(rune) >> 12); |
| 2023 this[_buffer].set(dart.notNull(this[_bufferIndex])++, 128 | dart.not
Null(rune) >> 6 & 63); | 2023 this[_buffer].set((($tmp) => this[_bufferIndex] = dart.notNull($tmp)
+ 1, $tmp).bind(this)(this[_bufferIndex]), 128 | dart.notNull(rune) >> 6 & 63); |
| 2024 this[_buffer].set(dart.notNull(this[_bufferIndex])++, 128 | dart.not
Null(rune) & 63); | 2024 this[_buffer].set((($tmp) => this[_bufferIndex] = dart.notNull($tmp)
+ 1, $tmp).bind(this)(this[_bufferIndex]), 128 | dart.notNull(rune) & 63); |
| 2025 } | 2025 } |
| 2026 } | 2026 } |
| 2027 } | 2027 } |
| 2028 return stringIndex; | 2028 return stringIndex; |
| 2029 } | 2029 } |
| 2030 } | 2030 } |
| 2031 dart.defineNamedConstructor(_Utf8Encoder, 'withBufferSize'); | 2031 dart.defineNamedConstructor(_Utf8Encoder, 'withBufferSize'); |
| 2032 _Utf8Encoder._DEFAULT_BYTE_BUFFER_SIZE = 1024; | 2032 _Utf8Encoder._DEFAULT_BYTE_BUFFER_SIZE = 1024; |
| 2033 class _Utf8EncoderSink extends dart.mixin(_Utf8Encoder, StringConversionSinkMi
xin) { | 2033 class _Utf8EncoderSink extends dart.mixin(_Utf8Encoder, StringConversionSinkMi
xin) { |
| 2034 _Utf8EncoderSink($_sink) { | 2034 _Utf8EncoderSink($_sink) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 2050 if (this[_carry] !== 0) { | 2050 if (this[_carry] !== 0) { |
| 2051 let nextCodeUnit = 0; | 2051 let nextCodeUnit = 0; |
| 2052 if (start !== end) { | 2052 if (start !== end) { |
| 2053 nextCodeUnit = str.codeUnitAt(start); | 2053 nextCodeUnit = str.codeUnitAt(start); |
| 2054 } else { | 2054 } else { |
| 2055 dart.assert(isLast); | 2055 dart.assert(isLast); |
| 2056 } | 2056 } |
| 2057 let wasCombined = this[_writeSurrogate](this[_carry], nextCodeUnit); | 2057 let wasCombined = this[_writeSurrogate](this[_carry], nextCodeUnit); |
| 2058 dart.assert(!dart.notNull(wasCombined) || start !== end); | 2058 dart.assert(!dart.notNull(wasCombined) || start !== end); |
| 2059 if (wasCombined) | 2059 if (wasCombined) |
| 2060 dart.notNull(start)++; | 2060 start = dart.notNull(start) + 1; |
| 2061 this[_carry] = 0; | 2061 this[_carry] = 0; |
| 2062 } | 2062 } |
| 2063 do { | 2063 do { |
| 2064 start = this[_fillBuffer](str, start, end); | 2064 start = this[_fillBuffer](str, start, end); |
| 2065 let isLastSlice = dart.notNull(isLast) && start === end; | 2065 let isLastSlice = dart.notNull(isLast) && start === end; |
| 2066 if (start === dart.notNull(end) - 1 && dart.notNull(_isLeadSurrogate(str
.codeUnitAt(start)))) { | 2066 if (start === dart.notNull(end) - 1 && dart.notNull(_isLeadSurrogate(str
.codeUnitAt(start)))) { |
| 2067 if (dart.notNull(isLast) && dart.notNull(this[_bufferIndex]) < dart.no
tNull(this[_buffer].length) - 3) { | 2067 if (dart.notNull(isLast) && dart.notNull(this[_bufferIndex]) < dart.no
tNull(this[_buffer].length) - 3) { |
| 2068 let hasBeenCombined = this[_writeSurrogate](str.codeUnitAt(start), 0
); | 2068 let hasBeenCombined = this[_writeSurrogate](str.codeUnitAt(start), 0
); |
| 2069 dart.assert(!dart.notNull(hasBeenCombined)); | 2069 dart.assert(!dart.notNull(hasBeenCombined)); |
| 2070 } else { | 2070 } else { |
| 2071 this[_carry] = str.codeUnitAt(start); | 2071 this[_carry] = str.codeUnitAt(start); |
| 2072 } | 2072 } |
| 2073 dart.notNull(start)++; | 2073 start = dart.notNull(start) + 1; |
| 2074 } | 2074 } |
| 2075 this[_sink].addSlice(this[_buffer], 0, this[_bufferIndex], isLastSlice); | 2075 this[_sink].addSlice(this[_buffer], 0, this[_bufferIndex], isLastSlice); |
| 2076 this[_bufferIndex] = 0; | 2076 this[_bufferIndex] = 0; |
| 2077 } while (dart.notNull(start) < dart.notNull(end)); | 2077 } while (dart.notNull(start) < dart.notNull(end)); |
| 2078 if (isLast) | 2078 if (isLast) |
| 2079 this.close(); | 2079 this.close(); |
| 2080 } | 2080 } |
| 2081 } | 2081 } |
| 2082 class Utf8Decoder extends Converter$(core.List$(core.int), core.String) { | 2082 class Utf8Decoder extends Converter$(core.List$(core.int), core.String) { |
| 2083 Utf8Decoder(opt$) { | 2083 Utf8Decoder(opt$) { |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2175 let value = this[_value]; | 2175 let value = this[_value]; |
| 2176 let expectedUnits = this[_expectedUnits]; | 2176 let expectedUnits = this[_expectedUnits]; |
| 2177 let extraUnits = this[_extraUnits]; | 2177 let extraUnits = this[_extraUnits]; |
| 2178 this[_value] = 0; | 2178 this[_value] = 0; |
| 2179 this[_expectedUnits] = 0; | 2179 this[_expectedUnits] = 0; |
| 2180 this[_extraUnits] = 0; | 2180 this[_extraUnits] = 0; |
| 2181 // Function scanOneByteCharacters: (dynamic, int) → int | 2181 // Function scanOneByteCharacters: (dynamic, int) → int |
| 2182 function scanOneByteCharacters(units, from) { | 2182 function scanOneByteCharacters(units, from) { |
| 2183 let to = endIndex; | 2183 let to = endIndex; |
| 2184 let mask = _ONE_BYTE_LIMIT; | 2184 let mask = _ONE_BYTE_LIMIT; |
| 2185 for (let i = from; dart.notNull(i) < dart.notNull(to); dart.notNull(i)++
) { | 2185 for (let i = from; dart.notNull(i) < dart.notNull(to); i = dart.notNull(
i) + 1) { |
| 2186 let unit = dart.dindex(units, i); | 2186 let unit = dart.dindex(units, i); |
| 2187 if (!dart.equals(dart.dbinary(unit, '&', mask), unit)) | 2187 if (!dart.equals(dart.dbinary(unit, '&', mask), unit)) |
| 2188 return dart.notNull(i) - dart.notNull(from); | 2188 return dart.notNull(i) - dart.notNull(from); |
| 2189 } | 2189 } |
| 2190 return dart.notNull(to) - dart.notNull(from); | 2190 return dart.notNull(to) - dart.notNull(from); |
| 2191 } | 2191 } |
| 2192 // Function addSingleBytes: (int, int) → void | 2192 // Function addSingleBytes: (int, int) → void |
| 2193 function addSingleBytes(from, to) { | 2193 function addSingleBytes(from, to) { |
| 2194 dart.assert(dart.notNull(from) >= dart.notNull(startIndex) && dart.notNu
ll(from) <= dart.notNull(endIndex)); | 2194 dart.assert(dart.notNull(from) >= dart.notNull(startIndex) && dart.notNu
ll(from) <= dart.notNull(endIndex)); |
| 2195 dart.assert(dart.notNull(to) >= dart.notNull(startIndex) && dart.notNull
(to) <= dart.notNull(endIndex)); | 2195 dart.assert(dart.notNull(to) >= dart.notNull(startIndex) && dart.notNull
(to) <= dart.notNull(endIndex)); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 2208 if ((dart.notNull(unit) & 192) !== 128) { | 2208 if ((dart.notNull(unit) & 192) !== 128) { |
| 2209 expectedUnits = 0; | 2209 expectedUnits = 0; |
| 2210 if (!dart.notNull(this[_allowMalformed])) { | 2210 if (!dart.notNull(this[_allowMalformed])) { |
| 2211 throw new core.FormatException(`Bad UTF-8 encoding 0x${unit.
toRadixString(16)}`); | 2211 throw new core.FormatException(`Bad UTF-8 encoding 0x${unit.
toRadixString(16)}`); |
| 2212 } | 2212 } |
| 2213 this[_isFirstCharacter] = false; | 2213 this[_isFirstCharacter] = false; |
| 2214 this[_stringSink].writeCharCode(UNICODE_REPLACEMENT_CHARACTER_
RUNE); | 2214 this[_stringSink].writeCharCode(UNICODE_REPLACEMENT_CHARACTER_
RUNE); |
| 2215 break multibyte; | 2215 break multibyte; |
| 2216 } else { | 2216 } else { |
| 2217 value = dart.notNull(value) << 6 | dart.notNull(unit) & 63; | 2217 value = dart.notNull(value) << 6 | dart.notNull(unit) & 63; |
| 2218 dart.notNull(expectedUnits)--; | 2218 expectedUnits = dart.notNull(expectedUnits) - 1; |
| 2219 dart.notNull(i)++; | 2219 i = dart.notNull(i) + 1; |
| 2220 } | 2220 } |
| 2221 } while (dart.notNull(expectedUnits) > 0); | 2221 } while (dart.notNull(expectedUnits) > 0); |
| 2222 if (dart.notNull(value) <= dart.notNull(_LIMITS.get(dart.notNull(e
xtraUnits) - 1))) { | 2222 if (dart.notNull(value) <= dart.notNull(_LIMITS.get(dart.notNull(e
xtraUnits) - 1))) { |
| 2223 if (!dart.notNull(this[_allowMalformed])) { | 2223 if (!dart.notNull(this[_allowMalformed])) { |
| 2224 throw new core.FormatException(`Overlong encoding of 0x${value
.toRadixString(16)}`); | 2224 throw new core.FormatException(`Overlong encoding of 0x${value
.toRadixString(16)}`); |
| 2225 } | 2225 } |
| 2226 expectedUnits = extraUnits = 0; | 2226 expectedUnits = extraUnits = 0; |
| 2227 value = UNICODE_REPLACEMENT_CHARACTER_RUNE; | 2227 value = UNICODE_REPLACEMENT_CHARACTER_RUNE; |
| 2228 } | 2228 } |
| 2229 if (dart.notNull(value) > dart.notNull(_FOUR_BYTE_LIMIT)) { | 2229 if (dart.notNull(value) > dart.notNull(_FOUR_BYTE_LIMIT)) { |
| 2230 if (!dart.notNull(this[_allowMalformed])) { | 2230 if (!dart.notNull(this[_allowMalformed])) { |
| 2231 throw new core.FormatException("Character outside valid Unicod
e range: " + `0x${value.toRadixString(16)}`); | 2231 throw new core.FormatException("Character outside valid Unicod
e range: " + `0x${value.toRadixString(16)}`); |
| 2232 } | 2232 } |
| 2233 value = UNICODE_REPLACEMENT_CHARACTER_RUNE; | 2233 value = UNICODE_REPLACEMENT_CHARACTER_RUNE; |
| 2234 } | 2234 } |
| 2235 if (!dart.notNull(this[_isFirstCharacter]) || value !== UNICODE_BO
M_CHARACTER_RUNE) { | 2235 if (!dart.notNull(this[_isFirstCharacter]) || value !== UNICODE_BO
M_CHARACTER_RUNE) { |
| 2236 this[_stringSink].writeCharCode(value); | 2236 this[_stringSink].writeCharCode(value); |
| 2237 } | 2237 } |
| 2238 this[_isFirstCharacter] = false; | 2238 this[_isFirstCharacter] = false; |
| 2239 } | 2239 } |
| 2240 while (dart.notNull(i) < dart.notNull(endIndex)) { | 2240 while (dart.notNull(i) < dart.notNull(endIndex)) { |
| 2241 let oneBytes = scanOneByteCharacters(codeUnits, i); | 2241 let oneBytes = scanOneByteCharacters(codeUnits, i); |
| 2242 if (dart.notNull(oneBytes) > 0) { | 2242 if (dart.notNull(oneBytes) > 0) { |
| 2243 this[_isFirstCharacter] = false; | 2243 this[_isFirstCharacter] = false; |
| 2244 addSingleBytes(i, dart.notNull(i) + dart.notNull(oneBytes)); | 2244 addSingleBytes(i, dart.notNull(i) + dart.notNull(oneBytes)); |
| 2245 i = oneBytes; | 2245 i = oneBytes; |
| 2246 if (i === endIndex) | 2246 if (i === endIndex) |
| 2247 break; | 2247 break; |
| 2248 } | 2248 } |
| 2249 let unit = codeUnits.get(dart.notNull(i)++); | 2249 let unit = codeUnits.get((($tmp) => i = dart.notNull($tmp) + 1, $tmp
)(i)); |
| 2250 if (dart.notNull(unit) < 0) { | 2250 if (dart.notNull(unit) < 0) { |
| 2251 if (!dart.notNull(this[_allowMalformed])) { | 2251 if (!dart.notNull(this[_allowMalformed])) { |
| 2252 throw new core.FormatException(`Negative UTF-8 code unit: -0x${(
-dart.notNull(unit)).toRadixString(16)}`); | 2252 throw new core.FormatException(`Negative UTF-8 code unit: -0x${(
-dart.notNull(unit)).toRadixString(16)}`); |
| 2253 } | 2253 } |
| 2254 this[_stringSink].writeCharCode(UNICODE_REPLACEMENT_CHARACTER_RUNE
); | 2254 this[_stringSink].writeCharCode(UNICODE_REPLACEMENT_CHARACTER_RUNE
); |
| 2255 } else { | 2255 } else { |
| 2256 dart.assert(dart.notNull(unit) > dart.notNull(_ONE_BYTE_LIMIT)); | 2256 dart.assert(dart.notNull(unit) > dart.notNull(_ONE_BYTE_LIMIT)); |
| 2257 if ((dart.notNull(unit) & 224) === 192) { | 2257 if ((dart.notNull(unit) & 224) === 192) { |
| 2258 value = dart.notNull(unit) & 31; | 2258 value = dart.notNull(unit) & 31; |
| 2259 expectedUnits = extraUnits = 1; | 2259 expectedUnits = extraUnits = 1; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2321 exports.ClosableStringSink = ClosableStringSink; | 2321 exports.ClosableStringSink = ClosableStringSink; |
| 2322 exports.StringConversionSinkBase = StringConversionSinkBase; | 2322 exports.StringConversionSinkBase = StringConversionSinkBase; |
| 2323 exports.StringConversionSinkMixin = StringConversionSinkMixin; | 2323 exports.StringConversionSinkMixin = StringConversionSinkMixin; |
| 2324 exports.UNICODE_REPLACEMENT_CHARACTER_RUNE = UNICODE_REPLACEMENT_CHARACTER_RUN
E; | 2324 exports.UNICODE_REPLACEMENT_CHARACTER_RUNE = UNICODE_REPLACEMENT_CHARACTER_RUN
E; |
| 2325 exports.UNICODE_BOM_CHARACTER_RUNE = UNICODE_BOM_CHARACTER_RUNE; | 2325 exports.UNICODE_BOM_CHARACTER_RUNE = UNICODE_BOM_CHARACTER_RUNE; |
| 2326 exports.UTF8 = UTF8; | 2326 exports.UTF8 = UTF8; |
| 2327 exports.Utf8Codec = Utf8Codec; | 2327 exports.Utf8Codec = Utf8Codec; |
| 2328 exports.Utf8Encoder = Utf8Encoder; | 2328 exports.Utf8Encoder = Utf8Encoder; |
| 2329 exports.Utf8Decoder = Utf8Decoder; | 2329 exports.Utf8Decoder = Utf8Decoder; |
| 2330 })(convert || (convert = {})); | 2330 })(convert || (convert = {})); |
| OLD | NEW |