| OLD | NEW |
| 1 dart.library('dart/convert', null, /* Imports */[ | 1 dart.library('dart/convert', null, /* Imports */[ |
| 2 'dart/core', | 2 'dart/core', |
| 3 'dart/async', | 3 'dart/async', |
| 4 'dart/typed_data', | 4 'dart/typed_data', |
| 5 'dart/_internal', | 5 'dart/_internal', |
| 6 'dart/collection' | 6 'dart/collection' |
| 7 ], /* Lazy imports */[ | 7 ], /* Lazy imports */[ |
| 8 ], function(exports, core, async, typed_data, _internal, collection) { | 8 ], function(exports, core, async, typed_data, _internal, collection) { |
| 9 'use strict'; | 9 'use strict'; |
| 10 let Codec$ = dart.generic(function(S, T) { | 10 let Codec$ = dart.generic(function(S, T) { |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 class _UnicodeSubsetEncoder extends Converter$(core.String, core.List$(core.in
t)) { | 127 class _UnicodeSubsetEncoder extends Converter$(core.String, core.List$(core.in
t)) { |
| 128 _UnicodeSubsetEncoder(subsetMask) { | 128 _UnicodeSubsetEncoder(subsetMask) { |
| 129 this[_subsetMask] = subsetMask; | 129 this[_subsetMask] = subsetMask; |
| 130 super.Converter(); | 130 super.Converter(); |
| 131 } | 131 } |
| 132 convert(string, start, end) { | 132 convert(string, start, end) { |
| 133 if (start === void 0) | 133 if (start === void 0) |
| 134 start = 0; | 134 start = 0; |
| 135 if (end === void 0) | 135 if (end === void 0) |
| 136 end = null; | 136 end = null; |
| 137 let stringLength = string.length; | 137 let stringLength = string[dartx.length]; |
| 138 core.RangeError.checkValidRange(start, end, stringLength); | 138 core.RangeError.checkValidRange(start, end, stringLength); |
| 139 if (end == null) | 139 if (end == null) |
| 140 end = stringLength; | 140 end = stringLength; |
| 141 let length = dart.notNull(end) - dart.notNull(start); | 141 let length = dart.notNull(end) - dart.notNull(start); |
| 142 let result = typed_data.Uint8List.new(length); | 142 let result = typed_data.Uint8List.new(length); |
| 143 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull(i
) + 1) { | 143 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull(i
) + 1) { |
| 144 let codeUnit = string[dartx.codeUnitAt](dart.notNull(start) + dart.notNu
ll(i)); | 144 let codeUnit = string[dartx.codeUnitAt](dart.notNull(start) + dart.notNu
ll(i)); |
| 145 if ((dart.notNull(codeUnit) & ~dart.notNull(this[_subsetMask])) != 0) { | 145 if ((dart.notNull(codeUnit) & ~dart.notNull(this[_subsetMask])) != 0) { |
| 146 throw new core.ArgumentError("String contains invalid characters."); | 146 throw new core.ArgumentError("String contains invalid characters."); |
| 147 } | 147 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 170 class AsciiEncoder extends _UnicodeSubsetEncoder { | 170 class AsciiEncoder extends _UnicodeSubsetEncoder { |
| 171 AsciiEncoder() { | 171 AsciiEncoder() { |
| 172 super._UnicodeSubsetEncoder(_ASCII_MASK); | 172 super._UnicodeSubsetEncoder(_ASCII_MASK); |
| 173 } | 173 } |
| 174 } | 174 } |
| 175 dart.setSignature(AsciiEncoder, { | 175 dart.setSignature(AsciiEncoder, { |
| 176 constructors: () => ({AsciiEncoder: [AsciiEncoder, []]}) | 176 constructors: () => ({AsciiEncoder: [AsciiEncoder, []]}) |
| 177 }); | 177 }); |
| 178 class StringConversionSinkMixin extends core.Object { | 178 class StringConversionSinkMixin extends core.Object { |
| 179 add(str) { | 179 add(str) { |
| 180 return this.addSlice(str, 0, str.length, false); | 180 return this.addSlice(str, 0, str[dartx.length], false); |
| 181 } | 181 } |
| 182 asUtf8Sink(allowMalformed) { | 182 asUtf8Sink(allowMalformed) { |
| 183 return new _Utf8ConversionSink(this, allowMalformed); | 183 return new _Utf8ConversionSink(this, allowMalformed); |
| 184 } | 184 } |
| 185 asStringSink() { | 185 asStringSink() { |
| 186 return new _StringConversionSinkAsStringSinkAdapter(this); | 186 return new _StringConversionSinkAsStringSinkAdapter(this); |
| 187 } | 187 } |
| 188 } | 188 } |
| 189 StringConversionSinkMixin[dart.implements] = () => [StringConversionSink]; | 189 StringConversionSinkMixin[dart.implements] = () => [StringConversionSink]; |
| 190 dart.setSignature(StringConversionSinkMixin, { | 190 dart.setSignature(StringConversionSinkMixin, { |
| 191 methods: () => ({ | 191 methods: () => ({ |
| 192 add: [dart.void, [core.String]], | 192 add: [dart.void, [core.String]], |
| 193 asUtf8Sink: [ByteConversionSink, [core.bool]], | 193 asUtf8Sink: [ByteConversionSink, [core.bool]], |
| 194 asStringSink: [ClosableStringSink, []] | 194 asStringSink: [ClosableStringSink, []] |
| 195 }) | 195 }) |
| 196 }); | 196 }); |
| 197 class StringConversionSinkBase extends StringConversionSinkMixin {} | 197 class StringConversionSinkBase extends StringConversionSinkMixin {} |
| 198 let _sink = Symbol('_sink'); | 198 let _sink = Symbol('_sink'); |
| 199 class _UnicodeSubsetEncoderSink extends StringConversionSinkBase { | 199 class _UnicodeSubsetEncoderSink extends StringConversionSinkBase { |
| 200 _UnicodeSubsetEncoderSink(subsetMask, sink) { | 200 _UnicodeSubsetEncoderSink(subsetMask, sink) { |
| 201 this[_subsetMask] = subsetMask; | 201 this[_subsetMask] = subsetMask; |
| 202 this[_sink] = sink; | 202 this[_sink] = sink; |
| 203 } | 203 } |
| 204 close() { | 204 close() { |
| 205 this[_sink].close(); | 205 this[_sink].close(); |
| 206 } | 206 } |
| 207 addSlice(source, start, end, isLast) { | 207 addSlice(source, start, end, isLast) { |
| 208 core.RangeError.checkValidRange(start, end, source.length); | 208 core.RangeError.checkValidRange(start, end, source[dartx.length]); |
| 209 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { | 209 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { |
| 210 let codeUnit = source[dartx.codeUnitAt](i); | 210 let codeUnit = source[dartx.codeUnitAt](i); |
| 211 if ((dart.notNull(codeUnit) & ~dart.notNull(this[_subsetMask])) != 0) { | 211 if ((dart.notNull(codeUnit) & ~dart.notNull(this[_subsetMask])) != 0) { |
| 212 throw new core.ArgumentError(`Source contains invalid character with c
ode point: ${codeUnit}.`); | 212 throw new core.ArgumentError(`Source contains invalid character with c
ode point: ${codeUnit}.`); |
| 213 } | 213 } |
| 214 } | 214 } |
| 215 this[_sink].add(source[dartx.codeUnits][dartx.sublist](start, end)); | 215 this[_sink].add(source[dartx.codeUnits][dartx.sublist](start, end)); |
| 216 if (dart.notNull(isLast)) { | 216 if (dart.notNull(isLast)) { |
| 217 this.close(); | 217 this.close(); |
| 218 } | 218 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 230 _UnicodeSubsetDecoder(allowInvalid, subsetMask) { | 230 _UnicodeSubsetDecoder(allowInvalid, subsetMask) { |
| 231 this[_allowInvalid] = allowInvalid; | 231 this[_allowInvalid] = allowInvalid; |
| 232 this[_subsetMask] = subsetMask; | 232 this[_subsetMask] = subsetMask; |
| 233 super.Converter(); | 233 super.Converter(); |
| 234 } | 234 } |
| 235 convert(bytes, start, end) { | 235 convert(bytes, start, end) { |
| 236 if (start === void 0) | 236 if (start === void 0) |
| 237 start = 0; | 237 start = 0; |
| 238 if (end === void 0) | 238 if (end === void 0) |
| 239 end = null; | 239 end = null; |
| 240 let byteCount = bytes.length; | 240 let byteCount = bytes[dartx.length]; |
| 241 core.RangeError.checkValidRange(start, end, byteCount); | 241 core.RangeError.checkValidRange(start, end, byteCount); |
| 242 if (end == null) | 242 if (end == null) |
| 243 end = byteCount; | 243 end = byteCount; |
| 244 let length = dart.notNull(end) - dart.notNull(start); | 244 let length = dart.notNull(end) - dart.notNull(start); |
| 245 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { | 245 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { |
| 246 let byte = bytes[dartx.get](i); | 246 let byte = bytes[dartx.get](i); |
| 247 if ((dart.notNull(byte) & ~dart.notNull(this[_subsetMask])) != 0) { | 247 if ((dart.notNull(byte) & ~dart.notNull(this[_subsetMask])) != 0) { |
| 248 if (!dart.notNull(this[_allowInvalid])) { | 248 if (!dart.notNull(this[_allowInvalid])) { |
| 249 throw new core.FormatException(`Invalid value in input: ${byte}`); | 249 throw new core.FormatException(`Invalid value in input: ${byte}`); |
| 250 } | 250 } |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 }); | 349 }); |
| 350 let _utf8Sink = Symbol('_utf8Sink'); | 350 let _utf8Sink = Symbol('_utf8Sink'); |
| 351 class _ErrorHandlingAsciiDecoderSink extends ByteConversionSinkBase { | 351 class _ErrorHandlingAsciiDecoderSink extends ByteConversionSinkBase { |
| 352 _ErrorHandlingAsciiDecoderSink(utf8Sink) { | 352 _ErrorHandlingAsciiDecoderSink(utf8Sink) { |
| 353 this[_utf8Sink] = utf8Sink; | 353 this[_utf8Sink] = utf8Sink; |
| 354 } | 354 } |
| 355 close() { | 355 close() { |
| 356 this[_utf8Sink].close(); | 356 this[_utf8Sink].close(); |
| 357 } | 357 } |
| 358 add(source) { | 358 add(source) { |
| 359 this.addSlice(source, 0, source.length, false); | 359 this.addSlice(source, 0, source[dartx.length], false); |
| 360 } | 360 } |
| 361 addSlice(source, start, end, isLast) { | 361 addSlice(source, start, end, isLast) { |
| 362 core.RangeError.checkValidRange(start, end, source.length); | 362 core.RangeError.checkValidRange(start, end, source[dartx.length]); |
| 363 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { | 363 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { |
| 364 if ((dart.notNull(source[dartx.get](i)) & ~dart.notNull(_ASCII_MASK)) !=
0) { | 364 if ((dart.notNull(source[dartx.get](i)) & ~dart.notNull(_ASCII_MASK)) !=
0) { |
| 365 if (dart.notNull(i) > dart.notNull(start)) | 365 if (dart.notNull(i) > dart.notNull(start)) |
| 366 this[_utf8Sink].addSlice(source, start, i, false); | 366 this[_utf8Sink].addSlice(source, start, i, false); |
| 367 this[_utf8Sink].add(dart.const(dart.list([239, 191, 189], core.int))); | 367 this[_utf8Sink].add(dart.const(dart.list([239, 191, 189], core.int))); |
| 368 start = dart.notNull(i) + 1; | 368 start = dart.notNull(i) + 1; |
| 369 } | 369 } |
| 370 } | 370 } |
| 371 if (dart.notNull(start) < dart.notNull(end)) { | 371 if (dart.notNull(start) < dart.notNull(end)) { |
| 372 this[_utf8Sink].addSlice(source, start, end, isLast); | 372 this[_utf8Sink].addSlice(source, start, end, isLast); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 383 }) | 383 }) |
| 384 }); | 384 }); |
| 385 class _SimpleAsciiDecoderSink extends ByteConversionSinkBase { | 385 class _SimpleAsciiDecoderSink extends ByteConversionSinkBase { |
| 386 _SimpleAsciiDecoderSink(sink) { | 386 _SimpleAsciiDecoderSink(sink) { |
| 387 this[_sink] = sink; | 387 this[_sink] = sink; |
| 388 } | 388 } |
| 389 close() { | 389 close() { |
| 390 this[_sink].close(); | 390 this[_sink].close(); |
| 391 } | 391 } |
| 392 add(source) { | 392 add(source) { |
| 393 for (let i = 0; dart.notNull(i) < dart.notNull(source.length); i = dart.no
tNull(i) + 1) { | 393 for (let i = 0; dart.notNull(i) < dart.notNull(source[dartx.length]); i =
dart.notNull(i) + 1) { |
| 394 if ((dart.notNull(source[dartx.get](i)) & ~dart.notNull(_ASCII_MASK)) !=
0) { | 394 if ((dart.notNull(source[dartx.get](i)) & ~dart.notNull(_ASCII_MASK)) !=
0) { |
| 395 throw new core.FormatException("Source contains non-ASCII bytes."); | 395 throw new core.FormatException("Source contains non-ASCII bytes."); |
| 396 } | 396 } |
| 397 } | 397 } |
| 398 this[_sink].add(core.String.fromCharCodes(source)); | 398 this[_sink].add(core.String.fromCharCodes(source)); |
| 399 } | 399 } |
| 400 addSlice(source, start, end, isLast) { | 400 addSlice(source, start, end, isLast) { |
| 401 let length = source.length; | 401 let length = source[dartx.length]; |
| 402 core.RangeError.checkValidRange(start, end, length); | 402 core.RangeError.checkValidRange(start, end, length); |
| 403 if (dart.notNull(start) < dart.notNull(end)) { | 403 if (dart.notNull(start) < dart.notNull(end)) { |
| 404 if (start != 0 || end != length) { | 404 if (start != 0 || end != length) { |
| 405 source = source[dartx.sublist](start, end); | 405 source = source[dartx.sublist](start, end); |
| 406 } | 406 } |
| 407 this.add(source); | 407 this.add(source); |
| 408 } | 408 } |
| 409 if (dart.notNull(isLast)) | 409 if (dart.notNull(isLast)) |
| 410 this.close(); | 410 this.close(); |
| 411 } | 411 } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 438 let _buffer = Symbol('_buffer'); | 438 let _buffer = Symbol('_buffer'); |
| 439 let _callback = Symbol('_callback'); | 439 let _callback = Symbol('_callback'); |
| 440 let _bufferIndex = Symbol('_bufferIndex'); | 440 let _bufferIndex = Symbol('_bufferIndex'); |
| 441 class _ByteCallbackSink extends ByteConversionSinkBase { | 441 class _ByteCallbackSink extends ByteConversionSinkBase { |
| 442 _ByteCallbackSink(callback) { | 442 _ByteCallbackSink(callback) { |
| 443 this[_buffer] = typed_data.Uint8List.new(_ByteCallbackSink._INITIAL_BUFFER
_SIZE); | 443 this[_buffer] = typed_data.Uint8List.new(_ByteCallbackSink._INITIAL_BUFFER
_SIZE); |
| 444 this[_callback] = callback; | 444 this[_callback] = callback; |
| 445 this[_bufferIndex] = 0; | 445 this[_bufferIndex] = 0; |
| 446 } | 446 } |
| 447 add(chunk) { | 447 add(chunk) { |
| 448 let freeCount = dart.notNull(this[_buffer].length) - dart.notNull(this[_bu
fferIndex]); | 448 let freeCount = dart.notNull(this[_buffer][dartx.length]) - dart.notNull(t
his[_bufferIndex]); |
| 449 if (dart.notNull(chunk.length) > dart.notNull(freeCount)) { | 449 if (dart.notNull(chunk[dartx.length]) > dart.notNull(freeCount)) { |
| 450 let oldLength = this[_buffer].length; | 450 let oldLength = this[_buffer][dartx.length]; |
| 451 let newLength = dart.notNull(_ByteCallbackSink._roundToPowerOf2(dart.not
Null(chunk.length) + dart.notNull(oldLength))) * 2; | 451 let newLength = dart.notNull(_ByteCallbackSink._roundToPowerOf2(dart.not
Null(chunk[dartx.length]) + dart.notNull(oldLength))) * 2; |
| 452 let grown = typed_data.Uint8List.new(newLength); | 452 let grown = typed_data.Uint8List.new(newLength); |
| 453 grown[dartx.setRange](0, this[_buffer].length, this[_buffer]); | 453 grown[dartx.setRange](0, this[_buffer][dartx.length], this[_buffer]); |
| 454 this[_buffer] = grown; | 454 this[_buffer] = grown; |
| 455 } | 455 } |
| 456 this[_buffer][dartx.setRange](this[_bufferIndex], dart.notNull(this[_buffe
rIndex]) + dart.notNull(chunk.length), chunk); | 456 this[_buffer][dartx.setRange](this[_bufferIndex], dart.notNull(this[_buffe
rIndex]) + dart.notNull(chunk[dartx.length]), chunk); |
| 457 this[_bufferIndex] = dart.notNull(this[_bufferIndex]) + dart.notNull(chunk
.length); | 457 this[_bufferIndex] = dart.notNull(this[_bufferIndex]) + dart.notNull(chunk
[dartx.length]); |
| 458 } | 458 } |
| 459 static _roundToPowerOf2(v) { | 459 static _roundToPowerOf2(v) { |
| 460 dart.assert(dart.notNull(v) > 0); | 460 dart.assert(dart.notNull(v) > 0); |
| 461 v = dart.notNull(v) - 1; | 461 v = dart.notNull(v) - 1; |
| 462 v = dart.notNull(v) | dart.notNull(v) >> 1; | 462 v = dart.notNull(v) | dart.notNull(v) >> 1; |
| 463 v = dart.notNull(v) | dart.notNull(v) >> 2; | 463 v = dart.notNull(v) | dart.notNull(v) >> 2; |
| 464 v = dart.notNull(v) | dart.notNull(v) >> 4; | 464 v = dart.notNull(v) | dart.notNull(v) >> 4; |
| 465 v = dart.notNull(v) | dart.notNull(v) >> 8; | 465 v = dart.notNull(v) | dart.notNull(v) >> 8; |
| 466 v = dart.notNull(v) | dart.notNull(v) >> 16; | 466 v = dart.notNull(v) | dart.notNull(v) >> 16; |
| 467 v = dart.notNull(v) + 1; | 467 v = dart.notNull(v) + 1; |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 HtmlEscapeMode.UNKNOWN = dart.const(new HtmlEscapeMode._('unknown', true, true
, true, true)); | 666 HtmlEscapeMode.UNKNOWN = dart.const(new HtmlEscapeMode._('unknown', true, true
, true, true)); |
| 667 let _convert = Symbol('_convert'); | 667 let _convert = Symbol('_convert'); |
| 668 class HtmlEscape extends Converter$(core.String, core.String) { | 668 class HtmlEscape extends Converter$(core.String, core.String) { |
| 669 HtmlEscape(mode) { | 669 HtmlEscape(mode) { |
| 670 if (mode === void 0) | 670 if (mode === void 0) |
| 671 mode = HtmlEscapeMode.UNKNOWN; | 671 mode = HtmlEscapeMode.UNKNOWN; |
| 672 this.mode = mode; | 672 this.mode = mode; |
| 673 super.Converter(); | 673 super.Converter(); |
| 674 } | 674 } |
| 675 convert(text) { | 675 convert(text) { |
| 676 let val = this[_convert](text, 0, text.length); | 676 let val = this[_convert](text, 0, text[dartx.length]); |
| 677 return val == null ? text : val; | 677 return val == null ? text : val; |
| 678 } | 678 } |
| 679 [_convert](text, start, end) { | 679 [_convert](text, start, end) { |
| 680 let result = null; | 680 let result = null; |
| 681 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { | 681 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { |
| 682 let ch = text[dartx.get](i); | 682 let ch = text[dartx.get](i); |
| 683 let replace = null; | 683 let replace = null; |
| 684 switch (ch) { | 684 switch (ch) { |
| 685 case '&': | 685 case '&': |
| 686 { | 686 { |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 924 this[_toEncodable$] = toEncodable; | 924 this[_toEncodable$] = toEncodable; |
| 925 this[_bufferSize] = bufferSize; | 925 this[_bufferSize] = bufferSize; |
| 926 super.Converter(); | 926 super.Converter(); |
| 927 } | 927 } |
| 928 static _utf8Encode(string) { | 928 static _utf8Encode(string) { |
| 929 if (string == null) | 929 if (string == null) |
| 930 return null; | 930 return null; |
| 931 if (dart.notNull(string[dartx.isEmpty])) | 931 if (dart.notNull(string[dartx.isEmpty])) |
| 932 return typed_data.Uint8List.new(0); | 932 return typed_data.Uint8List.new(0); |
| 933 checkAscii: { | 933 checkAscii: { |
| 934 for (let i = 0; dart.notNull(i) < dart.notNull(string.length); i = dart.
notNull(i) + 1) { | 934 for (let i = 0; dart.notNull(i) < dart.notNull(string[dartx.length]); i
= dart.notNull(i) + 1) { |
| 935 if (dart.notNull(string[dartx.codeUnitAt](i)) >= 128) | 935 if (dart.notNull(string[dartx.codeUnitAt](i)) >= 128) |
| 936 break checkAscii; | 936 break checkAscii; |
| 937 } | 937 } |
| 938 return string[dartx.codeUnits]; | 938 return string[dartx.codeUnits]; |
| 939 } | 939 } |
| 940 return UTF8.encode(string); | 940 return UTF8.encode(string); |
| 941 } | 941 } |
| 942 convert(object) { | 942 convert(object) { |
| 943 let bytes = dart.list([], core.List$(core.int)); | 943 let bytes = dart.list([], core.List$(core.int)); |
| 944 let addChunk = (chunk, start, end) => { | 944 let addChunk = (chunk, start, end) => { |
| 945 if (dart.notNull(start) > 0 || dart.notNull(end) < dart.notNull(chunk.le
ngth)) { | 945 if (dart.notNull(start) > 0 || dart.notNull(end) < dart.notNull(chunk.le
ngth)) { |
| 946 let length = dart.notNull(end) - dart.notNull(start); | 946 let length = dart.notNull(end) - dart.notNull(start); |
| 947 chunk = typed_data.Uint8List.view(chunk.buffer, dart.notNull(chunk.off
setInBytes) + dart.notNull(start), length); | 947 chunk = typed_data.Uint8List.view(chunk.buffer, dart.notNull(chunk.off
setInBytes) + dart.notNull(start), length); |
| 948 } | 948 } |
| 949 bytes[dartx.add](chunk); | 949 bytes[dartx.add](chunk); |
| 950 }; | 950 }; |
| 951 dart.fn(addChunk, dart.void, [typed_data.Uint8List, core.int, core.int]); | 951 dart.fn(addChunk, dart.void, [typed_data.Uint8List, core.int, core.int]); |
| 952 _JsonUtf8Stringifier.stringify(object, this[_indent], dart.as(this[_toEnco
dable$], dart.functionType(core.Object, [core.Object])), this[_bufferSize], addC
hunk); | 952 _JsonUtf8Stringifier.stringify(object, this[_indent], dart.as(this[_toEnco
dable$], dart.functionType(core.Object, [core.Object])), this[_bufferSize], addC
hunk); |
| 953 if (bytes.length == 1) | 953 if (bytes[dartx.length] == 1) |
| 954 return bytes[dartx.get](0); | 954 return bytes[dartx.get](0); |
| 955 let length = 0; | 955 let length = 0; |
| 956 for (let i = 0; dart.notNull(i) < dart.notNull(bytes.length); i = dart.not
Null(i) + 1) { | 956 for (let i = 0; dart.notNull(i) < dart.notNull(bytes[dartx.length]); i = d
art.notNull(i) + 1) { |
| 957 length = dart.notNull(length) + dart.notNull(bytes[dartx.get](i).length)
; | 957 length = dart.notNull(length) + dart.notNull(bytes[dartx.get](i)[dartx.l
ength]); |
| 958 } | 958 } |
| 959 let result = typed_data.Uint8List.new(length); | 959 let result = typed_data.Uint8List.new(length); |
| 960 for (let i = 0, offset = 0; dart.notNull(i) < dart.notNull(bytes.length);
i = dart.notNull(i) + 1) { | 960 for (let i = 0, offset = 0; dart.notNull(i) < dart.notNull(bytes[dartx.len
gth]); i = dart.notNull(i) + 1) { |
| 961 let byteList = bytes[dartx.get](i); | 961 let byteList = bytes[dartx.get](i); |
| 962 let end = dart.notNull(offset) + dart.notNull(byteList.length); | 962 let end = dart.notNull(offset) + dart.notNull(byteList[dartx.length]); |
| 963 result.setRange(offset, end, byteList); | 963 result.setRange(offset, end, byteList); |
| 964 offset = end; | 964 offset = end; |
| 965 } | 965 } |
| 966 return result; | 966 return result; |
| 967 } | 967 } |
| 968 startChunkedConversion(sink) { | 968 startChunkedConversion(sink) { |
| 969 let byteSink = null; | 969 let byteSink = null; |
| 970 if (dart.is(sink, ByteConversionSink)) { | 970 if (dart.is(sink, ByteConversionSink)) { |
| 971 byteSink = sink; | 971 byteSink = sink; |
| 972 } else { | 972 } else { |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1108 class _JsonStringifier extends core.Object { | 1108 class _JsonStringifier extends core.Object { |
| 1109 _JsonStringifier(_toEncodable) { | 1109 _JsonStringifier(_toEncodable) { |
| 1110 this[_seen] = core.List.new(); | 1110 this[_seen] = core.List.new(); |
| 1111 this[_toEncodable$] = _toEncodable != null ? _toEncodable : _defaultToEnco
dable; | 1111 this[_toEncodable$] = _toEncodable != null ? _toEncodable : _defaultToEnco
dable; |
| 1112 } | 1112 } |
| 1113 static hexDigit(x) { | 1113 static hexDigit(x) { |
| 1114 return dart.notNull(x) < 10 ? 48 + dart.notNull(x) : 87 + dart.notNull(x); | 1114 return dart.notNull(x) < 10 ? 48 + dart.notNull(x) : 87 + dart.notNull(x); |
| 1115 } | 1115 } |
| 1116 writeStringContent(s) { | 1116 writeStringContent(s) { |
| 1117 let offset = 0; | 1117 let offset = 0; |
| 1118 let length = s.length; | 1118 let length = s[dartx.length]; |
| 1119 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull(i
) + 1) { | 1119 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull(i
) + 1) { |
| 1120 let charCode = s[dartx.codeUnitAt](i); | 1120 let charCode = s[dartx.codeUnitAt](i); |
| 1121 if (dart.notNull(charCode) > dart.notNull(_JsonStringifier.BACKSLASH)) | 1121 if (dart.notNull(charCode) > dart.notNull(_JsonStringifier.BACKSLASH)) |
| 1122 continue; | 1122 continue; |
| 1123 if (dart.notNull(charCode) < 32) { | 1123 if (dart.notNull(charCode) < 32) { |
| 1124 if (dart.notNull(i) > dart.notNull(offset)) | 1124 if (dart.notNull(i) > dart.notNull(offset)) |
| 1125 this.writeStringSlice(s, offset, i); | 1125 this.writeStringSlice(s, offset, i); |
| 1126 offset = dart.notNull(i) + 1; | 1126 offset = dart.notNull(i) + 1; |
| 1127 this.writeCharCode(_JsonStringifier.BACKSLASH); | 1127 this.writeCharCode(_JsonStringifier.BACKSLASH); |
| 1128 switch (charCode) { | 1128 switch (charCode) { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1169 this.writeCharCode(charCode); | 1169 this.writeCharCode(charCode); |
| 1170 } | 1170 } |
| 1171 } | 1171 } |
| 1172 if (offset == 0) { | 1172 if (offset == 0) { |
| 1173 this.writeString(s); | 1173 this.writeString(s); |
| 1174 } else if (dart.notNull(offset) < dart.notNull(length)) { | 1174 } else if (dart.notNull(offset) < dart.notNull(length)) { |
| 1175 this.writeStringSlice(s, offset, length); | 1175 this.writeStringSlice(s, offset, length); |
| 1176 } | 1176 } |
| 1177 } | 1177 } |
| 1178 [_checkCycle](object) { | 1178 [_checkCycle](object) { |
| 1179 for (let i = 0; dart.notNull(i) < dart.notNull(this[_seen].length); i = da
rt.notNull(i) + 1) { | 1179 for (let i = 0; dart.notNull(i) < dart.notNull(this[_seen][dartx.length]);
i = dart.notNull(i) + 1) { |
| 1180 if (dart.notNull(core.identical(object, this[_seen][dartx.get](i)))) { | 1180 if (dart.notNull(core.identical(object, this[_seen][dartx.get](i)))) { |
| 1181 throw new JsonCyclicError(object); | 1181 throw new JsonCyclicError(object); |
| 1182 } | 1182 } |
| 1183 } | 1183 } |
| 1184 this[_seen][dartx.add](object); | 1184 this[_seen][dartx.add](object); |
| 1185 } | 1185 } |
| 1186 [_removeSeen](object) { | 1186 [_removeSeen](object) { |
| 1187 dart.assert(!dart.notNull(this[_seen][dartx.isEmpty])); | 1187 dart.assert(!dart.notNull(this[_seen][dartx.isEmpty])); |
| 1188 dart.assert(core.identical(this[_seen][dartx.last], object)); | 1188 dart.assert(core.identical(this[_seen][dartx.last], object)); |
| 1189 this[_seen][dartx.removeLast](); | 1189 this[_seen][dartx.removeLast](); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1232 this[_checkCycle](object); | 1232 this[_checkCycle](object); |
| 1233 this.writeMap(dart.as(object, core.Map$(core.String, core.Object))); | 1233 this.writeMap(dart.as(object, core.Map$(core.String, core.Object))); |
| 1234 this[_removeSeen](object); | 1234 this[_removeSeen](object); |
| 1235 return true; | 1235 return true; |
| 1236 } else { | 1236 } else { |
| 1237 return false; | 1237 return false; |
| 1238 } | 1238 } |
| 1239 } | 1239 } |
| 1240 writeList(list) { | 1240 writeList(list) { |
| 1241 this.writeString('['); | 1241 this.writeString('['); |
| 1242 if (dart.notNull(list.length) > 0) { | 1242 if (dart.notNull(list[dartx.length]) > 0) { |
| 1243 this.writeObject(list[dartx.get](0)); | 1243 this.writeObject(list[dartx.get](0)); |
| 1244 for (let i = 1; dart.notNull(i) < dart.notNull(list.length); i = dart.no
tNull(i) + 1) { | 1244 for (let i = 1; dart.notNull(i) < dart.notNull(list[dartx.length]); i =
dart.notNull(i) + 1) { |
| 1245 this.writeString(','); | 1245 this.writeString(','); |
| 1246 this.writeObject(list[dartx.get](i)); | 1246 this.writeObject(list[dartx.get](i)); |
| 1247 } | 1247 } |
| 1248 } | 1248 } |
| 1249 this.writeString(']'); | 1249 this.writeString(']'); |
| 1250 } | 1250 } |
| 1251 writeMap(map) { | 1251 writeMap(map) { |
| 1252 this.writeString('{'); | 1252 this.writeString('{'); |
| 1253 let separator = '"'; | 1253 let separator = '"'; |
| 1254 map.forEach(dart.fn((key, value) => { | 1254 map.forEach(dart.fn((key, value) => { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1295 this[_indentLevel] = 0; | 1295 this[_indentLevel] = 0; |
| 1296 } | 1296 } |
| 1297 writeList(list) { | 1297 writeList(list) { |
| 1298 if (dart.notNull(list[dartx.isEmpty])) { | 1298 if (dart.notNull(list[dartx.isEmpty])) { |
| 1299 this.writeString('[]'); | 1299 this.writeString('[]'); |
| 1300 } else { | 1300 } else { |
| 1301 this.writeString('[\n'); | 1301 this.writeString('[\n'); |
| 1302 this[_indentLevel] = dart.notNull(this[_indentLevel]) + 1; | 1302 this[_indentLevel] = dart.notNull(this[_indentLevel]) + 1; |
| 1303 this.writeIndentation(this[_indentLevel]); | 1303 this.writeIndentation(this[_indentLevel]); |
| 1304 this.writeObject(list[dartx.get](0)); | 1304 this.writeObject(list[dartx.get](0)); |
| 1305 for (let i = 1; dart.notNull(i) < dart.notNull(list.length); i = dart.no
tNull(i) + 1) { | 1305 for (let i = 1; dart.notNull(i) < dart.notNull(list[dartx.length]); i =
dart.notNull(i) + 1) { |
| 1306 this.writeString(',\n'); | 1306 this.writeString(',\n'); |
| 1307 this.writeIndentation(this[_indentLevel]); | 1307 this.writeIndentation(this[_indentLevel]); |
| 1308 this.writeObject(list[dartx.get](i)); | 1308 this.writeObject(list[dartx.get](i)); |
| 1309 } | 1309 } |
| 1310 this.writeString('\n'); | 1310 this.writeString('\n'); |
| 1311 this[_indentLevel] = dart.notNull(this[_indentLevel]) - 1; | 1311 this[_indentLevel] = dart.notNull(this[_indentLevel]) - 1; |
| 1312 this.writeIndentation(this[_indentLevel]); | 1312 this.writeIndentation(this[_indentLevel]); |
| 1313 this.writeString(']'); | 1313 this.writeString(']'); |
| 1314 } | 1314 } |
| 1315 } | 1315 } |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1427 if (dart.notNull(this.index) > 0) { | 1427 if (dart.notNull(this.index) > 0) { |
| 1428 dart.dcall(this.addChunk, this.buffer, 0, this.index); | 1428 dart.dcall(this.addChunk, this.buffer, 0, this.index); |
| 1429 } | 1429 } |
| 1430 this.buffer = null; | 1430 this.buffer = null; |
| 1431 this.index = 0; | 1431 this.index = 0; |
| 1432 } | 1432 } |
| 1433 writeNumber(number) { | 1433 writeNumber(number) { |
| 1434 this.writeAsciiString(dart[dartx.toString](number)); | 1434 this.writeAsciiString(dart[dartx.toString](number)); |
| 1435 } | 1435 } |
| 1436 writeAsciiString(string) { | 1436 writeAsciiString(string) { |
| 1437 for (let i = 0; dart.notNull(i) < dart.notNull(string.length); i = dart.no
tNull(i) + 1) { | 1437 for (let i = 0; dart.notNull(i) < dart.notNull(string[dartx.length]); i =
dart.notNull(i) + 1) { |
| 1438 let char = string[dartx.codeUnitAt](i); | 1438 let char = string[dartx.codeUnitAt](i); |
| 1439 dart.assert(dart.notNull(char) <= 127); | 1439 dart.assert(dart.notNull(char) <= 127); |
| 1440 this.writeByte(char); | 1440 this.writeByte(char); |
| 1441 } | 1441 } |
| 1442 } | 1442 } |
| 1443 writeString(string) { | 1443 writeString(string) { |
| 1444 this.writeStringSlice(string, 0, string.length); | 1444 this.writeStringSlice(string, 0, string[dartx.length]); |
| 1445 } | 1445 } |
| 1446 writeStringSlice(string, start, end) { | 1446 writeStringSlice(string, start, end) { |
| 1447 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { | 1447 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { |
| 1448 let char = string[dartx.codeUnitAt](i); | 1448 let char = string[dartx.codeUnitAt](i); |
| 1449 if (dart.notNull(char) <= 127) { | 1449 if (dart.notNull(char) <= 127) { |
| 1450 this.writeByte(char); | 1450 this.writeByte(char); |
| 1451 } else { | 1451 } else { |
| 1452 if ((dart.notNull(char) & 64512) == 55296 && dart.notNull(i) + 1 < dar
t.notNull(end)) { | 1452 if ((dart.notNull(char) & 64512) == 55296 && dart.notNull(i) + 1 < dar
t.notNull(end)) { |
| 1453 let nextChar = string[dartx.codeUnitAt](dart.notNull(i) + 1); | 1453 let nextChar = string[dartx.codeUnitAt](dart.notNull(i) + 1); |
| 1454 if ((dart.notNull(nextChar) & 64512) == 56320) { | 1454 if ((dart.notNull(nextChar) & 64512) == 56320) { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1520 statics: () => ({stringify: [dart.void, [core.Object, core.List$(core.int),
dart.functionType(core.Object, [core.Object]), core.int, dart.functionType(dart.
void, [typed_data.Uint8List, core.int, core.int])]]}), | 1520 statics: () => ({stringify: [dart.void, [core.Object, core.List$(core.int),
dart.functionType(core.Object, [core.Object]), core.int, dart.functionType(dart.
void, [typed_data.Uint8List, core.int, core.int])]]}), |
| 1521 names: ['stringify'] | 1521 names: ['stringify'] |
| 1522 }); | 1522 }); |
| 1523 class _JsonUtf8StringifierPretty extends dart.mixin(_JsonUtf8Stringifier, _Jso
nPrettyPrintMixin) { | 1523 class _JsonUtf8StringifierPretty extends dart.mixin(_JsonUtf8Stringifier, _Jso
nPrettyPrintMixin) { |
| 1524 _JsonUtf8StringifierPretty(toEncodableFunction, indent, bufferSize, addChunk
) { | 1524 _JsonUtf8StringifierPretty(toEncodableFunction, indent, bufferSize, addChunk
) { |
| 1525 this.indent = indent; | 1525 this.indent = indent; |
| 1526 super._JsonUtf8Stringifier(toEncodableFunction, dart.as(bufferSize, core.i
nt), dart.as(addChunk, core.Function)); | 1526 super._JsonUtf8Stringifier(toEncodableFunction, dart.as(bufferSize, core.i
nt), dart.as(addChunk, core.Function)); |
| 1527 } | 1527 } |
| 1528 writeIndentation(count) { | 1528 writeIndentation(count) { |
| 1529 let indent = this.indent; | 1529 let indent = this.indent; |
| 1530 let indentLength = indent.length; | 1530 let indentLength = indent[dartx.length]; |
| 1531 if (indentLength == 1) { | 1531 if (indentLength == 1) { |
| 1532 let char = indent[dartx.get](0); | 1532 let char = indent[dartx.get](0); |
| 1533 while (dart.notNull(count) > 0) { | 1533 while (dart.notNull(count) > 0) { |
| 1534 this.writeByte(char); | 1534 this.writeByte(char); |
| 1535 count = dart.notNull(count) - 1; | 1535 count = dart.notNull(count) - 1; |
| 1536 } | 1536 } |
| 1537 return; | 1537 return; |
| 1538 } | 1538 } |
| 1539 while (dart.notNull(count) > 0) { | 1539 while (dart.notNull(count) > 0) { |
| 1540 count = dart.notNull(count) - 1; | 1540 count = dart.notNull(count) - 1; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1620 }); | 1620 }); |
| 1621 let _addSliceToSink = Symbol('_addSliceToSink'); | 1621 let _addSliceToSink = Symbol('_addSliceToSink'); |
| 1622 class _Latin1DecoderSink extends ByteConversionSinkBase { | 1622 class _Latin1DecoderSink extends ByteConversionSinkBase { |
| 1623 _Latin1DecoderSink(sink) { | 1623 _Latin1DecoderSink(sink) { |
| 1624 this[_sink] = sink; | 1624 this[_sink] = sink; |
| 1625 } | 1625 } |
| 1626 close() { | 1626 close() { |
| 1627 this[_sink].close(); | 1627 this[_sink].close(); |
| 1628 } | 1628 } |
| 1629 add(source) { | 1629 add(source) { |
| 1630 this.addSlice(source, 0, source.length, false); | 1630 this.addSlice(source, 0, source[dartx.length], false); |
| 1631 } | 1631 } |
| 1632 [_addSliceToSink](source, start, end, isLast) { | 1632 [_addSliceToSink](source, start, end, isLast) { |
| 1633 this[_sink].add(core.String.fromCharCodes(source, start, end)); | 1633 this[_sink].add(core.String.fromCharCodes(source, start, end)); |
| 1634 if (dart.notNull(isLast)) | 1634 if (dart.notNull(isLast)) |
| 1635 this.close(); | 1635 this.close(); |
| 1636 } | 1636 } |
| 1637 addSlice(source, start, end, isLast) { | 1637 addSlice(source, start, end, isLast) { |
| 1638 core.RangeError.checkValidRange(start, end, source.length); | 1638 core.RangeError.checkValidRange(start, end, source[dartx.length]); |
| 1639 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { | 1639 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { |
| 1640 let char = source[dartx.get](i); | 1640 let char = source[dartx.get](i); |
| 1641 if (dart.notNull(char) > dart.notNull(_LATIN1_MASK) || dart.notNull(char
) < 0) { | 1641 if (dart.notNull(char) > dart.notNull(_LATIN1_MASK) || dart.notNull(char
) < 0) { |
| 1642 throw new core.FormatException("Source contains non-Latin-1 characters
."); | 1642 throw new core.FormatException("Source contains non-Latin-1 characters
."); |
| 1643 } | 1643 } |
| 1644 } | 1644 } |
| 1645 if (dart.notNull(start) < dart.notNull(end)) { | 1645 if (dart.notNull(start) < dart.notNull(end)) { |
| 1646 this[_addSliceToSink](source, start, end, isLast); | 1646 this[_addSliceToSink](source, start, end, isLast); |
| 1647 } | 1647 } |
| 1648 if (dart.notNull(isLast)) { | 1648 if (dart.notNull(isLast)) { |
| 1649 this.close(); | 1649 this.close(); |
| 1650 } | 1650 } |
| 1651 } | 1651 } |
| 1652 } | 1652 } |
| 1653 dart.setSignature(_Latin1DecoderSink, { | 1653 dart.setSignature(_Latin1DecoderSink, { |
| 1654 constructors: () => ({_Latin1DecoderSink: [_Latin1DecoderSink, [StringConver
sionSink]]}), | 1654 constructors: () => ({_Latin1DecoderSink: [_Latin1DecoderSink, [StringConver
sionSink]]}), |
| 1655 methods: () => ({ | 1655 methods: () => ({ |
| 1656 close: [dart.void, []], | 1656 close: [dart.void, []], |
| 1657 add: [dart.void, [core.List$(core.int)]], | 1657 add: [dart.void, [core.List$(core.int)]], |
| 1658 [_addSliceToSink]: [dart.void, [core.List$(core.int), core.int, core.int,
core.bool]] | 1658 [_addSliceToSink]: [dart.void, [core.List$(core.int), core.int, core.int,
core.bool]] |
| 1659 }) | 1659 }) |
| 1660 }); | 1660 }); |
| 1661 class _Latin1AllowInvalidDecoderSink extends _Latin1DecoderSink { | 1661 class _Latin1AllowInvalidDecoderSink extends _Latin1DecoderSink { |
| 1662 _Latin1AllowInvalidDecoderSink(sink) { | 1662 _Latin1AllowInvalidDecoderSink(sink) { |
| 1663 super._Latin1DecoderSink(sink); | 1663 super._Latin1DecoderSink(sink); |
| 1664 } | 1664 } |
| 1665 addSlice(source, start, end, isLast) { | 1665 addSlice(source, start, end, isLast) { |
| 1666 core.RangeError.checkValidRange(start, end, source.length); | 1666 core.RangeError.checkValidRange(start, end, source[dartx.length]); |
| 1667 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { | 1667 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { |
| 1668 let char = source[dartx.get](i); | 1668 let char = source[dartx.get](i); |
| 1669 if (dart.notNull(char) > dart.notNull(_LATIN1_MASK) || dart.notNull(char
) < 0) { | 1669 if (dart.notNull(char) > dart.notNull(_LATIN1_MASK) || dart.notNull(char
) < 0) { |
| 1670 if (dart.notNull(i) > dart.notNull(start)) | 1670 if (dart.notNull(i) > dart.notNull(start)) |
| 1671 this[_addSliceToSink](source, start, i, false); | 1671 this[_addSliceToSink](source, start, i, false); |
| 1672 this[_addSliceToSink](dart.const(dart.list([65533], core.int)), 0, 1,
false); | 1672 this[_addSliceToSink](dart.const(dart.list([65533], core.int)), 0, 1,
false); |
| 1673 start = dart.notNull(i) + 1; | 1673 start = dart.notNull(i) + 1; |
| 1674 } | 1674 } |
| 1675 } | 1675 } |
| 1676 if (dart.notNull(start) < dart.notNull(end)) { | 1676 if (dart.notNull(start) < dart.notNull(end)) { |
| 1677 this[_addSliceToSink](source, start, end, isLast); | 1677 this[_addSliceToSink](source, start, end, isLast); |
| 1678 } | 1678 } |
| 1679 if (dart.notNull(isLast)) { | 1679 if (dart.notNull(isLast)) { |
| 1680 this.close(); | 1680 this.close(); |
| 1681 } | 1681 } |
| 1682 } | 1682 } |
| 1683 } | 1683 } |
| 1684 dart.setSignature(_Latin1AllowInvalidDecoderSink, { | 1684 dart.setSignature(_Latin1AllowInvalidDecoderSink, { |
| 1685 constructors: () => ({_Latin1AllowInvalidDecoderSink: [_Latin1AllowInvalidDe
coderSink, [StringConversionSink]]}) | 1685 constructors: () => ({_Latin1AllowInvalidDecoderSink: [_Latin1AllowInvalidDe
coderSink, [StringConversionSink]]}) |
| 1686 }); | 1686 }); |
| 1687 class LineSplitter extends Converter$(core.String, core.List$(core.String)) { | 1687 class LineSplitter extends Converter$(core.String, core.List$(core.String)) { |
| 1688 LineSplitter() { | 1688 LineSplitter() { |
| 1689 super.Converter(); | 1689 super.Converter(); |
| 1690 } | 1690 } |
| 1691 convert(data) { | 1691 convert(data) { |
| 1692 let lines = core.List$(core.String).new(); | 1692 let lines = core.List$(core.String).new(); |
| 1693 _LineSplitterSink._addSlice(data, 0, data.length, true, dart.bind(lines, d
artx.add)); | 1693 _LineSplitterSink._addSlice(data, 0, data[dartx.length], true, dart.bind(l
ines, dartx.add)); |
| 1694 return lines; | 1694 return lines; |
| 1695 } | 1695 } |
| 1696 startChunkedConversion(sink) { | 1696 startChunkedConversion(sink) { |
| 1697 if (!dart.is(sink, StringConversionSink)) { | 1697 if (!dart.is(sink, StringConversionSink)) { |
| 1698 sink = StringConversionSink.from(dart.as(sink, core.Sink$(core.String)))
; | 1698 sink = StringConversionSink.from(dart.as(sink, core.Sink$(core.String)))
; |
| 1699 } | 1699 } |
| 1700 return new _LineSplitterSink(dart.as(sink, StringConversionSink)); | 1700 return new _LineSplitterSink(dart.as(sink, StringConversionSink)); |
| 1701 } | 1701 } |
| 1702 } | 1702 } |
| 1703 dart.setSignature(LineSplitter, { | 1703 dart.setSignature(LineSplitter, { |
| 1704 constructors: () => ({LineSplitter: [LineSplitter, []]}), | 1704 constructors: () => ({LineSplitter: [LineSplitter, []]}), |
| 1705 methods: () => ({ | 1705 methods: () => ({ |
| 1706 convert: [core.List$(core.String), [core.String]], | 1706 convert: [core.List$(core.String), [core.String]], |
| 1707 startChunkedConversion: [StringConversionSink, [core.Sink]] | 1707 startChunkedConversion: [StringConversionSink, [core.Sink]] |
| 1708 }) | 1708 }) |
| 1709 }); | 1709 }); |
| 1710 let _carry = Symbol('_carry'); | 1710 let _carry = Symbol('_carry'); |
| 1711 class _LineSplitterSink extends StringConversionSinkBase { | 1711 class _LineSplitterSink extends StringConversionSinkBase { |
| 1712 _LineSplitterSink(sink) { | 1712 _LineSplitterSink(sink) { |
| 1713 this[_sink] = sink; | 1713 this[_sink] = sink; |
| 1714 this[_carry] = null; | 1714 this[_carry] = null; |
| 1715 } | 1715 } |
| 1716 addSlice(chunk, start, end, isLast) { | 1716 addSlice(chunk, start, end, isLast) { |
| 1717 if (this[_carry] != null) { | 1717 if (this[_carry] != null) { |
| 1718 chunk = dart.notNull(this[_carry]) + dart.notNull(chunk[dartx.substring]
(start, end)); | 1718 chunk = dart.notNull(this[_carry]) + dart.notNull(chunk[dartx.substring]
(start, end)); |
| 1719 start = 0; | 1719 start = 0; |
| 1720 end = chunk.length; | 1720 end = chunk[dartx.length]; |
| 1721 this[_carry] = null; | 1721 this[_carry] = null; |
| 1722 } | 1722 } |
| 1723 this[_carry] = _LineSplitterSink._addSlice(chunk, start, end, isLast, dart
.bind(this[_sink], 'add')); | 1723 this[_carry] = _LineSplitterSink._addSlice(chunk, start, end, isLast, dart
.bind(this[_sink], 'add')); |
| 1724 if (dart.notNull(isLast)) | 1724 if (dart.notNull(isLast)) |
| 1725 this[_sink].close(); | 1725 this[_sink].close(); |
| 1726 } | 1726 } |
| 1727 close() { | 1727 close() { |
| 1728 this.addSlice('', 0, 0, true); | 1728 this.addSlice('', 0, 0, true); |
| 1729 } | 1729 } |
| 1730 static _addSlice(chunk, start, end, isLast, adder) { | 1730 static _addSlice(chunk, start, end, isLast, adder) { |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1908 }) | 1908 }) |
| 1909 }); | 1909 }); |
| 1910 _StringConversionSinkAsStringSinkAdapter._MIN_STRING_SIZE = 16; | 1910 _StringConversionSinkAsStringSinkAdapter._MIN_STRING_SIZE = 16; |
| 1911 let _stringSink = Symbol('_stringSink'); | 1911 let _stringSink = Symbol('_stringSink'); |
| 1912 class _StringSinkConversionSink extends StringConversionSinkBase { | 1912 class _StringSinkConversionSink extends StringConversionSinkBase { |
| 1913 _StringSinkConversionSink(stringSink) { | 1913 _StringSinkConversionSink(stringSink) { |
| 1914 this[_stringSink] = stringSink; | 1914 this[_stringSink] = stringSink; |
| 1915 } | 1915 } |
| 1916 close() {} | 1916 close() {} |
| 1917 addSlice(str, start, end, isLast) { | 1917 addSlice(str, start, end, isLast) { |
| 1918 if (start != 0 || end != str.length) { | 1918 if (start != 0 || end != str[dartx.length]) { |
| 1919 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNul
l(i) + 1) { | 1919 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNul
l(i) + 1) { |
| 1920 this[_stringSink].writeCharCode(str[dartx.codeUnitAt](i)); | 1920 this[_stringSink].writeCharCode(str[dartx.codeUnitAt](i)); |
| 1921 } | 1921 } |
| 1922 } else { | 1922 } else { |
| 1923 this[_stringSink].write(str); | 1923 this[_stringSink].write(str); |
| 1924 } | 1924 } |
| 1925 if (dart.notNull(isLast)) | 1925 if (dart.notNull(isLast)) |
| 1926 this.close(); | 1926 this.close(); |
| 1927 } | 1927 } |
| 1928 add(str) { | 1928 add(str) { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1961 constructors: () => ({_StringCallbackSink: [_StringCallbackSink, [_ChunkedCo
nversionCallback$(core.String)]]}) | 1961 constructors: () => ({_StringCallbackSink: [_StringCallbackSink, [_ChunkedCo
nversionCallback$(core.String)]]}) |
| 1962 }); | 1962 }); |
| 1963 class _StringAdapterSink extends StringConversionSinkBase { | 1963 class _StringAdapterSink extends StringConversionSinkBase { |
| 1964 _StringAdapterSink(sink) { | 1964 _StringAdapterSink(sink) { |
| 1965 this[_sink] = sink; | 1965 this[_sink] = sink; |
| 1966 } | 1966 } |
| 1967 add(str) { | 1967 add(str) { |
| 1968 return this[_sink].add(str); | 1968 return this[_sink].add(str); |
| 1969 } | 1969 } |
| 1970 addSlice(str, start, end, isLast) { | 1970 addSlice(str, start, end, isLast) { |
| 1971 if (start == 0 && end == str.length) { | 1971 if (start == 0 && end == str[dartx.length]) { |
| 1972 this.add(str); | 1972 this.add(str); |
| 1973 } else { | 1973 } else { |
| 1974 this.add(str[dartx.substring](start, end)); | 1974 this.add(str[dartx.substring](start, end)); |
| 1975 } | 1975 } |
| 1976 if (dart.notNull(isLast)) | 1976 if (dart.notNull(isLast)) |
| 1977 this.close(); | 1977 this.close(); |
| 1978 } | 1978 } |
| 1979 close() { | 1979 close() { |
| 1980 return this[_sink].close(); | 1980 return this[_sink].close(); |
| 1981 } | 1981 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1993 this[_sink] = sink; | 1993 this[_sink] = sink; |
| 1994 this[_decoder] = new _Utf8Decoder(stringSink, allowMalformed); | 1994 this[_decoder] = new _Utf8Decoder(stringSink, allowMalformed); |
| 1995 super.ByteConversionSink(); | 1995 super.ByteConversionSink(); |
| 1996 } | 1996 } |
| 1997 close() { | 1997 close() { |
| 1998 this[_decoder].close(); | 1998 this[_decoder].close(); |
| 1999 if (this[_sink] != null) | 1999 if (this[_sink] != null) |
| 2000 this[_sink].close(); | 2000 this[_sink].close(); |
| 2001 } | 2001 } |
| 2002 add(chunk) { | 2002 add(chunk) { |
| 2003 this.addSlice(chunk, 0, chunk.length, false); | 2003 this.addSlice(chunk, 0, chunk[dartx.length], false); |
| 2004 } | 2004 } |
| 2005 addSlice(codeUnits, startIndex, endIndex, isLast) { | 2005 addSlice(codeUnits, startIndex, endIndex, isLast) { |
| 2006 this[_decoder].convert(codeUnits, startIndex, endIndex); | 2006 this[_decoder].convert(codeUnits, startIndex, endIndex); |
| 2007 if (dart.notNull(isLast)) | 2007 if (dart.notNull(isLast)) |
| 2008 this.close(); | 2008 this.close(); |
| 2009 } | 2009 } |
| 2010 } | 2010 } |
| 2011 dart.setSignature(_Utf8StringSinkAdapter, { | 2011 dart.setSignature(_Utf8StringSinkAdapter, { |
| 2012 constructors: () => ({_Utf8StringSinkAdapter: [_Utf8StringSinkAdapter, [core
.Sink, core.StringSink, core.bool]]}), | 2012 constructors: () => ({_Utf8StringSinkAdapter: [_Utf8StringSinkAdapter, [core
.Sink, core.StringSink, core.bool]]}), |
| 2013 methods: () => ({ | 2013 methods: () => ({ |
| (...skipping 10 matching lines...) Expand all Loading... |
| 2024 this[_chunkedSink] = chunkedSink; | 2024 this[_chunkedSink] = chunkedSink; |
| 2025 this[_decoder] = new _Utf8Decoder(stringBuffer, allowMalformed); | 2025 this[_decoder] = new _Utf8Decoder(stringBuffer, allowMalformed); |
| 2026 this[_buffer] = stringBuffer; | 2026 this[_buffer] = stringBuffer; |
| 2027 super.ByteConversionSink(); | 2027 super.ByteConversionSink(); |
| 2028 } | 2028 } |
| 2029 close() { | 2029 close() { |
| 2030 this[_decoder].close(); | 2030 this[_decoder].close(); |
| 2031 if (dart.notNull(this[_buffer].isNotEmpty)) { | 2031 if (dart.notNull(this[_buffer].isNotEmpty)) { |
| 2032 let accumulated = dart.toString(this[_buffer]); | 2032 let accumulated = dart.toString(this[_buffer]); |
| 2033 this[_buffer].clear(); | 2033 this[_buffer].clear(); |
| 2034 this[_chunkedSink].addSlice(accumulated, 0, accumulated.length, true); | 2034 this[_chunkedSink].addSlice(accumulated, 0, accumulated[dartx.length], t
rue); |
| 2035 } else { | 2035 } else { |
| 2036 this[_chunkedSink].close(); | 2036 this[_chunkedSink].close(); |
| 2037 } | 2037 } |
| 2038 } | 2038 } |
| 2039 add(chunk) { | 2039 add(chunk) { |
| 2040 this.addSlice(chunk, 0, chunk.length, false); | 2040 this.addSlice(chunk, 0, chunk[dartx.length], false); |
| 2041 } | 2041 } |
| 2042 addSlice(chunk, startIndex, endIndex, isLast) { | 2042 addSlice(chunk, startIndex, endIndex, isLast) { |
| 2043 this[_decoder].convert(chunk, startIndex, endIndex); | 2043 this[_decoder].convert(chunk, startIndex, endIndex); |
| 2044 if (dart.notNull(this[_buffer].isNotEmpty)) { | 2044 if (dart.notNull(this[_buffer].isNotEmpty)) { |
| 2045 let accumulated = dart.toString(this[_buffer]); | 2045 let accumulated = dart.toString(this[_buffer]); |
| 2046 this[_chunkedSink].addSlice(accumulated, 0, accumulated.length, isLast); | 2046 this[_chunkedSink].addSlice(accumulated, 0, accumulated[dartx.length], i
sLast); |
| 2047 this[_buffer].clear(); | 2047 this[_buffer].clear(); |
| 2048 return; | 2048 return; |
| 2049 } | 2049 } |
| 2050 if (dart.notNull(isLast)) | 2050 if (dart.notNull(isLast)) |
| 2051 this.close(); | 2051 this.close(); |
| 2052 } | 2052 } |
| 2053 } | 2053 } |
| 2054 dart.defineNamedConstructor(_Utf8ConversionSink, '_'); | 2054 dart.defineNamedConstructor(_Utf8ConversionSink, '_'); |
| 2055 dart.setSignature(_Utf8ConversionSink, { | 2055 dart.setSignature(_Utf8ConversionSink, { |
| 2056 constructors: () => ({ | 2056 constructors: () => ({ |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2097 let _writeSurrogate = Symbol('_writeSurrogate'); | 2097 let _writeSurrogate = Symbol('_writeSurrogate'); |
| 2098 class Utf8Encoder extends Converter$(core.String, core.List$(core.int)) { | 2098 class Utf8Encoder extends Converter$(core.String, core.List$(core.int)) { |
| 2099 Utf8Encoder() { | 2099 Utf8Encoder() { |
| 2100 super.Converter(); | 2100 super.Converter(); |
| 2101 } | 2101 } |
| 2102 convert(string, start, end) { | 2102 convert(string, start, end) { |
| 2103 if (start === void 0) | 2103 if (start === void 0) |
| 2104 start = 0; | 2104 start = 0; |
| 2105 if (end === void 0) | 2105 if (end === void 0) |
| 2106 end = null; | 2106 end = null; |
| 2107 let stringLength = string.length; | 2107 let stringLength = string[dartx.length]; |
| 2108 core.RangeError.checkValidRange(start, end, stringLength); | 2108 core.RangeError.checkValidRange(start, end, stringLength); |
| 2109 if (end == null) | 2109 if (end == null) |
| 2110 end = stringLength; | 2110 end = stringLength; |
| 2111 let length = dart.notNull(end) - dart.notNull(start); | 2111 let length = dart.notNull(end) - dart.notNull(start); |
| 2112 if (length == 0) | 2112 if (length == 0) |
| 2113 return typed_data.Uint8List.new(0); | 2113 return typed_data.Uint8List.new(0); |
| 2114 let encoder = new _Utf8Encoder.withBufferSize(dart.notNull(length) * 3); | 2114 let encoder = new _Utf8Encoder.withBufferSize(dart.notNull(length) * 3); |
| 2115 let endPosition = encoder[_fillBuffer](string, start, end); | 2115 let endPosition = encoder[_fillBuffer](string, start, end); |
| 2116 dart.assert(dart.notNull(endPosition) >= dart.notNull(end) - 1); | 2116 dart.assert(dart.notNull(endPosition) >= dart.notNull(end) - 1); |
| 2117 if (endPosition != end) { | 2117 if (endPosition != end) { |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2198 } | 2198 } |
| 2199 } | 2199 } |
| 2200 [_fillBuffer](str, start, end) { | 2200 [_fillBuffer](str, start, end) { |
| 2201 if (start != end && dart.notNull(_isLeadSurrogate(str[dartx.codeUnitAt](da
rt.notNull(end) - 1)))) { | 2201 if (start != end && dart.notNull(_isLeadSurrogate(str[dartx.codeUnitAt](da
rt.notNull(end) - 1)))) { |
| 2202 end = dart.notNull(end) - 1; | 2202 end = dart.notNull(end) - 1; |
| 2203 } | 2203 } |
| 2204 let stringIndex = null; | 2204 let stringIndex = null; |
| 2205 for (stringIndex = start; dart.notNull(stringIndex) < dart.notNull(end); s
tringIndex = dart.notNull(stringIndex) + 1) { | 2205 for (stringIndex = start; dart.notNull(stringIndex) < dart.notNull(end); s
tringIndex = dart.notNull(stringIndex) + 1) { |
| 2206 let codeUnit = str[dartx.codeUnitAt](stringIndex); | 2206 let codeUnit = str[dartx.codeUnitAt](stringIndex); |
| 2207 if (dart.notNull(codeUnit) <= dart.notNull(_ONE_BYTE_LIMIT)) { | 2207 if (dart.notNull(codeUnit) <= dart.notNull(_ONE_BYTE_LIMIT)) { |
| 2208 if (dart.notNull(this[_bufferIndex]) >= dart.notNull(this[_buffer].len
gth)) | 2208 if (dart.notNull(this[_bufferIndex]) >= dart.notNull(this[_buffer][dar
tx.length])) |
| 2209 break; | 2209 break; |
| 2210 this[_buffer][dartx.set]((() => { | 2210 this[_buffer][dartx.set]((() => { |
| 2211 let x = this[_bufferIndex]; | 2211 let x = this[_bufferIndex]; |
| 2212 this[_bufferIndex] = dart.notNull(x) + 1; | 2212 this[_bufferIndex] = dart.notNull(x) + 1; |
| 2213 return x; | 2213 return x; |
| 2214 })(), codeUnit); | 2214 })(), codeUnit); |
| 2215 } else if (dart.notNull(_isLeadSurrogate(codeUnit))) { | 2215 } else if (dart.notNull(_isLeadSurrogate(codeUnit))) { |
| 2216 if (dart.notNull(this[_bufferIndex]) + 3 >= dart.notNull(this[_buffer]
.length)) | 2216 if (dart.notNull(this[_bufferIndex]) + 3 >= dart.notNull(this[_buffer]
[dartx.length])) |
| 2217 break; | 2217 break; |
| 2218 let nextCodeUnit = str[dartx.codeUnitAt](dart.notNull(stringIndex) + 1
); | 2218 let nextCodeUnit = str[dartx.codeUnitAt](dart.notNull(stringIndex) + 1
); |
| 2219 let wasCombined = this[_writeSurrogate](codeUnit, nextCodeUnit); | 2219 let wasCombined = this[_writeSurrogate](codeUnit, nextCodeUnit); |
| 2220 if (dart.notNull(wasCombined)) { | 2220 if (dart.notNull(wasCombined)) { |
| 2221 stringIndex = dart.notNull(stringIndex) + 1; | 2221 stringIndex = dart.notNull(stringIndex) + 1; |
| 2222 } | 2222 } |
| 2223 } else { | 2223 } else { |
| 2224 let rune = codeUnit; | 2224 let rune = codeUnit; |
| 2225 if (dart.notNull(rune) <= dart.notNull(_TWO_BYTE_LIMIT)) { | 2225 if (dart.notNull(rune) <= dart.notNull(_TWO_BYTE_LIMIT)) { |
| 2226 if (dart.notNull(this[_bufferIndex]) + 1 >= dart.notNull(this[_buffe
r].length)) | 2226 if (dart.notNull(this[_bufferIndex]) + 1 >= dart.notNull(this[_buffe
r][dartx.length])) |
| 2227 break; | 2227 break; |
| 2228 this[_buffer][dartx.set]((() => { | 2228 this[_buffer][dartx.set]((() => { |
| 2229 let x = this[_bufferIndex]; | 2229 let x = this[_bufferIndex]; |
| 2230 this[_bufferIndex] = dart.notNull(x) + 1; | 2230 this[_bufferIndex] = dart.notNull(x) + 1; |
| 2231 return x; | 2231 return x; |
| 2232 })(), 192 | dart.notNull(rune) >> 6); | 2232 })(), 192 | dart.notNull(rune) >> 6); |
| 2233 this[_buffer][dartx.set]((() => { | 2233 this[_buffer][dartx.set]((() => { |
| 2234 let x = this[_bufferIndex]; | 2234 let x = this[_bufferIndex]; |
| 2235 this[_bufferIndex] = dart.notNull(x) + 1; | 2235 this[_bufferIndex] = dart.notNull(x) + 1; |
| 2236 return x; | 2236 return x; |
| 2237 })(), 128 | dart.notNull(rune) & 63); | 2237 })(), 128 | dart.notNull(rune) & 63); |
| 2238 } else { | 2238 } else { |
| 2239 dart.assert(dart.notNull(rune) <= dart.notNull(_THREE_BYTE_LIMIT)); | 2239 dart.assert(dart.notNull(rune) <= dart.notNull(_THREE_BYTE_LIMIT)); |
| 2240 if (dart.notNull(this[_bufferIndex]) + 2 >= dart.notNull(this[_buffe
r].length)) | 2240 if (dart.notNull(this[_bufferIndex]) + 2 >= dart.notNull(this[_buffe
r][dartx.length])) |
| 2241 break; | 2241 break; |
| 2242 this[_buffer][dartx.set]((() => { | 2242 this[_buffer][dartx.set]((() => { |
| 2243 let x = this[_bufferIndex]; | 2243 let x = this[_bufferIndex]; |
| 2244 this[_bufferIndex] = dart.notNull(x) + 1; | 2244 this[_bufferIndex] = dart.notNull(x) + 1; |
| 2245 return x; | 2245 return x; |
| 2246 })(), 224 | dart.notNull(rune) >> 12); | 2246 })(), 224 | dart.notNull(rune) >> 12); |
| 2247 this[_buffer][dartx.set]((() => { | 2247 this[_buffer][dartx.set]((() => { |
| 2248 let x = this[_bufferIndex]; | 2248 let x = this[_bufferIndex]; |
| 2249 this[_bufferIndex] = dart.notNull(x) + 1; | 2249 this[_bufferIndex] = dart.notNull(x) + 1; |
| 2250 return x; | 2250 return x; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2302 dart.assert(!dart.notNull(wasCombined) || start != end); | 2302 dart.assert(!dart.notNull(wasCombined) || start != end); |
| 2303 if (dart.notNull(wasCombined)) { | 2303 if (dart.notNull(wasCombined)) { |
| 2304 start = dart.notNull(start) + 1; | 2304 start = dart.notNull(start) + 1; |
| 2305 } | 2305 } |
| 2306 this[_carry] = 0; | 2306 this[_carry] = 0; |
| 2307 } | 2307 } |
| 2308 do { | 2308 do { |
| 2309 start = this[_fillBuffer](str, start, end); | 2309 start = this[_fillBuffer](str, start, end); |
| 2310 let isLastSlice = dart.notNull(isLast) && start == end; | 2310 let isLastSlice = dart.notNull(isLast) && start == end; |
| 2311 if (start == dart.notNull(end) - 1 && dart.notNull(_isLeadSurrogate(str[
dartx.codeUnitAt](start)))) { | 2311 if (start == dart.notNull(end) - 1 && dart.notNull(_isLeadSurrogate(str[
dartx.codeUnitAt](start)))) { |
| 2312 if (dart.notNull(isLast) && dart.notNull(this[_bufferIndex]) < dart.no
tNull(this[_buffer].length) - 3) { | 2312 if (dart.notNull(isLast) && dart.notNull(this[_bufferIndex]) < dart.no
tNull(this[_buffer][dartx.length]) - 3) { |
| 2313 let hasBeenCombined = this[_writeSurrogate](str[dartx.codeUnitAt](st
art), 0); | 2313 let hasBeenCombined = this[_writeSurrogate](str[dartx.codeUnitAt](st
art), 0); |
| 2314 dart.assert(!dart.notNull(hasBeenCombined)); | 2314 dart.assert(!dart.notNull(hasBeenCombined)); |
| 2315 } else { | 2315 } else { |
| 2316 this[_carry] = str[dartx.codeUnitAt](start); | 2316 this[_carry] = str[dartx.codeUnitAt](start); |
| 2317 } | 2317 } |
| 2318 start = dart.notNull(start) + 1; | 2318 start = dart.notNull(start) + 1; |
| 2319 } | 2319 } |
| 2320 this[_sink].addSlice(this[_buffer], 0, this[_bufferIndex], isLastSlice); | 2320 this[_sink].addSlice(this[_buffer], 0, this[_bufferIndex], isLastSlice); |
| 2321 this[_bufferIndex] = 0; | 2321 this[_bufferIndex] = 0; |
| 2322 } while (dart.notNull(start) < dart.notNull(end)); | 2322 } while (dart.notNull(start) < dart.notNull(end)); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 2335 Utf8Decoder(opts) { | 2335 Utf8Decoder(opts) { |
| 2336 let allowMalformed = opts && 'allowMalformed' in opts ? opts.allowMalforme
d : false; | 2336 let allowMalformed = opts && 'allowMalformed' in opts ? opts.allowMalforme
d : false; |
| 2337 this[_allowMalformed] = allowMalformed; | 2337 this[_allowMalformed] = allowMalformed; |
| 2338 super.Converter(); | 2338 super.Converter(); |
| 2339 } | 2339 } |
| 2340 convert(codeUnits, start, end) { | 2340 convert(codeUnits, start, end) { |
| 2341 if (start === void 0) | 2341 if (start === void 0) |
| 2342 start = 0; | 2342 start = 0; |
| 2343 if (end === void 0) | 2343 if (end === void 0) |
| 2344 end = null; | 2344 end = null; |
| 2345 let length = codeUnits.length; | 2345 let length = codeUnits[dartx.length]; |
| 2346 core.RangeError.checkValidRange(start, end, length); | 2346 core.RangeError.checkValidRange(start, end, length); |
| 2347 if (end == null) | 2347 if (end == null) |
| 2348 end = length; | 2348 end = length; |
| 2349 let buffer = new core.StringBuffer(); | 2349 let buffer = new core.StringBuffer(); |
| 2350 let decoder = new _Utf8Decoder(buffer, this[_allowMalformed]); | 2350 let decoder = new _Utf8Decoder(buffer, this[_allowMalformed]); |
| 2351 decoder.convert(codeUnits, start, end); | 2351 decoder.convert(codeUnits, start, end); |
| 2352 decoder.close(); | 2352 decoder.close(); |
| 2353 return dart.toString(buffer); | 2353 return dart.toString(buffer); |
| 2354 } | 2354 } |
| 2355 startChunkedConversion(sink) { | 2355 startChunkedConversion(sink) { |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2573 if (Object.getPrototypeOf(e) === Array.prototype) { | 2573 if (Object.getPrototypeOf(e) === Array.prototype) { |
| 2574 for (let i = 0; dart.notNull(i) < e.length; i = dart.notNull(i) + 1) { | 2574 for (let i = 0; dart.notNull(i) < e.length; i = dart.notNull(i) + 1) { |
| 2575 let item = e[i]; | 2575 let item = e[i]; |
| 2576 e[i] = dart.dcall(reviver, i, walk(item)); | 2576 e[i] = dart.dcall(reviver, i, walk(item)); |
| 2577 } | 2577 } |
| 2578 return e; | 2578 return e; |
| 2579 } | 2579 } |
| 2580 let map = new _JsonMap(e); | 2580 let map = new _JsonMap(e); |
| 2581 let processed = map[_processed]; | 2581 let processed = map[_processed]; |
| 2582 let keys = map[_computeKeys](); | 2582 let keys = map[_computeKeys](); |
| 2583 for (let i = 0; dart.notNull(i) < dart.notNull(keys.length); i = dart.notN
ull(i) + 1) { | 2583 for (let i = 0; dart.notNull(i) < dart.notNull(keys[dartx.length]); i = da
rt.notNull(i) + 1) { |
| 2584 let key = keys[dartx.get](i); | 2584 let key = keys[dartx.get](i); |
| 2585 let revived = dart.dcall(reviver, key, walk(e[key])); | 2585 let revived = dart.dcall(reviver, key, walk(e[key])); |
| 2586 processed[key] = revived; | 2586 processed[key] = revived; |
| 2587 } | 2587 } |
| 2588 map[_original] = processed; | 2588 map[_original] = processed; |
| 2589 return map; | 2589 return map; |
| 2590 }; | 2590 }; |
| 2591 dart.fn(walk); | 2591 dart.fn(walk); |
| 2592 return dart.dcall(reviver, null, walk(json)); | 2592 return dart.dcall(reviver, null, walk(json)); |
| 2593 } | 2593 } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2625 } else if (!(typeof key == 'string')) { | 2625 } else if (!(typeof key == 'string')) { |
| 2626 return null; | 2626 return null; |
| 2627 } else { | 2627 } else { |
| 2628 let result = _JsonMap._getProperty(this[_processed], dart.as(key, core.S
tring)); | 2628 let result = _JsonMap._getProperty(this[_processed], dart.as(key, core.S
tring)); |
| 2629 if (dart.notNull(_JsonMap._isUnprocessed(result))) | 2629 if (dart.notNull(_JsonMap._isUnprocessed(result))) |
| 2630 result = this[_process](dart.as(key, core.String)); | 2630 result = this[_process](dart.as(key, core.String)); |
| 2631 return result; | 2631 return result; |
| 2632 } | 2632 } |
| 2633 } | 2633 } |
| 2634 get length() { | 2634 get length() { |
| 2635 return dart.notNull(this[_isUpgraded]) ? this[_upgradedMap].length : this[
_computeKeys]().length; | 2635 return dart.notNull(this[_isUpgraded]) ? this[_upgradedMap].length : this[
_computeKeys]()[dartx.length]; |
| 2636 } | 2636 } |
| 2637 get isEmpty() { | 2637 get isEmpty() { |
| 2638 return this.length == 0; | 2638 return this.length == 0; |
| 2639 } | 2639 } |
| 2640 get isNotEmpty() { | 2640 get isNotEmpty() { |
| 2641 return dart.notNull(this.length) > 0; | 2641 return dart.notNull(this.length) > 0; |
| 2642 } | 2642 } |
| 2643 get keys() { | 2643 get keys() { |
| 2644 if (dart.notNull(this[_isUpgraded])) | 2644 if (dart.notNull(this[_isUpgraded])) |
| 2645 return this[_upgradedMap].keys; | 2645 return this[_upgradedMap].keys; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 2666 } | 2666 } |
| 2667 addAll(other) { | 2667 addAll(other) { |
| 2668 other.forEach(dart.fn((key, value) => { | 2668 other.forEach(dart.fn((key, value) => { |
| 2669 this.set(key, value); | 2669 this.set(key, value); |
| 2670 })); | 2670 })); |
| 2671 } | 2671 } |
| 2672 containsValue(value) { | 2672 containsValue(value) { |
| 2673 if (dart.notNull(this[_isUpgraded])) | 2673 if (dart.notNull(this[_isUpgraded])) |
| 2674 return this[_upgradedMap].containsValue(value); | 2674 return this[_upgradedMap].containsValue(value); |
| 2675 let keys = this[_computeKeys](); | 2675 let keys = this[_computeKeys](); |
| 2676 for (let i = 0; dart.notNull(i) < dart.notNull(keys.length); i = dart.notN
ull(i) + 1) { | 2676 for (let i = 0; dart.notNull(i) < dart.notNull(keys[dartx.length]); i = da
rt.notNull(i) + 1) { |
| 2677 let key = keys[dartx.get](i); | 2677 let key = keys[dartx.get](i); |
| 2678 if (dart.equals(this.get(key), value)) | 2678 if (dart.equals(this.get(key), value)) |
| 2679 return true; | 2679 return true; |
| 2680 } | 2680 } |
| 2681 return false; | 2681 return false; |
| 2682 } | 2682 } |
| 2683 containsKey(key) { | 2683 containsKey(key) { |
| 2684 if (dart.notNull(this[_isUpgraded])) | 2684 if (dart.notNull(this[_isUpgraded])) |
| 2685 return this[_upgradedMap].containsKey(key); | 2685 return this[_upgradedMap].containsKey(key); |
| 2686 if (!(typeof key == 'string')) | 2686 if (!(typeof key == 'string')) |
| (...skipping 20 matching lines...) Expand all Loading... |
| 2707 dart.dsend(this[_data], 'clear'); | 2707 dart.dsend(this[_data], 'clear'); |
| 2708 } | 2708 } |
| 2709 this[_original] = this[_processed] = null; | 2709 this[_original] = this[_processed] = null; |
| 2710 this[_data] = dart.map(); | 2710 this[_data] = dart.map(); |
| 2711 } | 2711 } |
| 2712 } | 2712 } |
| 2713 forEach(f) { | 2713 forEach(f) { |
| 2714 if (dart.notNull(this[_isUpgraded])) | 2714 if (dart.notNull(this[_isUpgraded])) |
| 2715 return this[_upgradedMap].forEach(f); | 2715 return this[_upgradedMap].forEach(f); |
| 2716 let keys = this[_computeKeys](); | 2716 let keys = this[_computeKeys](); |
| 2717 for (let i = 0; dart.notNull(i) < dart.notNull(keys.length); i = dart.notN
ull(i) + 1) { | 2717 for (let i = 0; dart.notNull(i) < dart.notNull(keys[dartx.length]); i = da
rt.notNull(i) + 1) { |
| 2718 let key = keys[dartx.get](i); | 2718 let key = keys[dartx.get](i); |
| 2719 let value = _JsonMap._getProperty(this[_processed], key); | 2719 let value = _JsonMap._getProperty(this[_processed], key); |
| 2720 if (dart.notNull(_JsonMap._isUnprocessed(value))) { | 2720 if (dart.notNull(_JsonMap._isUnprocessed(value))) { |
| 2721 value = _convertJsonToDartLazy(_JsonMap._getProperty(this[_original],
key)); | 2721 value = _convertJsonToDartLazy(_JsonMap._getProperty(this[_original],
key)); |
| 2722 _JsonMap._setProperty(this[_processed], key, value); | 2722 _JsonMap._setProperty(this[_processed], key, value); |
| 2723 } | 2723 } |
| 2724 dart.dcall(f, key, value); | 2724 dart.dcall(f, key, value); |
| 2725 if (!dart.notNull(core.identical(keys, this[_data]))) { | 2725 if (!dart.notNull(core.identical(keys, this[_data]))) { |
| 2726 throw new core.ConcurrentModificationError(this); | 2726 throw new core.ConcurrentModificationError(this); |
| 2727 } | 2727 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 2743 if (keys == null) { | 2743 if (keys == null) { |
| 2744 keys = this[_data] = _JsonMap._getPropertyNames(this[_original]); | 2744 keys = this[_data] = _JsonMap._getPropertyNames(this[_original]); |
| 2745 } | 2745 } |
| 2746 return dart.as(keys, core.List$(core.String)); | 2746 return dart.as(keys, core.List$(core.String)); |
| 2747 } | 2747 } |
| 2748 [_upgrade]() { | 2748 [_upgrade]() { |
| 2749 if (dart.notNull(this[_isUpgraded])) | 2749 if (dart.notNull(this[_isUpgraded])) |
| 2750 return this[_upgradedMap]; | 2750 return this[_upgradedMap]; |
| 2751 let result = dart.map(); | 2751 let result = dart.map(); |
| 2752 let keys = this[_computeKeys](); | 2752 let keys = this[_computeKeys](); |
| 2753 for (let i = 0; dart.notNull(i) < dart.notNull(keys.length); i = dart.notN
ull(i) + 1) { | 2753 for (let i = 0; dart.notNull(i) < dart.notNull(keys[dartx.length]); i = da
rt.notNull(i) + 1) { |
| 2754 let key = keys[dartx.get](i); | 2754 let key = keys[dartx.get](i); |
| 2755 result.set(key, this.get(key)); | 2755 result.set(key, this.get(key)); |
| 2756 } | 2756 } |
| 2757 if (dart.notNull(keys[dartx.isEmpty])) { | 2757 if (dart.notNull(keys[dartx.isEmpty])) { |
| 2758 keys[dartx.add](null); | 2758 keys[dartx.add](null); |
| 2759 } else { | 2759 } else { |
| 2760 keys[dartx.clear](); | 2760 keys[dartx.clear](); |
| 2761 } | 2761 } |
| 2762 this[_original] = this[_processed] = null; | 2762 this[_original] = this[_processed] = null; |
| 2763 this[_data] = result; | 2763 this[_data] = result; |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2892 exports.LineSplitter = LineSplitter; | 2892 exports.LineSplitter = LineSplitter; |
| 2893 exports.StringConversionSink = StringConversionSink; | 2893 exports.StringConversionSink = StringConversionSink; |
| 2894 exports.ClosableStringSink = ClosableStringSink; | 2894 exports.ClosableStringSink = ClosableStringSink; |
| 2895 exports.UNICODE_REPLACEMENT_CHARACTER_RUNE = UNICODE_REPLACEMENT_CHARACTER_RUN
E; | 2895 exports.UNICODE_REPLACEMENT_CHARACTER_RUNE = UNICODE_REPLACEMENT_CHARACTER_RUN
E; |
| 2896 exports.UNICODE_BOM_CHARACTER_RUNE = UNICODE_BOM_CHARACTER_RUNE; | 2896 exports.UNICODE_BOM_CHARACTER_RUNE = UNICODE_BOM_CHARACTER_RUNE; |
| 2897 exports.Utf8Codec = Utf8Codec; | 2897 exports.Utf8Codec = Utf8Codec; |
| 2898 exports.UTF8 = UTF8; | 2898 exports.UTF8 = UTF8; |
| 2899 exports.Utf8Encoder = Utf8Encoder; | 2899 exports.Utf8Encoder = Utf8Encoder; |
| 2900 exports.Utf8Decoder = Utf8Decoder; | 2900 exports.Utf8Decoder = Utf8Decoder; |
| 2901 }); | 2901 }); |
| OLD | NEW |