OLD | NEW |
1 var convert; | 1 var convert; |
2 (function(exports) { | 2 (function(exports) { |
3 'use strict'; | 3 'use strict'; |
4 let ASCII = new AsciiCodec(); | 4 let ASCII = new AsciiCodec(); |
5 let _ASCII_MASK = 127; | 5 let _ASCII_MASK = 127; |
6 let _allowInvalid = Symbol('_allowInvalid'); | 6 let _allowInvalid = Symbol('_allowInvalid'); |
7 let Codec$ = dart.generic(function(S, T) { | 7 let Codec$ = dart.generic(function(S, T) { |
8 class Codec extends core.Object { | 8 class Codec extends core.Object { |
9 Codec() { | 9 Codec() { |
10 } | 10 } |
(...skipping 1167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1178 this.writeByte(128 | dart.notNull(charCode) >> 6 & 63); | 1178 this.writeByte(128 | dart.notNull(charCode) >> 6 & 63); |
1179 this.writeByte(128 | dart.notNull(charCode) & 63); | 1179 this.writeByte(128 | dart.notNull(charCode) & 63); |
1180 } | 1180 } |
1181 writeByte(byte) { | 1181 writeByte(byte) { |
1182 dart.assert(dart.notNull(byte) <= 255); | 1182 dart.assert(dart.notNull(byte) <= 255); |
1183 if (this.index === this.buffer.length) { | 1183 if (this.index === this.buffer.length) { |
1184 dart.dinvokef(this.addChunk, this.buffer, 0, this.index); | 1184 dart.dinvokef(this.addChunk, this.buffer, 0, this.index); |
1185 this.buffer = new typed_data.Uint8List(this.bufferSize); | 1185 this.buffer = new typed_data.Uint8List(this.bufferSize); |
1186 this.index = 0; | 1186 this.index = 0; |
1187 } | 1187 } |
1188 this.buffer.set(((x) => this.index = dart.notNull(x$) + 1, x$).bind(this)(
this.index), byte); | 1188 this.buffer.set(((x$) => this.index = dart.notNull(x$) + 1, x$).bind(this)
(this.index), byte); |
1189 } | 1189 } |
1190 } | 1190 } |
1191 class _JsonUtf8StringifierPretty extends dart.mixin(_JsonUtf8Stringifier, _Jso
nPrettyPrintMixin) { | 1191 class _JsonUtf8StringifierPretty extends dart.mixin(_JsonUtf8Stringifier, _Jso
nPrettyPrintMixin) { |
1192 _JsonUtf8StringifierPretty(toEncodableFunction, indent, bufferSize, addChunk
) { | 1192 _JsonUtf8StringifierPretty(toEncodableFunction, indent, bufferSize, addChunk
) { |
1193 this.indent = indent; | 1193 this.indent = indent; |
1194 super._JsonUtf8Stringifier(toEncodableFunction, dart.as(bufferSize, core.i
nt), dart.as(addChunk, core.Function)); | 1194 super._JsonUtf8Stringifier(toEncodableFunction, dart.as(bufferSize, core.i
nt), dart.as(addChunk, core.Function)); |
1195 } | 1195 } |
1196 writeIndentation(count) { | 1196 writeIndentation(count) { |
1197 let indent = this.indent; | 1197 let indent = this.indent; |
1198 let indentLength = indent.length; | 1198 let indentLength = indent.length; |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1702 this[_bufferIndex] = 0; | 1702 this[_bufferIndex] = 0; |
1703 } | 1703 } |
1704 static [_createBuffer$](size) { | 1704 static [_createBuffer$](size) { |
1705 return new typed_data.Uint8List(size); | 1705 return new typed_data.Uint8List(size); |
1706 } | 1706 } |
1707 [_writeSurrogate](leadingSurrogate, nextCodeUnit) { | 1707 [_writeSurrogate](leadingSurrogate, nextCodeUnit) { |
1708 if (_isTailSurrogate(nextCodeUnit)) { | 1708 if (_isTailSurrogate(nextCodeUnit)) { |
1709 let rune = _combineSurrogatePair(leadingSurrogate, nextCodeUnit); | 1709 let rune = _combineSurrogatePair(leadingSurrogate, nextCodeUnit); |
1710 dart.assert(dart.notNull(rune) > dart.notNull(_THREE_BYTE_LIMIT)); | 1710 dart.assert(dart.notNull(rune) > dart.notNull(_THREE_BYTE_LIMIT)); |
1711 dart.assert(dart.notNull(rune) <= dart.notNull(_FOUR_BYTE_LIMIT)); | 1711 dart.assert(dart.notNull(rune) <= dart.notNull(_FOUR_BYTE_LIMIT)); |
1712 this[_buffer].set(((x) => this[_bufferIndex] = dart.notNull(x$) + 1, x$)
.bind(this)(this[_bufferIndex]), 240 | dart.notNull(rune) >> 18); | 1712 this[_buffer].set(((x$) => this[_bufferIndex] = dart.notNull(x$) + 1, x$
).bind(this)(this[_bufferIndex]), 240 | dart.notNull(rune) >> 18); |
1713 this[_buffer].set(((x) => this[_bufferIndex] = dart.notNull(x$) + 1, x$)
.bind(this)(this[_bufferIndex]), 128 | dart.notNull(rune) >> 12 & 63); | 1713 this[_buffer].set(((x$) => this[_bufferIndex] = dart.notNull(x$) + 1, x$
).bind(this)(this[_bufferIndex]), 128 | dart.notNull(rune) >> 12 & 63); |
1714 this[_buffer].set(((x) => this[_bufferIndex] = dart.notNull(x$) + 1, x$)
.bind(this)(this[_bufferIndex]), 128 | dart.notNull(rune) >> 6 & 63); | 1714 this[_buffer].set(((x$) => this[_bufferIndex] = dart.notNull(x$) + 1, x$
).bind(this)(this[_bufferIndex]), 128 | dart.notNull(rune) >> 6 & 63); |
1715 this[_buffer].set(((x) => this[_bufferIndex] = dart.notNull(x$) + 1, x$)
.bind(this)(this[_bufferIndex]), 128 | dart.notNull(rune) & 63); | 1715 this[_buffer].set(((x$) => this[_bufferIndex] = dart.notNull(x$) + 1, x$
).bind(this)(this[_bufferIndex]), 128 | dart.notNull(rune) & 63); |
1716 return true; | 1716 return true; |
1717 } else { | 1717 } else { |
1718 this[_buffer].set(((x) => this[_bufferIndex] = dart.notNull(x$) + 1, x$)
.bind(this)(this[_bufferIndex]), 224 | dart.notNull(leadingSurrogate) >> 12); | 1718 this[_buffer].set(((x$) => this[_bufferIndex] = dart.notNull(x$) + 1, x$
).bind(this)(this[_bufferIndex]), 224 | dart.notNull(leadingSurrogate) >> 12); |
1719 this[_buffer].set(((x) => this[_bufferIndex] = dart.notNull(x$) + 1, x$)
.bind(this)(this[_bufferIndex]), 128 | dart.notNull(leadingSurrogate) >> 6 & 63)
; | 1719 this[_buffer].set(((x$) => this[_bufferIndex] = dart.notNull(x$) + 1, x$
).bind(this)(this[_bufferIndex]), 128 | dart.notNull(leadingSurrogate) >> 6 & 63
); |
1720 this[_buffer].set(((x) => this[_bufferIndex] = dart.notNull(x$) + 1, x$)
.bind(this)(this[_bufferIndex]), 128 | dart.notNull(leadingSurrogate) & 63); | 1720 this[_buffer].set(((x$) => this[_bufferIndex] = dart.notNull(x$) + 1, x$
).bind(this)(this[_bufferIndex]), 128 | dart.notNull(leadingSurrogate) & 63); |
1721 return false; | 1721 return false; |
1722 } | 1722 } |
1723 } | 1723 } |
1724 [_fillBuffer](str, start, end) { | 1724 [_fillBuffer](str, start, end) { |
1725 if (start !== end && dart.notNull(_isLeadSurrogate(str.codeUnitAt(dart.not
Null(end) - 1)))) { | 1725 if (start !== end && dart.notNull(_isLeadSurrogate(str.codeUnitAt(dart.not
Null(end) - 1)))) { |
1726 end = dart.notNull(end) - 1; | 1726 end = dart.notNull(end) - 1; |
1727 } | 1727 } |
1728 let stringIndex = null; | 1728 let stringIndex = null; |
1729 for (stringIndex = start; dart.notNull(stringIndex) < dart.notNull(end); s
tringIndex = dart.notNull(stringIndex) + 1) { | 1729 for (stringIndex = start; dart.notNull(stringIndex) < dart.notNull(end); s
tringIndex = dart.notNull(stringIndex) + 1) { |
1730 let codeUnit = str.codeUnitAt(stringIndex); | 1730 let codeUnit = str.codeUnitAt(stringIndex); |
1731 if (dart.notNull(codeUnit) <= dart.notNull(_ONE_BYTE_LIMIT)) { | 1731 if (dart.notNull(codeUnit) <= dart.notNull(_ONE_BYTE_LIMIT)) { |
1732 if (dart.notNull(this[_bufferIndex]) >= dart.notNull(this[_buffer].len
gth)) | 1732 if (dart.notNull(this[_bufferIndex]) >= dart.notNull(this[_buffer].len
gth)) |
1733 break; | 1733 break; |
1734 this[_buffer].set(((x) => this[_bufferIndex] = dart.notNull(x$) + 1, x
$).bind(this)(this[_bufferIndex]), codeUnit); | 1734 this[_buffer].set(((x$) => this[_bufferIndex] = dart.notNull(x$) + 1,
x$).bind(this)(this[_bufferIndex]), codeUnit); |
1735 } else if (_isLeadSurrogate(codeUnit)) { | 1735 } else if (_isLeadSurrogate(codeUnit)) { |
1736 if (dart.notNull(this[_bufferIndex]) + 3 >= dart.notNull(this[_buffer]
.length)) | 1736 if (dart.notNull(this[_bufferIndex]) + 3 >= dart.notNull(this[_buffer]
.length)) |
1737 break; | 1737 break; |
1738 let nextCodeUnit = str.codeUnitAt(dart.notNull(stringIndex) + 1); | 1738 let nextCodeUnit = str.codeUnitAt(dart.notNull(stringIndex) + 1); |
1739 let wasCombined = this[_writeSurrogate](codeUnit, nextCodeUnit); | 1739 let wasCombined = this[_writeSurrogate](codeUnit, nextCodeUnit); |
1740 if (wasCombined) | 1740 if (wasCombined) |
1741 stringIndex = dart.notNull(stringIndex) + 1; | 1741 stringIndex = dart.notNull(stringIndex) + 1; |
1742 } else { | 1742 } else { |
1743 let rune = codeUnit; | 1743 let rune = codeUnit; |
1744 if (dart.notNull(rune) <= dart.notNull(_TWO_BYTE_LIMIT)) { | 1744 if (dart.notNull(rune) <= dart.notNull(_TWO_BYTE_LIMIT)) { |
1745 if (dart.notNull(this[_bufferIndex]) + 1 >= dart.notNull(this[_buffe
r].length)) | 1745 if (dart.notNull(this[_bufferIndex]) + 1 >= dart.notNull(this[_buffe
r].length)) |
1746 break; | 1746 break; |
1747 this[_buffer].set(((x) => this[_bufferIndex] = dart.notNull(x$) + 1,
x$).bind(this)(this[_bufferIndex]), 192 | dart.notNull(rune) >> 6); | 1747 this[_buffer].set(((x$) => this[_bufferIndex] = dart.notNull(x$) + 1
, x$).bind(this)(this[_bufferIndex]), 192 | dart.notNull(rune) >> 6); |
1748 this[_buffer].set(((x) => this[_bufferIndex] = dart.notNull(x$) + 1,
x$).bind(this)(this[_bufferIndex]), 128 | dart.notNull(rune) & 63); | 1748 this[_buffer].set(((x$) => this[_bufferIndex] = dart.notNull(x$) + 1
, x$).bind(this)(this[_bufferIndex]), 128 | dart.notNull(rune) & 63); |
1749 } else { | 1749 } else { |
1750 dart.assert(dart.notNull(rune) <= dart.notNull(_THREE_BYTE_LIMIT)); | 1750 dart.assert(dart.notNull(rune) <= dart.notNull(_THREE_BYTE_LIMIT)); |
1751 if (dart.notNull(this[_bufferIndex]) + 2 >= dart.notNull(this[_buffe
r].length)) | 1751 if (dart.notNull(this[_bufferIndex]) + 2 >= dart.notNull(this[_buffe
r].length)) |
1752 break; | 1752 break; |
1753 this[_buffer].set(((x) => this[_bufferIndex] = dart.notNull(x$) + 1,
x$).bind(this)(this[_bufferIndex]), 224 | dart.notNull(rune) >> 12); | 1753 this[_buffer].set(((x$) => this[_bufferIndex] = dart.notNull(x$) + 1
, x$).bind(this)(this[_bufferIndex]), 224 | dart.notNull(rune) >> 12); |
1754 this[_buffer].set(((x) => this[_bufferIndex] = dart.notNull(x$) + 1,
x$).bind(this)(this[_bufferIndex]), 128 | dart.notNull(rune) >> 6 & 63); | 1754 this[_buffer].set(((x$) => this[_bufferIndex] = dart.notNull(x$) + 1
, x$).bind(this)(this[_bufferIndex]), 128 | dart.notNull(rune) >> 6 & 63); |
1755 this[_buffer].set(((x) => this[_bufferIndex] = dart.notNull(x$) + 1,
x$).bind(this)(this[_bufferIndex]), 128 | dart.notNull(rune) & 63); | 1755 this[_buffer].set(((x$) => this[_bufferIndex] = dart.notNull(x$) + 1
, x$).bind(this)(this[_bufferIndex]), 128 | dart.notNull(rune) & 63); |
1756 } | 1756 } |
1757 } | 1757 } |
1758 } | 1758 } |
1759 return stringIndex; | 1759 return stringIndex; |
1760 } | 1760 } |
1761 } | 1761 } |
1762 dart.defineNamedConstructor(_Utf8Encoder, 'withBufferSize'); | 1762 dart.defineNamedConstructor(_Utf8Encoder, 'withBufferSize'); |
1763 _Utf8Encoder._DEFAULT_BYTE_BUFFER_SIZE = 1024; | 1763 _Utf8Encoder._DEFAULT_BYTE_BUFFER_SIZE = 1024; |
1764 class _Utf8EncoderSink extends dart.mixin(_Utf8Encoder, StringConversionSinkMi
xin) { | 1764 class _Utf8EncoderSink extends dart.mixin(_Utf8Encoder, StringConversionSinkMi
xin) { |
1765 _Utf8EncoderSink(sink$) { | 1765 _Utf8EncoderSink(sink$) { |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1970 } | 1970 } |
1971 while (dart.notNull(i) < dart.notNull(endIndex)) { | 1971 while (dart.notNull(i) < dart.notNull(endIndex)) { |
1972 let oneBytes = scanOneByteCharacters(codeUnits, i); | 1972 let oneBytes = scanOneByteCharacters(codeUnits, i); |
1973 if (dart.notNull(oneBytes) > 0) { | 1973 if (dart.notNull(oneBytes) > 0) { |
1974 this[_isFirstCharacter] = false; | 1974 this[_isFirstCharacter] = false; |
1975 addSingleBytes(i, dart.notNull(i) + dart.notNull(oneBytes)); | 1975 addSingleBytes(i, dart.notNull(i) + dart.notNull(oneBytes)); |
1976 i = oneBytes; | 1976 i = oneBytes; |
1977 if (i === endIndex) | 1977 if (i === endIndex) |
1978 break; | 1978 break; |
1979 } | 1979 } |
1980 let unit = codeUnits.get(((x) => i = dart.notNull(x$) + 1, x$)(i)); | 1980 let unit = codeUnits.get(((x$) => i = dart.notNull(x$) + 1, x$)(i)); |
1981 if (dart.notNull(unit) < 0) { | 1981 if (dart.notNull(unit) < 0) { |
1982 if (!dart.notNull(this[_allowMalformed])) { | 1982 if (!dart.notNull(this[_allowMalformed])) { |
1983 throw new core.FormatException(`Negative UTF-8 code unit: -0x${(
-dart.notNull(unit)).toRadixString(16)}`); | 1983 throw new core.FormatException(`Negative UTF-8 code unit: -0x${(
-dart.notNull(unit)).toRadixString(16)}`); |
1984 } | 1984 } |
1985 this[_stringSink].writeCharCode(UNICODE_REPLACEMENT_CHARACTER_RUNE
); | 1985 this[_stringSink].writeCharCode(UNICODE_REPLACEMENT_CHARACTER_RUNE
); |
1986 } else { | 1986 } else { |
1987 dart.assert(dart.notNull(unit) > dart.notNull(_ONE_BYTE_LIMIT)); | 1987 dart.assert(dart.notNull(unit) > dart.notNull(_ONE_BYTE_LIMIT)); |
1988 if ((dart.notNull(unit) & 224) === 192) { | 1988 if ((dart.notNull(unit) & 224) === 192) { |
1989 value = dart.notNull(unit) & 31; | 1989 value = dart.notNull(unit) & 31; |
1990 expectedUnits = extraUnits = 1; | 1990 expectedUnits = extraUnits = 1; |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2321 exports.LineSplitter = LineSplitter; | 2321 exports.LineSplitter = LineSplitter; |
2322 exports.StringConversionSink = StringConversionSink; | 2322 exports.StringConversionSink = StringConversionSink; |
2323 exports.ClosableStringSink = ClosableStringSink; | 2323 exports.ClosableStringSink = ClosableStringSink; |
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 |