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 28 matching lines...) Expand all Loading... |
39 } | 39 } |
40 } | 40 } |
41 dart.defineLazyProperties(Encoding, { | 41 dart.defineLazyProperties(Encoding, { |
42 get _nameToEncoding() { | 42 get _nameToEncoding() { |
43 return dart.map({"iso_8859-1:1987": LATIN1, "iso-ir-100": LATIN1, "iso_885
9-1": LATIN1, "iso-8859-1": LATIN1, latin1: LATIN1, l1: LATIN1, ibm819: LATIN1,
cp819: LATIN1, csisolatin1: LATIN1, "iso-ir-6": ASCII, "ansi_x3.4-1968": ASCII,
"ansi_x3.4-1986": ASCII, "iso_646.irv:1991": ASCII, "iso646-us": ASCII, "us-asci
i": ASCII, us: ASCII, ibm367: ASCII, cp367: ASCII, csascii: ASCII, ascii: ASCII,
csutf8: UTF8, "utf-8": UTF8}); | 43 return dart.map({"iso_8859-1:1987": LATIN1, "iso-ir-100": LATIN1, "iso_885
9-1": LATIN1, "iso-8859-1": LATIN1, latin1: LATIN1, l1: LATIN1, ibm819: LATIN1,
cp819: LATIN1, csisolatin1: LATIN1, "iso-ir-6": ASCII, "ansi_x3.4-1968": ASCII,
"ansi_x3.4-1986": ASCII, "iso_646.irv:1991": ASCII, "iso646-us": ASCII, "us-asci
i": ASCII, us: ASCII, ibm367: ASCII, cp367: ASCII, csascii: ASCII, ascii: ASCII,
csutf8: UTF8, "utf-8": UTF8}); |
44 }, | 44 }, |
45 set _nameToEncoding(_) {} | 45 set _nameToEncoding(_) {} |
46 }); | 46 }); |
47 class AsciiCodec extends Encoding { | 47 class AsciiCodec extends Encoding { |
48 AsciiCodec(opt$) { | 48 AsciiCodec(opt$) { |
49 let allowInvalid = opt$.allowInvalid === void 0 ? false : opt$.allowInvali
d; | 49 let allowInvalid = opt$ && 'allowInvalid' in opt$ ? opt$.allowInvalid : fa
lse; |
50 this[_allowInvalid] = allowInvalid; | 50 this[_allowInvalid] = allowInvalid; |
51 super.Encoding(); | 51 super.Encoding(); |
52 } | 52 } |
53 get name() { | 53 get name() { |
54 return "us-ascii"; | 54 return "us-ascii"; |
55 } | 55 } |
56 decode(bytes, opt$) { | 56 decode(bytes, opt$) { |
57 let allowInvalid = opt$.allowInvalid === void 0 ? null : opt$.allowInvalid
; | 57 let allowInvalid = opt$ && 'allowInvalid' in opt$ ? opt$.allowInvalid : nu
ll; |
58 if (allowInvalid === null) | 58 if (allowInvalid === null) |
59 allowInvalid = this[_allowInvalid]; | 59 allowInvalid = this[_allowInvalid]; |
60 if (allowInvalid) { | 60 if (allowInvalid) { |
61 return new AsciiDecoder({allowInvalid: true}).convert(bytes); | 61 return new AsciiDecoder({allowInvalid: true}).convert(bytes); |
62 } else { | 62 } else { |
63 return new AsciiDecoder({allowInvalid: false}).convert(bytes); | 63 return new AsciiDecoder({allowInvalid: false}).convert(bytes); |
64 } | 64 } |
65 } | 65 } |
66 get encoder() { | 66 get encoder() { |
67 return new AsciiEncoder(); | 67 return new AsciiEncoder(); |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 buffer.writeCharCode(value); | 202 buffer.writeCharCode(value); |
203 } | 203 } |
204 return buffer.toString(); | 204 return buffer.toString(); |
205 } | 205 } |
206 bind(stream) { | 206 bind(stream) { |
207 return dart.as(super.bind(stream), async.Stream$(core.String)); | 207 return dart.as(super.bind(stream), async.Stream$(core.String)); |
208 } | 208 } |
209 } | 209 } |
210 class AsciiDecoder extends _UnicodeSubsetDecoder { | 210 class AsciiDecoder extends _UnicodeSubsetDecoder { |
211 AsciiDecoder(opt$) { | 211 AsciiDecoder(opt$) { |
212 let allowInvalid = opt$.allowInvalid === void 0 ? false : opt$.allowInvali
d; | 212 let allowInvalid = opt$ && 'allowInvalid' in opt$ ? opt$.allowInvalid : fa
lse; |
213 super._UnicodeSubsetDecoder(allowInvalid, _ASCII_MASK); | 213 super._UnicodeSubsetDecoder(allowInvalid, _ASCII_MASK); |
214 } | 214 } |
215 startChunkedConversion(sink) { | 215 startChunkedConversion(sink) { |
216 let stringSink = null; | 216 let stringSink = null; |
217 if (dart.is(sink, StringConversionSink)) { | 217 if (dart.is(sink, StringConversionSink)) { |
218 stringSink = sink; | 218 stringSink = sink; |
219 } else { | 219 } else { |
220 stringSink = new StringConversionSink.from(sink); | 220 stringSink = new StringConversionSink.from(sink); |
221 } | 221 } |
222 if (this[_allowInvalid]) { | 222 if (this[_allowInvalid]) { |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 if (isLast) | 575 if (isLast) |
576 this[_sink].close(); | 576 this[_sink].close(); |
577 } | 577 } |
578 } | 578 } |
579 close() { | 579 close() { |
580 return this[_sink].close(); | 580 return this[_sink].close(); |
581 } | 581 } |
582 } | 582 } |
583 class JsonUnsupportedObjectError extends core.Error { | 583 class JsonUnsupportedObjectError extends core.Error { |
584 JsonUnsupportedObjectError(unsupportedObject, opt$) { | 584 JsonUnsupportedObjectError(unsupportedObject, opt$) { |
585 let cause = opt$.cause === void 0 ? null : opt$.cause; | 585 let cause = opt$ && 'cause' in opt$ ? opt$.cause : null; |
586 this.unsupportedObject = unsupportedObject; | 586 this.unsupportedObject = unsupportedObject; |
587 this.cause = cause; | 587 this.cause = cause; |
588 super.Error(); | 588 super.Error(); |
589 } | 589 } |
590 toString() { | 590 toString() { |
591 if (this.cause !== null) { | 591 if (this.cause !== null) { |
592 return "Converting object to an encodable object failed."; | 592 return "Converting object to an encodable object failed."; |
593 } else { | 593 } else { |
594 return "Converting object did not return an encodable object."; | 594 return "Converting object did not return an encodable object."; |
595 } | 595 } |
596 } | 596 } |
597 } | 597 } |
598 class JsonCyclicError extends JsonUnsupportedObjectError { | 598 class JsonCyclicError extends JsonUnsupportedObjectError { |
599 JsonCyclicError(object) { | 599 JsonCyclicError(object) { |
600 super.JsonUnsupportedObjectError(object); | 600 super.JsonUnsupportedObjectError(object); |
601 } | 601 } |
602 toString() { | 602 toString() { |
603 return "Cyclic error in JSON stringify"; | 603 return "Cyclic error in JSON stringify"; |
604 } | 604 } |
605 } | 605 } |
606 let JSON = new JsonCodec(); | 606 let JSON = new JsonCodec(); |
607 let _reviver = Symbol('_reviver'); | 607 let _reviver = Symbol('_reviver'); |
608 let _toEncodable = Symbol('_toEncodable'); | 608 let _toEncodable = Symbol('_toEncodable'); |
609 class JsonCodec extends Codec$(core.Object, core.String) { | 609 class JsonCodec extends Codec$(core.Object, core.String) { |
610 JsonCodec(opt$) { | 610 JsonCodec(opt$) { |
611 let reviver = opt$.reviver === void 0 ? null : opt$.reviver; | 611 let reviver = opt$ && 'reviver' in opt$ ? opt$.reviver : null; |
612 let toEncodable = opt$.toEncodable === void 0 ? null : opt$.toEncodable; | 612 let toEncodable = opt$ && 'toEncodable' in opt$ ? opt$.toEncodable : null; |
613 this[_reviver] = reviver; | 613 this[_reviver] = reviver; |
614 this[_toEncodable] = toEncodable; | 614 this[_toEncodable] = toEncodable; |
615 super.Codec(); | 615 super.Codec(); |
616 } | 616 } |
617 JsonCodec$withReviver(reviver) { | 617 JsonCodec$withReviver(reviver) { |
618 this.JsonCodec({reviver: reviver}); | 618 this.JsonCodec({reviver: reviver}); |
619 } | 619 } |
620 decode(source, opt$) { | 620 decode(source, opt$) { |
621 let reviver = opt$.reviver === void 0 ? null : opt$.reviver; | 621 let reviver = opt$ && 'reviver' in opt$ ? opt$.reviver : null; |
622 if (reviver === null) | 622 if (reviver === null) |
623 reviver = this[_reviver]; | 623 reviver = this[_reviver]; |
624 if (reviver === null) | 624 if (reviver === null) |
625 return this.decoder.convert(source); | 625 return this.decoder.convert(source); |
626 return new JsonDecoder(reviver).convert(source); | 626 return new JsonDecoder(reviver).convert(source); |
627 } | 627 } |
628 encode(value, opt$) { | 628 encode(value, opt$) { |
629 let toEncodable = opt$.toEncodable === void 0 ? null : opt$.toEncodable; | 629 let toEncodable = opt$ && 'toEncodable' in opt$ ? opt$.toEncodable : null; |
630 if (toEncodable === null) | 630 if (toEncodable === null) |
631 toEncodable = this[_toEncodable]; | 631 toEncodable = this[_toEncodable]; |
632 if (toEncodable === null) | 632 if (toEncodable === null) |
633 return this.encoder.convert(value); | 633 return this.encoder.convert(value); |
634 return new JsonEncoder(dart.closureWrap(toEncodable, "(Object) → Object"))
.convert(value); | 634 return new JsonEncoder(dart.closureWrap(toEncodable, "(Object) → Object"))
.convert(value); |
635 } | 635 } |
636 get encoder() { | 636 get encoder() { |
637 if (this[_toEncodable] === null) | 637 if (this[_toEncodable] === null) |
638 return new JsonEncoder(); | 638 return new JsonEncoder(); |
639 return new JsonEncoder(dart.closureWrap(this[_toEncodable], "(Object) → Ob
ject")); | 639 return new JsonEncoder(dart.closureWrap(this[_toEncodable], "(Object) → Ob
ject")); |
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1215 this.writeByte(indent.get(i)); | 1215 this.writeByte(indent.get(i)); |
1216 } | 1216 } |
1217 } | 1217 } |
1218 } | 1218 } |
1219 } | 1219 } |
1220 } | 1220 } |
1221 let LATIN1 = new Latin1Codec(); | 1221 let LATIN1 = new Latin1Codec(); |
1222 let _LATIN1_MASK = 255; | 1222 let _LATIN1_MASK = 255; |
1223 class Latin1Codec extends Encoding { | 1223 class Latin1Codec extends Encoding { |
1224 Latin1Codec(opt$) { | 1224 Latin1Codec(opt$) { |
1225 let allowInvalid = opt$.allowInvalid === void 0 ? false : opt$.allowInvali
d; | 1225 let allowInvalid = opt$ && 'allowInvalid' in opt$ ? opt$.allowInvalid : fa
lse; |
1226 this[_allowInvalid] = allowInvalid; | 1226 this[_allowInvalid] = allowInvalid; |
1227 super.Encoding(); | 1227 super.Encoding(); |
1228 } | 1228 } |
1229 get name() { | 1229 get name() { |
1230 return "iso-8859-1"; | 1230 return "iso-8859-1"; |
1231 } | 1231 } |
1232 decode(bytes, opt$) { | 1232 decode(bytes, opt$) { |
1233 let allowInvalid = opt$.allowInvalid === void 0 ? null : opt$.allowInvalid
; | 1233 let allowInvalid = opt$ && 'allowInvalid' in opt$ ? opt$.allowInvalid : nu
ll; |
1234 if (allowInvalid === null) | 1234 if (allowInvalid === null) |
1235 allowInvalid = this[_allowInvalid]; | 1235 allowInvalid = this[_allowInvalid]; |
1236 if (allowInvalid) { | 1236 if (allowInvalid) { |
1237 return new Latin1Decoder({allowInvalid: true}).convert(bytes); | 1237 return new Latin1Decoder({allowInvalid: true}).convert(bytes); |
1238 } else { | 1238 } else { |
1239 return new Latin1Decoder({allowInvalid: false}).convert(bytes); | 1239 return new Latin1Decoder({allowInvalid: false}).convert(bytes); |
1240 } | 1240 } |
1241 } | 1241 } |
1242 get encoder() { | 1242 get encoder() { |
1243 return new Latin1Encoder(); | 1243 return new Latin1Encoder(); |
1244 } | 1244 } |
1245 get decoder() { | 1245 get decoder() { |
1246 return this[_allowInvalid] ? new Latin1Decoder({allowInvalid: true}) : new
Latin1Decoder({allowInvalid: false}); | 1246 return this[_allowInvalid] ? new Latin1Decoder({allowInvalid: true}) : new
Latin1Decoder({allowInvalid: false}); |
1247 } | 1247 } |
1248 } | 1248 } |
1249 class Latin1Encoder extends _UnicodeSubsetEncoder { | 1249 class Latin1Encoder extends _UnicodeSubsetEncoder { |
1250 Latin1Encoder() { | 1250 Latin1Encoder() { |
1251 super._UnicodeSubsetEncoder(_LATIN1_MASK); | 1251 super._UnicodeSubsetEncoder(_LATIN1_MASK); |
1252 } | 1252 } |
1253 } | 1253 } |
1254 class Latin1Decoder extends _UnicodeSubsetDecoder { | 1254 class Latin1Decoder extends _UnicodeSubsetDecoder { |
1255 Latin1Decoder(opt$) { | 1255 Latin1Decoder(opt$) { |
1256 let allowInvalid = opt$.allowInvalid === void 0 ? false : opt$.allowInvali
d; | 1256 let allowInvalid = opt$ && 'allowInvalid' in opt$ ? opt$.allowInvalid : fa
lse; |
1257 super._UnicodeSubsetDecoder(allowInvalid, _LATIN1_MASK); | 1257 super._UnicodeSubsetDecoder(allowInvalid, _LATIN1_MASK); |
1258 } | 1258 } |
1259 startChunkedConversion(sink) { | 1259 startChunkedConversion(sink) { |
1260 let stringSink = null; | 1260 let stringSink = null; |
1261 if (dart.is(sink, StringConversionSink)) { | 1261 if (dart.is(sink, StringConversionSink)) { |
1262 stringSink = sink; | 1262 stringSink = sink; |
1263 } else { | 1263 } else { |
1264 stringSink = new StringConversionSink.from(sink); | 1264 stringSink = new StringConversionSink.from(sink); |
1265 } | 1265 } |
1266 if (!dart.notNull(this[_allowInvalid])) | 1266 if (!dart.notNull(this[_allowInvalid])) |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1624 this.close(); | 1624 this.close(); |
1625 } | 1625 } |
1626 } | 1626 } |
1627 dart.defineNamedConstructor(_Utf8ConversionSink, '_'); | 1627 dart.defineNamedConstructor(_Utf8ConversionSink, '_'); |
1628 let UNICODE_REPLACEMENT_CHARACTER_RUNE = 65533; | 1628 let UNICODE_REPLACEMENT_CHARACTER_RUNE = 65533; |
1629 let UNICODE_BOM_CHARACTER_RUNE = 65279; | 1629 let UNICODE_BOM_CHARACTER_RUNE = 65279; |
1630 let UTF8 = new Utf8Codec(); | 1630 let UTF8 = new Utf8Codec(); |
1631 let _allowMalformed = Symbol('_allowMalformed'); | 1631 let _allowMalformed = Symbol('_allowMalformed'); |
1632 class Utf8Codec extends Encoding { | 1632 class Utf8Codec extends Encoding { |
1633 Utf8Codec(opt$) { | 1633 Utf8Codec(opt$) { |
1634 let allowMalformed = opt$.allowMalformed === void 0 ? false : opt$.allowMa
lformed; | 1634 let allowMalformed = opt$ && 'allowMalformed' in opt$ ? opt$.allowMalforme
d : false; |
1635 this[_allowMalformed] = allowMalformed; | 1635 this[_allowMalformed] = allowMalformed; |
1636 super.Encoding(); | 1636 super.Encoding(); |
1637 } | 1637 } |
1638 get name() { | 1638 get name() { |
1639 return "utf-8"; | 1639 return "utf-8"; |
1640 } | 1640 } |
1641 decode(codeUnits, opt$) { | 1641 decode(codeUnits, opt$) { |
1642 let allowMalformed = opt$.allowMalformed === void 0 ? null : opt$.allowMal
formed; | 1642 let allowMalformed = opt$ && 'allowMalformed' in opt$ ? opt$.allowMalforme
d : null; |
1643 if (allowMalformed === null) | 1643 if (allowMalformed === null) |
1644 allowMalformed = this[_allowMalformed]; | 1644 allowMalformed = this[_allowMalformed]; |
1645 return new Utf8Decoder({allowMalformed: allowMalformed}).convert(codeUnits
); | 1645 return new Utf8Decoder({allowMalformed: allowMalformed}).convert(codeUnits
); |
1646 } | 1646 } |
1647 get encoder() { | 1647 get encoder() { |
1648 return new Utf8Encoder(); | 1648 return new Utf8Encoder(); |
1649 } | 1649 } |
1650 get decoder() { | 1650 get decoder() { |
1651 return new Utf8Decoder({allowMalformed: this[_allowMalformed]}); | 1651 return new Utf8Decoder({allowMalformed: this[_allowMalformed]}); |
1652 } | 1652 } |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1805 } | 1805 } |
1806 this[_sink].addSlice(this[_buffer], 0, this[_bufferIndex], isLastSlice); | 1806 this[_sink].addSlice(this[_buffer], 0, this[_bufferIndex], isLastSlice); |
1807 this[_bufferIndex] = 0; | 1807 this[_bufferIndex] = 0; |
1808 } while (dart.notNull(start) < dart.notNull(end)); | 1808 } while (dart.notNull(start) < dart.notNull(end)); |
1809 if (isLast) | 1809 if (isLast) |
1810 this.close(); | 1810 this.close(); |
1811 } | 1811 } |
1812 } | 1812 } |
1813 class Utf8Decoder extends Converter$(core.List$(core.int), core.String) { | 1813 class Utf8Decoder extends Converter$(core.List$(core.int), core.String) { |
1814 Utf8Decoder(opt$) { | 1814 Utf8Decoder(opt$) { |
1815 let allowMalformed = opt$.allowMalformed === void 0 ? false : opt$.allowMa
lformed; | 1815 let allowMalformed = opt$ && 'allowMalformed' in opt$ ? opt$.allowMalforme
d : false; |
1816 this[_allowMalformed] = allowMalformed; | 1816 this[_allowMalformed] = allowMalformed; |
1817 super.Converter(); | 1817 super.Converter(); |
1818 } | 1818 } |
1819 convert(codeUnits, start, end) { | 1819 convert(codeUnits, start, end) { |
1820 if (start === void 0) | 1820 if (start === void 0) |
1821 start = 0; | 1821 start = 0; |
1822 if (end === void 0) | 1822 if (end === void 0) |
1823 end = null; | 1823 end = null; |
1824 let length = codeUnits.length; | 1824 let length = codeUnits.length; |
1825 core.RangeError.checkValidRange(start, end, length); | 1825 core.RangeError.checkValidRange(start, end, length); |
(...skipping 495 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 |