| 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 (dart.notNull(e == null) || dart.notNull(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; i < e.length; i++) { | 15 for (let i = 0; dart.notNull(i) < e.length; dart.notNull(i)++) { |
| 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; i < keys.length; i++) { | 24 for (let i = 0; dart.notNull(i) < dart.notNull(keys.length); dart.notNull(
i)++) { |
| 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; i < object.length; i++) { | 44 for (let i = 0; dart.notNull(i) < object.length; dart.notNull(i)++) { |
| 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 22 matching lines...) Expand all Loading... |
| 77 return result; | 77 return result; |
| 78 } | 78 } |
| 79 } | 79 } |
| 80 get length() { | 80 get length() { |
| 81 return this[_isUpgraded] ? this[_upgradedMap].length : this[_computeKeys](
).length; | 81 return this[_isUpgraded] ? this[_upgradedMap].length : this[_computeKeys](
).length; |
| 82 } | 82 } |
| 83 get isEmpty() { | 83 get isEmpty() { |
| 84 return this.length === 0; | 84 return this.length === 0; |
| 85 } | 85 } |
| 86 get isNotEmpty() { | 86 get isNotEmpty() { |
| 87 return this.length > 0; | 87 return dart.notNull(this.length) > 0; |
| 88 } | 88 } |
| 89 get keys() { | 89 get keys() { |
| 90 if (this[_isUpgraded]) | 90 if (this[_isUpgraded]) |
| 91 return this[_upgradedMap].keys; | 91 return this[_upgradedMap].keys; |
| 92 return new _JsonMapKeyIterable(this); | 92 return new _JsonMapKeyIterable(this); |
| 93 } | 93 } |
| 94 get values() { | 94 get values() { |
| 95 if (this[_isUpgraded]) | 95 if (this[_isUpgraded]) |
| 96 return this[_upgradedMap].values; | 96 return this[_upgradedMap].values; |
| 97 return new _internal.MappedIterable(this[_computeKeys](), ((each) => this.
get(each)).bind(this)); | 97 return new _internal.MappedIterable(this[_computeKeys](), ((each) => this.
get(each)).bind(this)); |
| (...skipping 14 matching lines...) Expand all 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; i < keys.length; i++) { | 122 for (let i = 0; dart.notNull(i) < dart.notNull(keys.length); dart.notNull(
i)++) { |
| 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)) |
| 133 return false; | 133 return false; |
| 134 return _hasProperty(this[_original], dart.as(key, core.String)); | 134 return _hasProperty(this[_original], dart.as(key, core.String)); |
| 135 } | 135 } |
| 136 putIfAbsent(key, ifAbsent) { | 136 putIfAbsent(key, ifAbsent) { |
| 137 if (this.containsKey(key)) | 137 if (this.containsKey(key)) |
| 138 return this.get(key); | 138 return this.get(key); |
| 139 let value = ifAbsent(); | 139 let value = ifAbsent(); |
| 140 this.set(key, value); | 140 this.set(key, value); |
| 141 return value; | 141 return value; |
| 142 } | 142 } |
| 143 remove(key) { | 143 remove(key) { |
| 144 if (dart.notNull(!dart.notNull(this[_isUpgraded])) && dart.notNull(!dart.n
otNull(this.containsKey(key)))) | 144 if (!dart.notNull(this[_isUpgraded]) && !dart.notNull(this.containsKey(key
))) |
| 145 return null; | 145 return null; |
| 146 return this[_upgrade]().remove(key); | 146 return this[_upgrade]().remove(key); |
| 147 } | 147 } |
| 148 clear() { | 148 clear() { |
| 149 if (this[_isUpgraded]) { | 149 if (this[_isUpgraded]) { |
| 150 this[_upgradedMap].clear(); | 150 this[_upgradedMap].clear(); |
| 151 } else { | 151 } else { |
| 152 if (this[_data] !== null) { | 152 if (this[_data] !== null) { |
| 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; i < keys.length; i++) { | 163 for (let i = 0; dart.notNull(i) < dart.notNull(keys.length); dart.notNull(
i)++) { |
| 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; i < keys.length; i++) { | 199 for (let i = 0; dart.notNull(i) < dart.notNull(keys.length); dart.notNull(
i)++) { |
| 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 } | 310 } |
| 311 convert(string, start, end) { | 311 convert(string, start, end) { |
| 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 = end - 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; i < length; i++) { | 322 for (let i = 0; dart.notNull(i) < dart.notNull(length); dart.notNull(i)++)
{ |
| 323 let codeUnit = string.codeUnitAt(start + i); | 323 let codeUnit = string.codeUnitAt(dart.notNull(start) + dart.notNull(i)); |
| 324 if ((codeUnit & ~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)) { |
| 333 sink = new ByteConversionSink.from(sink); | 333 sink = new ByteConversionSink.from(sink); |
| 334 } | 334 } |
| (...skipping 12 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; i < end; i++) { | 357 for (let i = start; dart.notNull(i) < dart.notNull(end); dart.notNull(i)++
) { |
| 358 let codeUnit = source.codeUnitAt(i); | 358 let codeUnit = source.codeUnitAt(i); |
| 359 if ((codeUnit & ~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 = end - start; | 385 let length = dart.notNull(end) - dart.notNull(start); |
| 386 for (let i = start; i < end; i++) { | 386 for (let i = start; dart.notNull(i) < dart.notNull(end); dart.notNull(i)++
) { |
| 387 let byte = bytes.get(i); | 387 let byte = bytes.get(i); |
| 388 if ((byte & ~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; i < end; i++) { | 399 for (let i = start; dart.notNull(i) < dart.notNull(end); dart.notNull(i)++
) { |
| 400 let value = bytes.get(i); | 400 let value = bytes.get(i); |
| 401 if ((value & ~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 } |
| 410 } | 410 } |
| 411 class AsciiDecoder extends _UnicodeSubsetDecoder { | 411 class AsciiDecoder extends _UnicodeSubsetDecoder { |
| (...skipping 22 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; i < end; i++) { | 444 for (let i = start; dart.notNull(i) < dart.notNull(end); dart.notNull(i)++
) { |
| 445 if ((source.get(i) & ~_ASCII_MASK) !== 0) { | 445 if ((dart.notNull(source.get(i)) & ~dart.notNull(_ASCII_MASK)) !== 0) { |
| 446 if (i > 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 = i + 1; | 449 start = dart.notNull(i) + 1; |
| 450 } | 450 } |
| 451 } | 451 } |
| 452 if (start < 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; i < source.length; i++) { | 468 for (let i = 0; dart.notNull(i) < dart.notNull(source.length); dart.notNul
l(i)++) { |
| 469 if ((source.get(i) & ~_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 (start < end) { | 478 if (dart.notNull(start) < dart.notNull(end)) { |
| 479 if (dart.notNull(start !== 0) || dart.notNull(end !== length)) { | 479 if (start !== 0 || end !== length) { |
| 480 source = source.sublist(start, end); | 480 source = source.sublist(start, end); |
| 481 } | 481 } |
| 482 this.add(source); | 482 this.add(source); |
| 483 } | 483 } |
| 484 if (isLast) | 484 if (isLast) |
| 485 this.close(); | 485 this.close(); |
| 486 } | 486 } |
| 487 } | 487 } |
| 488 class ByteConversionSink extends ChunkedConversionSink$(core.List$(core.int))
{ | 488 class ByteConversionSink extends ChunkedConversionSink$(core.List$(core.int))
{ |
| 489 ByteConversionSink() { | 489 ByteConversionSink() { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 let _bufferIndex = Symbol('_bufferIndex'); | 522 let _bufferIndex = Symbol('_bufferIndex'); |
| 523 let _roundToPowerOf2 = Symbol('_roundToPowerOf2'); | 523 let _roundToPowerOf2 = Symbol('_roundToPowerOf2'); |
| 524 class _ByteCallbackSink extends ByteConversionSinkBase { | 524 class _ByteCallbackSink extends ByteConversionSinkBase { |
| 525 _ByteCallbackSink(callback) { | 525 _ByteCallbackSink(callback) { |
| 526 this[_buffer] = new typed_data.Uint8List(dart.as(_INITIAL_BUFFER_SIZE, cor
e.int)); | 526 this[_buffer] = new typed_data.Uint8List(dart.as(_INITIAL_BUFFER_SIZE, cor
e.int)); |
| 527 this[_callback] = callback; | 527 this[_callback] = callback; |
| 528 this[_bufferIndex] = 0; | 528 this[_bufferIndex] = 0; |
| 529 super.ByteConversionSinkBase(); | 529 super.ByteConversionSinkBase(); |
| 530 } | 530 } |
| 531 add(chunk) { | 531 add(chunk) { |
| 532 let freeCount = this[_buffer].length - this[_bufferIndex]; | 532 let freeCount = dart.notNull(this[_buffer].length) - dart.notNull(this[_bu
fferIndex]); |
| 533 if (chunk.length > freeCount) { | 533 if (dart.notNull(chunk.length) > dart.notNull(freeCount)) { |
| 534 let oldLength = this[_buffer].length; | 534 let oldLength = this[_buffer].length; |
| 535 let newLength = _roundToPowerOf2(chunk.length + 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], this[_bufferIndex] + chunk.leng
th, 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(v > 0); | 544 dart.assert(dart.notNull(v) > 0); |
| 545 v--; | 545 dart.notNull(v)--; |
| 546 v = v >> 1; | 546 v = dart.notNull(v) >> 1; |
| 547 v = v >> 2; | 547 v = dart.notNull(v) >> 2; |
| 548 v = v >> 4; | 548 v = dart.notNull(v) >> 4; |
| 549 v = v >> 8; | 549 v = dart.notNull(v) >> 8; |
| 550 v = v >> 16; | 550 v = dart.notNull(v) >> 16; |
| 551 v++; | 551 dart.notNull(v)++; |
| 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; i < end; i++) { | 772 for (let i = start; dart.notNull(i) < dart.notNull(end); dart.notNull(i)++
) { |
| 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; i < string.length; i++) { | 964 for (let i = 0; dart.notNull(i) < dart.notNull(string.length); dart.notN
ull(i)++) { |
| 965 if (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 < chunk.length)) { | 976 if (dart.notNull(start) > 0 || dart.notNull(end) < dart.notNull(chunk.le
ngth)) { |
| 977 let length = end - start; | 977 let length = dart.notNull(end) - dart.notNull(start); |
| 978 chunk = new typed_data.Uint8List.view(chunk.buffer, chunk.offsetInByte
s + 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; i < bytes.length; i++) { | 986 for (let i = 0; dart.notNull(i) < dart.notNull(bytes.length); dart.notNull
(i)++) { |
| 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; i < bytes.length; i++) { | 990 for (let i = 0, offset = 0; dart.notNull(i) < dart.notNull(bytes.length);
dart.notNull(i)++) { |
| 991 let byteList = bytes.get(i); | 991 let byteList = bytes.get(i); |
| 992 let end = offset + 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)) { |
| 1001 byteSink = sink; | 1001 byteSink = sink; |
| 1002 } else { | 1002 } else { |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1100 } | 1100 } |
| 1101 let _seen = Symbol('_seen'); | 1101 let _seen = Symbol('_seen'); |
| 1102 let _checkCycle = Symbol('_checkCycle'); | 1102 let _checkCycle = Symbol('_checkCycle'); |
| 1103 let _removeSeen = Symbol('_removeSeen'); | 1103 let _removeSeen = Symbol('_removeSeen'); |
| 1104 class _JsonStringifier extends dart.Object { | 1104 class _JsonStringifier extends dart.Object { |
| 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 x < 10 ? 48 + x : 87 + 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; i < length; i++) { | 1115 for (let i = 0; dart.notNull(i) < dart.notNull(length); dart.notNull(i)++)
{ |
| 1116 let charCode = s.codeUnitAt(i); | 1116 let charCode = s.codeUnitAt(i); |
| 1117 if (charCode > BACKSLASH) | 1117 if (dart.notNull(charCode) > dart.notNull(BACKSLASH)) |
| 1118 continue; | 1118 continue; |
| 1119 if (charCode < 32) { | 1119 if (dart.notNull(charCode) < 32) { |
| 1120 if (i > offset) | 1120 if (dart.notNull(i) > dart.notNull(offset)) |
| 1121 this.writeStringSlice(s, offset, i); | 1121 this.writeStringSlice(s, offset, i); |
| 1122 offset = 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: |
| 1126 this.writeCharCode(CHAR_b); | 1126 this.writeCharCode(CHAR_b); |
| 1127 break; | 1127 break; |
| 1128 case TAB: | 1128 case TAB: |
| 1129 this.writeCharCode(CHAR_t); | 1129 this.writeCharCode(CHAR_t); |
| 1130 break; | 1130 break; |
| 1131 case NEWLINE: | 1131 case NEWLINE: |
| 1132 this.writeCharCode(CHAR_n); | 1132 this.writeCharCode(CHAR_n); |
| 1133 break; | 1133 break; |
| 1134 case FORM_FEED: | 1134 case FORM_FEED: |
| 1135 this.writeCharCode(CHAR_f); | 1135 this.writeCharCode(CHAR_f); |
| 1136 break; | 1136 break; |
| 1137 case CARRIAGE_RETURN: | 1137 case CARRIAGE_RETURN: |
| 1138 this.writeCharCode(CHAR_r); | 1138 this.writeCharCode(CHAR_r); |
| 1139 break; | 1139 break; |
| 1140 default: | 1140 default: |
| 1141 this.writeCharCode(CHAR_u); | 1141 this.writeCharCode(CHAR_u); |
| 1142 this.writeCharCode(CHAR_0); | 1142 this.writeCharCode(CHAR_0); |
| 1143 this.writeCharCode(CHAR_0); | 1143 this.writeCharCode(CHAR_0); |
| 1144 this.writeCharCode(hexDigit(charCode >> 4 & 15)); | 1144 this.writeCharCode(hexDigit(dart.notNull(charCode) >> 4 & 15)); |
| 1145 this.writeCharCode(hexDigit(charCode & 15)); | 1145 this.writeCharCode(hexDigit(dart.notNull(charCode) & 15)); |
| 1146 break; | 1146 break; |
| 1147 } | 1147 } |
| 1148 } else if (dart.notNull(charCode === QUOTE) || dart.notNull(charCode ===
BACKSLASH)) { | 1148 } else if (charCode === QUOTE || charCode === BACKSLASH) { |
| 1149 if (i > offset) | 1149 if (dart.notNull(i) > dart.notNull(offset)) |
| 1150 this.writeStringSlice(s, offset, i); | 1150 this.writeStringSlice(s, offset, i); |
| 1151 offset = i + 1; | 1151 offset = dart.notNull(i) + 1; |
| 1152 this.writeCharCode(BACKSLASH); | 1152 this.writeCharCode(BACKSLASH); |
| 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 (offset < 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; i < this[_seen].length; i++) { | 1163 for (let i = 0; dart.notNull(i) < dart.notNull(this[_seen].length); dart.n
otNull(i)++) { |
| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1216 this[_checkCycle](object); | 1216 this[_checkCycle](object); |
| 1217 this.writeMap(dart.as(object, core.Map$(core.String, core.Object))); | 1217 this.writeMap(dart.as(object, core.Map$(core.String, core.Object))); |
| 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 (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; i < list.length; i++) { | 1228 for (let i = 1; dart.notNull(i) < dart.notNull(list.length); dart.notNul
l(i)++) { |
| 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 this[_indentLevel]++; | 1272 dart.notNull(this[_indentLevel])++; |
| 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; i < list.length; i++) { | 1275 for (let i = 1; dart.notNull(i) < dart.notNull(list.length); dart.notNul
l(i)++) { |
| 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 this[_indentLevel]--; | 1281 dart.notNull(this[_indentLevel])--; |
| 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 this[_indentLevel]++; | 1291 dart.notNull(this[_indentLevel])++; |
| 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 this[_indentLevel]--; | 1305 dart.notNull(this[_indentLevel])--; |
| 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; i < count; i++) | 1349 for (let i = 0; dart.notNull(i) < dart.notNull(count); dart.notNull(i)++) |
| 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"))); |
| 1360 } | 1360 } |
| 1361 static stringify(object, indent, toEncodableFunction, bufferSize, addChunk)
{ | 1361 static stringify(object, indent, toEncodableFunction, bufferSize, addChunk)
{ |
| 1362 let stringifier = null; | 1362 let stringifier = null; |
| 1363 if (indent !== null) { | 1363 if (indent !== null) { |
| 1364 stringifier = new _JsonUtf8StringifierPretty(toEncodableFunction, indent
, bufferSize, addChunk); | 1364 stringifier = new _JsonUtf8StringifierPretty(toEncodableFunction, indent
, bufferSize, addChunk); |
| 1365 } else { | 1365 } else { |
| 1366 stringifier = new _JsonUtf8Stringifier(toEncodableFunction, bufferSize,
addChunk); | 1366 stringifier = new _JsonUtf8Stringifier(toEncodableFunction, bufferSize,
addChunk); |
| 1367 } | 1367 } |
| 1368 stringifier.writeObject(object); | 1368 stringifier.writeObject(object); |
| 1369 stringifier.flush(); | 1369 stringifier.flush(); |
| 1370 } | 1370 } |
| 1371 flush() { | 1371 flush() { |
| 1372 if (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; i < string.length; i++) { | 1382 for (let i = 0; dart.notNull(i) < dart.notNull(string.length); dart.notNul
l(i)++) { |
| 1383 let char = string.codeUnitAt(i); | 1383 let char = string.codeUnitAt(i); |
| 1384 dart.assert(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; i < end; i++) { | 1392 for (let i = start; dart.notNull(i) < dart.notNull(end); dart.notNull(i)++
) { |
| 1393 let char = string.codeUnitAt(i); | 1393 let char = string.codeUnitAt(i); |
| 1394 if (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 < end
)) { | 1397 if ((dart.notNull(char) & 64512) === 55296 && dart.notNull(i) + 1 < da
rt.notNull(end)) { |
| 1398 let nextChar = string.codeUnitAt(i + 1); | 1398 let nextChar = string.codeUnitAt(dart.notNull(i) + 1); |
| 1399 if ((nextChar & 64512) === 56320) { | 1399 if ((dart.notNull(nextChar) & 64512) === 56320) { |
| 1400 char = 65536 + ((char & 1023) << 10) + (nextChar & 1023); | 1400 char = 65536 + ((dart.notNull(char) & 1023) << 10) + (dart.notNull
(nextChar) & 1023); |
| 1401 this.writeFourByteCharCode(char); | 1401 this.writeFourByteCharCode(char); |
| 1402 i++; | 1402 dart.notNull(i)++; |
| 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 (charCode <= 127) { | 1411 if (dart.notNull(charCode) <= 127) { |
| 1412 this.writeByte(charCode); | 1412 this.writeByte(charCode); |
| 1413 return; | 1413 return; |
| 1414 } | 1414 } |
| 1415 this.writeMultiByteCharCode(charCode); | 1415 this.writeMultiByteCharCode(charCode); |
| 1416 } | 1416 } |
| 1417 writeMultiByteCharCode(charCode) { | 1417 writeMultiByteCharCode(charCode) { |
| 1418 if (charCode <= 2047) { | 1418 if (dart.notNull(charCode) <= 2047) { |
| 1419 this.writeByte(192 | charCode >> 6); | 1419 this.writeByte(192 | dart.notNull(charCode) >> 6); |
| 1420 this.writeByte(128 | charCode & 63); | 1420 this.writeByte(128 | dart.notNull(charCode) & 63); |
| 1421 return; | 1421 return; |
| 1422 } | 1422 } |
| 1423 if (charCode <= 65535) { | 1423 if (dart.notNull(charCode) <= 65535) { |
| 1424 this.writeByte(224 | charCode >> 12); | 1424 this.writeByte(224 | dart.notNull(charCode) >> 12); |
| 1425 this.writeByte(128 | charCode >> 6 & 63); | 1425 this.writeByte(128 | dart.notNull(charCode) >> 6 & 63); |
| 1426 this.writeByte(128 | charCode & 63); | 1426 this.writeByte(128 | dart.notNull(charCode) & 63); |
| 1427 return; | 1427 return; |
| 1428 } | 1428 } |
| 1429 this.writeFourByteCharCode(charCode); | 1429 this.writeFourByteCharCode(charCode); |
| 1430 } | 1430 } |
| 1431 writeFourByteCharCode(charCode) { | 1431 writeFourByteCharCode(charCode) { |
| 1432 dart.assert(charCode <= 1114111); | 1432 dart.assert(dart.notNull(charCode) <= 1114111); |
| 1433 this.writeByte(240 | charCode >> 18); | 1433 this.writeByte(240 | dart.notNull(charCode) >> 18); |
| 1434 this.writeByte(128 | charCode >> 12 & 63); | 1434 this.writeByte(128 | dart.notNull(charCode) >> 12 & 63); |
| 1435 this.writeByte(128 | charCode >> 6 & 63); | 1435 this.writeByte(128 | dart.notNull(charCode) >> 6 & 63); |
| 1436 this.writeByte(128 | charCode & 63); | 1436 this.writeByte(128 | dart.notNull(charCode) & 63); |
| 1437 } | 1437 } |
| 1438 writeByte(byte) { | 1438 writeByte(byte) { |
| 1439 dart.assert(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(this.index++, byte); | 1445 this.buffer.set(dart.notNull(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 (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 (count > 0) { | 1464 while (dart.notNull(count) > 0) { |
| 1465 count--; | 1465 dart.notNull(count)--; |
| 1466 let end = this.index + indentLength; | 1466 let end = dart.notNull(this.index) + dart.notNull(indentLength); |
| 1467 if (end <= 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; i < indentLength; i++) { | 1471 for (let i = 0; dart.notNull(i) < dart.notNull(indentLength); dart.not
Null(i)++) { |
| 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; i < end; i++) { | 1547 for (let i = start; dart.notNull(i) < dart.notNull(end); dart.notNull(i)++
) { |
| 1548 let char = source.get(i); | 1548 let char = source.get(i); |
| 1549 if (dart.notNull(char > _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 (start < 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; i < end; i++) { | 1567 for (let i = start; dart.notNull(i) < dart.notNull(end); dart.notNull(i)++
) { |
| 1568 let char = source.get(i); | 1568 let char = source.get(i); |
| 1569 if (dart.notNull(char > _LATIN1_MASK) || dart.notNull(char < 0)) { | 1569 if (dart.notNull(char) > dart.notNull(_LATIN1_MASK) || dart.notNull(char
) < 0) { |
| 1570 if (i > 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 = i + 1; | 1573 start = dart.notNull(i) + 1; |
| 1574 } | 1574 } |
| 1575 } | 1575 } |
| 1576 if (start < end) { | 1576 if (dart.notNull(start) < dart.notNull(end)) { |
| 1577 this[_addSliceToSink](source, start, end, isLast); | 1577 this[_addSliceToSink](source, start, end, isLast); |
| 1578 } | 1578 } |
| 1579 if (isLast) { | 1579 if (isLast) { |
| 1580 this.close(); | 1580 this.close(); |
| 1581 } | 1581 } |
| 1582 } | 1582 } |
| 1583 } | 1583 } |
| 1584 class LineSplitter extends Converter$(core.String, core.List$(core.String)) { | 1584 class LineSplitter extends Converter$(core.String, core.List$(core.String)) { |
| 1585 LineSplitter() { | 1585 LineSplitter() { |
| 1586 super.Converter(); | 1586 super.Converter(); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1614 } | 1614 } |
| 1615 this[_carry] = _addSlice(chunk, start, end, isLast, this[_sink].add); | 1615 this[_carry] = _addSlice(chunk, start, end, isLast, this[_sink].add); |
| 1616 if (isLast) | 1616 if (isLast) |
| 1617 this[_sink].close(); | 1617 this[_sink].close(); |
| 1618 } | 1618 } |
| 1619 close() { | 1619 close() { |
| 1620 this.addSlice('', 0, 0, true); | 1620 this.addSlice('', 0, 0, true); |
| 1621 } | 1621 } |
| 1622 static [_addSlice](chunk, start, end, isLast, adder) { | 1622 static [_addSlice](chunk, start, end, isLast, adder) { |
| 1623 let pos = start; | 1623 let pos = start; |
| 1624 while (pos < end) { | 1624 while (dart.notNull(pos) < dart.notNull(end)) { |
| 1625 let skip = 0; | 1625 let skip = 0; |
| 1626 let char = chunk.codeUnitAt(pos); | 1626 let char = chunk.codeUnitAt(pos); |
| 1627 if (char === _LF) { | 1627 if (char === _LF) { |
| 1628 skip = 1; | 1628 skip = 1; |
| 1629 } else if (char === _CR) { | 1629 } else if (char === _CR) { |
| 1630 skip = 1; | 1630 skip = 1; |
| 1631 if (pos + 1 < end) { | 1631 if (dart.notNull(pos) + 1 < dart.notNull(end)) { |
| 1632 if (chunk.codeUnitAt(pos + 1) === _LF) { | 1632 if (chunk.codeUnitAt(dart.notNull(pos) + 1) === _LF) { |
| 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 (skip > 0) { | 1639 if (dart.notNull(skip) > 0) { |
| 1640 adder(chunk.substring(start, pos)); | 1640 adder(chunk.substring(start, pos)); |
| 1641 start = pos = pos + skip; | 1641 start = pos = dart.notNull(pos) + dart.notNull(skip); |
| 1642 } else { | 1642 } else { |
| 1643 pos++; | 1643 dart.notNull(pos)++; |
| 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1773 return new _StringConversionSinkAsStringSinkAdapter(this); | 1773 return new _StringConversionSinkAsStringSinkAdapter(this); |
| 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 (dart.notNull(start !== 0) || dart.notNull(end !== str.length)) { | 1783 if (start !== 0 || end !== str.length) { |
| 1784 for (let i = start; i < end; i++) { | 1784 for (let i = start; dart.notNull(i) < dart.notNull(end); dart.notNull(i)
++) { |
| 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 22 matching lines...) Expand all Loading... |
| 1817 } | 1817 } |
| 1818 class _StringAdapterSink extends StringConversionSinkBase { | 1818 class _StringAdapterSink extends StringConversionSinkBase { |
| 1819 _StringAdapterSink($_sink) { | 1819 _StringAdapterSink($_sink) { |
| 1820 this[_sink] = $_sink; | 1820 this[_sink] = $_sink; |
| 1821 super.StringConversionSinkBase(); | 1821 super.StringConversionSinkBase(); |
| 1822 } | 1822 } |
| 1823 add(str) { | 1823 add(str) { |
| 1824 return this[_sink].add(str); | 1824 return this[_sink].add(str); |
| 1825 } | 1825 } |
| 1826 addSlice(str, start, end, isLast) { | 1826 addSlice(str, start, end, isLast) { |
| 1827 if (dart.notNull(start === 0) && dart.notNull(end === str.length)) { | 1827 if (start === 0 && end === str.length) { |
| 1828 this.add(str); | 1828 this.add(str); |
| 1829 } else { | 1829 } else { |
| 1830 this.add(str.substring(start, end)); | 1830 this.add(str.substring(start, end)); |
| 1831 } | 1831 } |
| 1832 if (isLast) | 1832 if (isLast) |
| 1833 this.close(); | 1833 this.close(); |
| 1834 } | 1834 } |
| 1835 close() { | 1835 close() { |
| 1836 return this[_sink].close(); | 1836 return this[_sink].close(); |
| 1837 } | 1837 } |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1926 } | 1926 } |
| 1927 convert(string, start, end) { | 1927 convert(string, start, end) { |
| 1928 if (start === void 0) | 1928 if (start === void 0) |
| 1929 start = 0; | 1929 start = 0; |
| 1930 if (end === void 0) | 1930 if (end === void 0) |
| 1931 end = null; | 1931 end = null; |
| 1932 let stringLength = string.length; | 1932 let stringLength = string.length; |
| 1933 core.RangeError.checkValidRange(start, end, stringLength); | 1933 core.RangeError.checkValidRange(start, end, stringLength); |
| 1934 if (end === null) | 1934 if (end === null) |
| 1935 end = stringLength; | 1935 end = stringLength; |
| 1936 let length = end - start; | 1936 let length = dart.notNull(end) - dart.notNull(start); |
| 1937 if (length === 0) | 1937 if (length === 0) |
| 1938 return new typed_data.Uint8List(0); | 1938 return new typed_data.Uint8List(0); |
| 1939 let encoder = new _Utf8Encoder.withBufferSize(length * 3); | 1939 let encoder = new _Utf8Encoder.withBufferSize(dart.notNull(length) * 3); |
| 1940 let endPosition = encoder._fillBuffer(string, start, end); | 1940 let endPosition = encoder._fillBuffer(string, start, end); |
| 1941 dart.assert(endPosition >= end - 1); | 1941 dart.assert(dart.notNull(endPosition) >= dart.notNull(end) - 1); |
| 1942 if (endPosition !== end) { | 1942 if (endPosition !== end) { |
| 1943 let lastCodeUnit = string.codeUnitAt(end - 1); | 1943 let lastCodeUnit = string.codeUnitAt(dart.notNull(end) - 1); |
| 1944 dart.assert(_isLeadSurrogate(lastCodeUnit)); | 1944 dart.assert(_isLeadSurrogate(lastCodeUnit)); |
| 1945 let wasCombined = encoder._writeSurrogate(lastCodeUnit, 0); | 1945 let wasCombined = encoder._writeSurrogate(lastCodeUnit, 0); |
| 1946 dart.assert(!dart.notNull(wasCombined)); | 1946 dart.assert(!dart.notNull(wasCombined)); |
| 1947 } | 1947 } |
| 1948 return encoder[_buffer].sublist(0, encoder[_bufferIndex]); | 1948 return encoder[_buffer].sublist(0, encoder[_bufferIndex]); |
| 1949 } | 1949 } |
| 1950 startChunkedConversion(sink) { | 1950 startChunkedConversion(sink) { |
| 1951 if (!dart.is(sink, ByteConversionSink)) { | 1951 if (!dart.is(sink, ByteConversionSink)) { |
| 1952 sink = new ByteConversionSink.from(sink); | 1952 sink = new ByteConversionSink.from(sink); |
| 1953 } | 1953 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1969 this[_buffer] = _createBuffer(bufferSize); | 1969 this[_buffer] = _createBuffer(bufferSize); |
| 1970 this[_carry] = 0; | 1970 this[_carry] = 0; |
| 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(rune > _THREE_BYTE_LIMIT); | 1979 dart.assert(dart.notNull(rune) > dart.notNull(_THREE_BYTE_LIMIT)); |
| 1980 dart.assert(rune <= _FOUR_BYTE_LIMIT); | 1980 dart.assert(dart.notNull(rune) <= dart.notNull(_FOUR_BYTE_LIMIT)); |
| 1981 this[_buffer].set(this[_bufferIndex]++, 240 | rune >> 18); | 1981 this[_buffer].set(dart.notNull(this[_bufferIndex])++, 240 | dart.notNull
(rune) >> 18); |
| 1982 this[_buffer].set(this[_bufferIndex]++, 128 | rune >> 12 & 63); | 1982 this[_buffer].set(dart.notNull(this[_bufferIndex])++, 128 | dart.notNull
(rune) >> 12 & 63); |
| 1983 this[_buffer].set(this[_bufferIndex]++, 128 | rune >> 6 & 63); | 1983 this[_buffer].set(dart.notNull(this[_bufferIndex])++, 128 | dart.notNull
(rune) >> 6 & 63); |
| 1984 this[_buffer].set(this[_bufferIndex]++, 128 | rune & 63); | 1984 this[_buffer].set(dart.notNull(this[_bufferIndex])++, 128 | dart.notNull
(rune) & 63); |
| 1985 return true; | 1985 return true; |
| 1986 } else { | 1986 } else { |
| 1987 this[_buffer].set(this[_bufferIndex]++, 224 | leadingSurrogate >> 12); | 1987 this[_buffer].set(dart.notNull(this[_bufferIndex])++, 224 | dart.notNull
(leadingSurrogate) >> 12); |
| 1988 this[_buffer].set(this[_bufferIndex]++, 128 | leadingSurrogate >> 6 & 63
); | 1988 this[_buffer].set(dart.notNull(this[_bufferIndex])++, 128 | dart.notNull
(leadingSurrogate) >> 6 & 63); |
| 1989 this[_buffer].set(this[_bufferIndex]++, 128 | leadingSurrogate & 63); | 1989 this[_buffer].set(dart.notNull(this[_bufferIndex])++, 128 | dart.notNull
(leadingSurrogate) & 63); |
| 1990 return false; | 1990 return false; |
| 1991 } | 1991 } |
| 1992 } | 1992 } |
| 1993 [_fillBuffer](str, start, end) { | 1993 [_fillBuffer](str, start, end) { |
| 1994 if (dart.notNull(start !== end) && dart.notNull(_isLeadSurrogate(str.codeU
nitAt(end - 1)))) { | 1994 if (start !== end && dart.notNull(_isLeadSurrogate(str.codeUnitAt(dart.not
Null(end) - 1)))) { |
| 1995 end--; | 1995 dart.notNull(end)--; |
| 1996 } | 1996 } |
| 1997 let stringIndex = null; | 1997 let stringIndex = null; |
| 1998 for (stringIndex = start; stringIndex < end; stringIndex++) { | 1998 for (stringIndex = start; dart.notNull(stringIndex) < dart.notNull(end); d
art.notNull(stringIndex)++) { |
| 1999 let codeUnit = str.codeUnitAt(stringIndex); | 1999 let codeUnit = str.codeUnitAt(stringIndex); |
| 2000 if (codeUnit <= _ONE_BYTE_LIMIT) { | 2000 if (dart.notNull(codeUnit) <= dart.notNull(_ONE_BYTE_LIMIT)) { |
| 2001 if (this[_bufferIndex] >= this[_buffer].length) | 2001 if (dart.notNull(this[_bufferIndex]) >= dart.notNull(this[_buffer].len
gth)) |
| 2002 break; | 2002 break; |
| 2003 this[_buffer].set(this[_bufferIndex]++, codeUnit); | 2003 this[_buffer].set(dart.notNull(this[_bufferIndex])++, codeUnit); |
| 2004 } else if (_isLeadSurrogate(codeUnit)) { | 2004 } else if (_isLeadSurrogate(codeUnit)) { |
| 2005 if (this[_bufferIndex] + 3 >= this[_buffer].length) | 2005 if (dart.notNull(this[_bufferIndex]) + 3 >= dart.notNull(this[_buffer]
.length)) |
| 2006 break; | 2006 break; |
| 2007 let nextCodeUnit = str.codeUnitAt(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 stringIndex++; | 2010 dart.notNull(stringIndex)++; |
| 2011 } else { | 2011 } else { |
| 2012 let rune = codeUnit; | 2012 let rune = codeUnit; |
| 2013 if (rune <= _TWO_BYTE_LIMIT) { | 2013 if (dart.notNull(rune) <= dart.notNull(_TWO_BYTE_LIMIT)) { |
| 2014 if (this[_bufferIndex] + 1 >= this[_buffer].length) | 2014 if (dart.notNull(this[_bufferIndex]) + 1 >= dart.notNull(this[_buffe
r].length)) |
| 2015 break; | 2015 break; |
| 2016 this[_buffer].set(this[_bufferIndex]++, 192 | rune >> 6); | 2016 this[_buffer].set(dart.notNull(this[_bufferIndex])++, 192 | dart.not
Null(rune) >> 6); |
| 2017 this[_buffer].set(this[_bufferIndex]++, 128 | rune & 63); | 2017 this[_buffer].set(dart.notNull(this[_bufferIndex])++, 128 | dart.not
Null(rune) & 63); |
| 2018 } else { | 2018 } else { |
| 2019 dart.assert(rune <= _THREE_BYTE_LIMIT); | 2019 dart.assert(dart.notNull(rune) <= dart.notNull(_THREE_BYTE_LIMIT)); |
| 2020 if (this[_bufferIndex] + 2 >= this[_buffer].length) | 2020 if (dart.notNull(this[_bufferIndex]) + 2 >= dart.notNull(this[_buffe
r].length)) |
| 2021 break; | 2021 break; |
| 2022 this[_buffer].set(this[_bufferIndex]++, 224 | rune >> 12); | 2022 this[_buffer].set(dart.notNull(this[_bufferIndex])++, 224 | dart.not
Null(rune) >> 12); |
| 2023 this[_buffer].set(this[_bufferIndex]++, 128 | rune >> 6 & 63); | 2023 this[_buffer].set(dart.notNull(this[_bufferIndex])++, 128 | dart.not
Null(rune) >> 6 & 63); |
| 2024 this[_buffer].set(this[_bufferIndex]++, 128 | rune & 63); | 2024 this[_buffer].set(dart.notNull(this[_bufferIndex])++, 128 | dart.not
Null(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) { |
| 2035 this[_sink] = $_sink; | 2035 this[_sink] = $_sink; |
| 2036 super._Utf8Encoder(); | 2036 super._Utf8Encoder(); |
| 2037 } | 2037 } |
| 2038 close() { | 2038 close() { |
| 2039 if (this[_carry] !== 0) { | 2039 if (this[_carry] !== 0) { |
| 2040 this.addSlice("", 0, 0, true); | 2040 this.addSlice("", 0, 0, true); |
| 2041 return; | 2041 return; |
| 2042 } | 2042 } |
| 2043 this[_sink].close(); | 2043 this[_sink].close(); |
| 2044 } | 2044 } |
| 2045 addSlice(str, start, end, isLast) { | 2045 addSlice(str, start, end, isLast) { |
| 2046 this[_bufferIndex] = 0; | 2046 this[_bufferIndex] = 0; |
| 2047 if (dart.notNull(start === end) && dart.notNull(!dart.notNull(isLast))) { | 2047 if (start === end && !dart.notNull(isLast)) { |
| 2048 return; | 2048 return; |
| 2049 } | 2049 } |
| 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(!dart.notNull(wasCombined)) || dart.notNull(sta
rt !== end)); | 2058 dart.assert(!dart.notNull(wasCombined) || start !== end); |
| 2059 if (wasCombined) | 2059 if (wasCombined) |
| 2060 start++; | 2060 dart.notNull(start)++; |
| 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) && dart.notNull(start === end); | 2065 let isLastSlice = dart.notNull(isLast) && start === end; |
| 2066 if (dart.notNull(start === 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] < this[_bu
ffer].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 start++; | 2073 dart.notNull(start)++; |
| 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 (start < 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$) { |
| 2084 let allowMalformed = opt$.allowMalformed === void 0 ? false : opt$.allowMa
lformed; | 2084 let allowMalformed = opt$.allowMalformed === void 0 ? false : opt$.allowMa
lformed; |
| 2085 this[_allowMalformed] = allowMalformed; | 2085 this[_allowMalformed] = allowMalformed; |
| 2086 super.Converter(); | 2086 super.Converter(); |
| 2087 } | 2087 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2120 let _TWO_BYTE_LIMIT = 2047; | 2120 let _TWO_BYTE_LIMIT = 2047; |
| 2121 let _THREE_BYTE_LIMIT = 65535; | 2121 let _THREE_BYTE_LIMIT = 65535; |
| 2122 let _FOUR_BYTE_LIMIT = 1114111; | 2122 let _FOUR_BYTE_LIMIT = 1114111; |
| 2123 let _SURROGATE_MASK = 63488; | 2123 let _SURROGATE_MASK = 63488; |
| 2124 let _SURROGATE_TAG_MASK = 64512; | 2124 let _SURROGATE_TAG_MASK = 64512; |
| 2125 let _SURROGATE_VALUE_MASK = 1023; | 2125 let _SURROGATE_VALUE_MASK = 1023; |
| 2126 let _LEAD_SURROGATE_MIN = 55296; | 2126 let _LEAD_SURROGATE_MIN = 55296; |
| 2127 let _TAIL_SURROGATE_MIN = 56320; | 2127 let _TAIL_SURROGATE_MIN = 56320; |
| 2128 // Function _isSurrogate: (int) → bool | 2128 // Function _isSurrogate: (int) → bool |
| 2129 function _isSurrogate(codeUnit) { | 2129 function _isSurrogate(codeUnit) { |
| 2130 return (codeUnit & _SURROGATE_MASK) === _LEAD_SURROGATE_MIN; | 2130 return (dart.notNull(codeUnit) & dart.notNull(_SURROGATE_MASK)) === _LEAD_SU
RROGATE_MIN; |
| 2131 } | 2131 } |
| 2132 // Function _isLeadSurrogate: (int) → bool | 2132 // Function _isLeadSurrogate: (int) → bool |
| 2133 function _isLeadSurrogate(codeUnit) { | 2133 function _isLeadSurrogate(codeUnit) { |
| 2134 return (codeUnit & _SURROGATE_TAG_MASK) === _LEAD_SURROGATE_MIN; | 2134 return (dart.notNull(codeUnit) & dart.notNull(_SURROGATE_TAG_MASK)) === _LEA
D_SURROGATE_MIN; |
| 2135 } | 2135 } |
| 2136 // Function _isTailSurrogate: (int) → bool | 2136 // Function _isTailSurrogate: (int) → bool |
| 2137 function _isTailSurrogate(codeUnit) { | 2137 function _isTailSurrogate(codeUnit) { |
| 2138 return (codeUnit & _SURROGATE_TAG_MASK) === _TAIL_SURROGATE_MIN; | 2138 return (dart.notNull(codeUnit) & dart.notNull(_SURROGATE_TAG_MASK)) === _TAI
L_SURROGATE_MIN; |
| 2139 } | 2139 } |
| 2140 // Function _combineSurrogatePair: (int, int) → int | 2140 // Function _combineSurrogatePair: (int, int) → int |
| 2141 function _combineSurrogatePair(lead, tail) { | 2141 function _combineSurrogatePair(lead, tail) { |
| 2142 return 65536 + ((lead & _SURROGATE_VALUE_MASK) << 10) | tail & _SURROGATE_VA
LUE_MASK; | 2142 return 65536 + ((dart.notNull(lead) & dart.notNull(_SURROGATE_VALUE_MASK)) <
< 10) | dart.notNull(tail) & dart.notNull(_SURROGATE_VALUE_MASK); |
| 2143 } | 2143 } |
| 2144 let _isFirstCharacter = Symbol('_isFirstCharacter'); | 2144 let _isFirstCharacter = Symbol('_isFirstCharacter'); |
| 2145 let _value = Symbol('_value'); | 2145 let _value = Symbol('_value'); |
| 2146 let _expectedUnits = Symbol('_expectedUnits'); | 2146 let _expectedUnits = Symbol('_expectedUnits'); |
| 2147 let _extraUnits = Symbol('_extraUnits'); | 2147 let _extraUnits = Symbol('_extraUnits'); |
| 2148 class _Utf8Decoder extends dart.Object { | 2148 class _Utf8Decoder extends dart.Object { |
| 2149 _Utf8Decoder($_stringSink, $_allowMalformed) { | 2149 _Utf8Decoder($_stringSink, $_allowMalformed) { |
| 2150 this[_stringSink] = $_stringSink; | 2150 this[_stringSink] = $_stringSink; |
| 2151 this[_allowMalformed] = $_allowMalformed; | 2151 this[_allowMalformed] = $_allowMalformed; |
| 2152 this[_isFirstCharacter] = true; | 2152 this[_isFirstCharacter] = true; |
| 2153 this[_value] = 0; | 2153 this[_value] = 0; |
| 2154 this[_expectedUnits] = 0; | 2154 this[_expectedUnits] = 0; |
| 2155 this[_extraUnits] = 0; | 2155 this[_extraUnits] = 0; |
| 2156 } | 2156 } |
| 2157 get hasPartialInput() { | 2157 get hasPartialInput() { |
| 2158 return this[_expectedUnits] > 0; | 2158 return dart.notNull(this[_expectedUnits]) > 0; |
| 2159 } | 2159 } |
| 2160 close() { | 2160 close() { |
| 2161 this.flush(); | 2161 this.flush(); |
| 2162 } | 2162 } |
| 2163 flush() { | 2163 flush() { |
| 2164 if (this.hasPartialInput) { | 2164 if (this.hasPartialInput) { |
| 2165 if (!dart.notNull(this[_allowMalformed])) { | 2165 if (!dart.notNull(this[_allowMalformed])) { |
| 2166 throw new core.FormatException("Unfinished UTF-8 octet sequence"); | 2166 throw new core.FormatException("Unfinished UTF-8 octet sequence"); |
| 2167 } | 2167 } |
| 2168 this[_stringSink].writeCharCode(UNICODE_REPLACEMENT_CHARACTER_RUNE); | 2168 this[_stringSink].writeCharCode(UNICODE_REPLACEMENT_CHARACTER_RUNE); |
| 2169 this[_value] = 0; | 2169 this[_value] = 0; |
| 2170 this[_expectedUnits] = 0; | 2170 this[_expectedUnits] = 0; |
| 2171 this[_extraUnits] = 0; | 2171 this[_extraUnits] = 0; |
| 2172 } | 2172 } |
| 2173 } | 2173 } |
| 2174 convert(codeUnits, startIndex, endIndex) { | 2174 convert(codeUnits, startIndex, endIndex) { |
| 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; i < to; i++) { | 2185 for (let i = from; dart.notNull(i) < dart.notNull(to); dart.notNull(i)++
) { |
| 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 i - from; | 2188 return dart.notNull(i) - dart.notNull(from); |
| 2189 } | 2189 } |
| 2190 return to - 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 >= startIndex) && dart.notNull(from <= end
Index)); | 2194 dart.assert(dart.notNull(from) >= dart.notNull(startIndex) && dart.notNu
ll(from) <= dart.notNull(endIndex)); |
| 2195 dart.assert(dart.notNull(to >= startIndex) && dart.notNull(to <= endInde
x)); | 2195 dart.assert(dart.notNull(to) >= dart.notNull(startIndex) && dart.notNull
(to) <= dart.notNull(endIndex)); |
| 2196 this[_stringSink].write(new core.String.fromCharCodes(codeUnits, from, t
o)); | 2196 this[_stringSink].write(new core.String.fromCharCodes(codeUnits, from, t
o)); |
| 2197 } | 2197 } |
| 2198 let i = startIndex; | 2198 let i = startIndex; |
| 2199 loop: | 2199 loop: |
| 2200 while (true) { | 2200 while (true) { |
| 2201 multibyte: | 2201 multibyte: |
| 2202 if (expectedUnits > 0) { | 2202 if (dart.notNull(expectedUnits) > 0) { |
| 2203 do { | 2203 do { |
| 2204 if (i === endIndex) { | 2204 if (i === endIndex) { |
| 2205 break loop; | 2205 break loop; |
| 2206 } | 2206 } |
| 2207 let unit = codeUnits.get(i); | 2207 let unit = codeUnits.get(i); |
| 2208 if ((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 = value << 6 | unit & 63; | 2217 value = dart.notNull(value) << 6 | dart.notNull(unit) & 63; |
| 2218 expectedUnits--; | 2218 dart.notNull(expectedUnits)--; |
| 2219 i++; | 2219 dart.notNull(i)++; |
| 2220 } | 2220 } |
| 2221 } while (expectedUnits > 0); | 2221 } while (dart.notNull(expectedUnits) > 0); |
| 2222 if (value <= _LIMITS.get(extraUnits - 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 (value > _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(!dart.notNull(this[_isFirstCharacter])) || dart.n
otNull(value !== UNICODE_BOM_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 (i < endIndex) { | 2240 while (dart.notNull(i) < dart.notNull(endIndex)) { |
| 2241 let oneBytes = scanOneByteCharacters(codeUnits, i); | 2241 let oneBytes = scanOneByteCharacters(codeUnits, i); |
| 2242 if (oneBytes > 0) { | 2242 if (dart.notNull(oneBytes) > 0) { |
| 2243 this[_isFirstCharacter] = false; | 2243 this[_isFirstCharacter] = false; |
| 2244 addSingleBytes(i, i + 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(i++); | 2249 let unit = codeUnits.get(dart.notNull(i)++); |
| 2250 if (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${(
-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(unit > _ONE_BYTE_LIMIT); | 2256 dart.assert(dart.notNull(unit) > dart.notNull(_ONE_BYTE_LIMIT)); |
| 2257 if ((unit & 224) === 192) { | 2257 if ((dart.notNull(unit) & 224) === 192) { |
| 2258 value = unit & 31; | 2258 value = dart.notNull(unit) & 31; |
| 2259 expectedUnits = extraUnits = 1; | 2259 expectedUnits = extraUnits = 1; |
| 2260 continue loop; | 2260 continue loop; |
| 2261 } | 2261 } |
| 2262 if ((unit & 240) === 224) { | 2262 if ((dart.notNull(unit) & 240) === 224) { |
| 2263 value = unit & 15; | 2263 value = dart.notNull(unit) & 15; |
| 2264 expectedUnits = extraUnits = 2; | 2264 expectedUnits = extraUnits = 2; |
| 2265 continue loop; | 2265 continue loop; |
| 2266 } | 2266 } |
| 2267 if (dart.notNull((unit & 248) === 240) && dart.notNull(unit < 245)
) { | 2267 if ((dart.notNull(unit) & 248) === 240 && dart.notNull(unit) < 245
) { |
| 2268 value = unit & 7; | 2268 value = dart.notNull(unit) & 7; |
| 2269 expectedUnits = extraUnits = 3; | 2269 expectedUnits = extraUnits = 3; |
| 2270 continue loop; | 2270 continue loop; |
| 2271 } | 2271 } |
| 2272 if (!dart.notNull(this[_allowMalformed])) { | 2272 if (!dart.notNull(this[_allowMalformed])) { |
| 2273 throw new core.FormatException(`Bad UTF-8 encoding 0x${unit.toRa
dixString(16)}`); | 2273 throw new core.FormatException(`Bad UTF-8 encoding 0x${unit.toRa
dixString(16)}`); |
| 2274 } | 2274 } |
| 2275 value = UNICODE_REPLACEMENT_CHARACTER_RUNE; | 2275 value = UNICODE_REPLACEMENT_CHARACTER_RUNE; |
| 2276 expectedUnits = extraUnits = 0; | 2276 expectedUnits = extraUnits = 0; |
| 2277 this[_isFirstCharacter] = false; | 2277 this[_isFirstCharacter] = false; |
| 2278 this[_stringSink].writeCharCode(value); | 2278 this[_stringSink].writeCharCode(value); |
| 2279 } | 2279 } |
| 2280 } | 2280 } |
| 2281 break loop; | 2281 break loop; |
| 2282 } | 2282 } |
| 2283 if (expectedUnits > 0) { | 2283 if (dart.notNull(expectedUnits) > 0) { |
| 2284 this[_value] = value; | 2284 this[_value] = value; |
| 2285 this[_expectedUnits] = expectedUnits; | 2285 this[_expectedUnits] = expectedUnits; |
| 2286 this[_extraUnits] = extraUnits; | 2286 this[_extraUnits] = extraUnits; |
| 2287 } | 2287 } |
| 2288 } | 2288 } |
| 2289 } | 2289 } |
| 2290 _Utf8Decoder._LIMITS = /* Unimplemented const */new List.from([_ONE_BYTE_LIMIT
, _TWO_BYTE_LIMIT, _THREE_BYTE_LIMIT, _FOUR_BYTE_LIMIT]); | 2290 _Utf8Decoder._LIMITS = /* Unimplemented const */new List.from([_ONE_BYTE_LIMIT
, _TWO_BYTE_LIMIT, _THREE_BYTE_LIMIT, _FOUR_BYTE_LIMIT]); |
| 2291 // Exports: | 2291 // Exports: |
| 2292 exports.ASCII = ASCII; | 2292 exports.ASCII = ASCII; |
| 2293 exports.AsciiCodec = AsciiCodec; | 2293 exports.AsciiCodec = AsciiCodec; |
| (...skipping 27 matching lines...) Expand all 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 |