OLD | NEW |
1 var convert = dart.defineLibrary(convert, {}); | 1 var convert = dart.defineLibrary(convert, {}); |
2 var core = dart.import(core); | 2 var core = dart.import(core); |
3 var async = dart.lazyImport(async); | 3 var async = dart.import(async); |
4 var typed_data = dart.lazyImport(typed_data); | 4 var typed_data = dart.import(typed_data); |
5 var _internal = dart.import(_internal); | 5 var _internal = dart.import(_internal); |
6 var collection = dart.import(collection); | 6 var collection = dart.import(collection); |
7 (function(exports, core, async, typed_data, _internal, collection) { | 7 (function(exports, core, async, typed_data, _internal, collection) { |
8 'use strict'; | 8 'use strict'; |
9 let ASCII = dart.const(new AsciiCodec()); | |
10 let _ASCII_MASK = 127; | |
11 let _allowInvalid = Symbol('_allowInvalid'); | |
12 let Codec$ = dart.generic(function(S, T) { | 9 let Codec$ = dart.generic(function(S, T) { |
13 class Codec extends core.Object { | 10 class Codec extends core.Object { |
14 Codec() { | 11 Codec() { |
15 } | 12 } |
16 encode(input) { | 13 encode(input) { |
17 dart.as(input, S); | 14 dart.as(input, S); |
18 return this.encoder.convert(input); | 15 return this.encoder.convert(input); |
19 } | 16 } |
20 decode(encoded) { | 17 decode(encoded) { |
21 dart.as(encoded, T); | 18 dart.as(encoded, T); |
(...skipping 20 matching lines...) Expand all Loading... |
42 return buffer; | 39 return buffer; |
43 })())).then(buffer => dart.toString(buffer)), async.Future$(core.String)); | 40 })())).then(buffer => dart.toString(buffer)), async.Future$(core.String)); |
44 } | 41 } |
45 static getByName(name) { | 42 static getByName(name) { |
46 if (name == null) | 43 if (name == null) |
47 return null; | 44 return null; |
48 name = name.toLowerCase(); | 45 name = name.toLowerCase(); |
49 return Encoding._nameToEncoding.get(name); | 46 return Encoding._nameToEncoding.get(name); |
50 } | 47 } |
51 } | 48 } |
52 dart.defineLazyProperties(Encoding, { | 49 let _allowInvalid = Symbol('_allowInvalid'); |
53 get _nameToEncoding() { | |
54 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}); | |
55 }, | |
56 set _nameToEncoding(_) {} | |
57 }); | |
58 class AsciiCodec extends Encoding { | 50 class AsciiCodec extends Encoding { |
59 AsciiCodec(opts) { | 51 AsciiCodec(opts) { |
60 let allowInvalid = opts && 'allowInvalid' in opts ? opts.allowInvalid : fa
lse; | 52 let allowInvalid = opts && 'allowInvalid' in opts ? opts.allowInvalid : fa
lse; |
61 this[_allowInvalid] = allowInvalid; | 53 this[_allowInvalid] = allowInvalid; |
62 super.Encoding(); | 54 super.Encoding(); |
63 } | 55 } |
64 get name() { | 56 get name() { |
65 return "us-ascii"; | 57 return "us-ascii"; |
66 } | 58 } |
67 decode(bytes, opts) { | 59 decode(bytes, opts) { |
68 let allowInvalid = opts && 'allowInvalid' in opts ? opts.allowInvalid : nu
ll; | 60 let allowInvalid = opts && 'allowInvalid' in opts ? opts.allowInvalid : nu
ll; |
69 if (allowInvalid == null) | 61 if (allowInvalid == null) |
70 allowInvalid = this[_allowInvalid]; | 62 allowInvalid = this[_allowInvalid]; |
71 if (allowInvalid) { | 63 if (allowInvalid) { |
72 return dart.const(new AsciiDecoder({allowInvalid: true})).convert(bytes)
; | 64 return dart.const(new AsciiDecoder({allowInvalid: true})).convert(bytes)
; |
73 } else { | 65 } else { |
74 return dart.const(new AsciiDecoder({allowInvalid: false})).convert(bytes
); | 66 return dart.const(new AsciiDecoder({allowInvalid: false})).convert(bytes
); |
75 } | 67 } |
76 } | 68 } |
77 get encoder() { | 69 get encoder() { |
78 return dart.const(new AsciiEncoder()); | 70 return dart.const(new AsciiEncoder()); |
79 } | 71 } |
80 get decoder() { | 72 get decoder() { |
81 return this[_allowInvalid] ? dart.const(new AsciiDecoder({allowInvalid: tr
ue})) : dart.const(new AsciiDecoder({allowInvalid: false})); | 73 return this[_allowInvalid] ? dart.const(new AsciiDecoder({allowInvalid: tr
ue})) : dart.const(new AsciiDecoder({allowInvalid: false})); |
82 } | 74 } |
83 } | 75 } |
84 let _subsetMask = Symbol('_subsetMask'); | 76 let ASCII = dart.const(new AsciiCodec()); |
| 77 let _ASCII_MASK = 127; |
85 let Converter$ = dart.generic(function(S, T) { | 78 let Converter$ = dart.generic(function(S, T) { |
86 class Converter extends core.Object { | 79 class Converter extends core.Object { |
87 Converter() { | 80 Converter() { |
88 } | 81 } |
89 fuse(other) { | 82 fuse(other) { |
90 dart.as(other, Converter$(T, dart.dynamic)); | 83 dart.as(other, Converter$(T, dart.dynamic)); |
91 return new (_FusedConverter$(S, T, dart.dynamic))(this, other); | 84 return new (_FusedConverter$(S, T, dart.dynamic))(this, other); |
92 } | 85 } |
93 startChunkedConversion(sink) { | 86 startChunkedConversion(sink) { |
94 dart.as(sink, core.Sink$(T)); | 87 dart.as(sink, core.Sink$(T)); |
95 throw new core.UnsupportedError(`This converter does not support chunked
conversions: ${this}`); | 88 throw new core.UnsupportedError(`This converter does not support chunked
conversions: ${this}`); |
96 } | 89 } |
97 bind(source) { | 90 bind(source) { |
98 dart.as(source, async.Stream$(S)); | 91 dart.as(source, async.Stream$(S)); |
99 return new (async.Stream$(T)).eventTransformed(source, (sink => new _Con
verterStreamEventSink(this, sink)).bind(this)); | 92 return new (async.Stream$(T)).eventTransformed(source, (sink => new _Con
verterStreamEventSink(this, sink)).bind(this)); |
100 } | 93 } |
101 } | 94 } |
102 Converter[dart.implements] = () => [async.StreamTransformer$(S, T)]; | 95 Converter[dart.implements] = () => [async.StreamTransformer$(S, T)]; |
103 return Converter; | 96 return Converter; |
104 }); | 97 }); |
105 let Converter = Converter$(); | 98 let Converter = Converter$(); |
| 99 let _subsetMask = Symbol('_subsetMask'); |
106 class _UnicodeSubsetEncoder extends Converter$(core.String, core.List$(core.in
t)) { | 100 class _UnicodeSubsetEncoder extends Converter$(core.String, core.List$(core.in
t)) { |
107 _UnicodeSubsetEncoder(subsetMask) { | 101 _UnicodeSubsetEncoder(subsetMask) { |
108 this[_subsetMask] = subsetMask; | 102 this[_subsetMask] = subsetMask; |
109 super.Converter(); | 103 super.Converter(); |
110 } | 104 } |
111 convert(string, start, end) { | 105 convert(string, start, end) { |
112 if (start === void 0) | 106 if (start === void 0) |
113 start = 0; | 107 start = 0; |
114 if (end === void 0) | 108 if (end === void 0) |
115 end = null; | 109 end = null; |
(...skipping 20 matching lines...) Expand all Loading... |
136 } | 130 } |
137 bind(stream) { | 131 bind(stream) { |
138 return super.bind(stream); | 132 return super.bind(stream); |
139 } | 133 } |
140 } | 134 } |
141 class AsciiEncoder extends _UnicodeSubsetEncoder { | 135 class AsciiEncoder extends _UnicodeSubsetEncoder { |
142 AsciiEncoder() { | 136 AsciiEncoder() { |
143 super._UnicodeSubsetEncoder(_ASCII_MASK); | 137 super._UnicodeSubsetEncoder(_ASCII_MASK); |
144 } | 138 } |
145 } | 139 } |
146 let _sink = Symbol('_sink'); | |
147 class StringConversionSinkMixin extends core.Object { | 140 class StringConversionSinkMixin extends core.Object { |
148 add(str) { | 141 add(str) { |
149 return this.addSlice(str, 0, str.length, false); | 142 return this.addSlice(str, 0, str.length, false); |
150 } | 143 } |
151 asUtf8Sink(allowMalformed) { | 144 asUtf8Sink(allowMalformed) { |
152 return new _Utf8ConversionSink(this, allowMalformed); | 145 return new _Utf8ConversionSink(this, allowMalformed); |
153 } | 146 } |
154 asStringSink() { | 147 asStringSink() { |
155 return new _StringConversionSinkAsStringSinkAdapter(this); | 148 return new _StringConversionSinkAsStringSinkAdapter(this); |
156 } | 149 } |
157 } | 150 } |
158 StringConversionSinkMixin[dart.implements] = () => [StringConversionSink]; | 151 StringConversionSinkMixin[dart.implements] = () => [StringConversionSink]; |
159 class StringConversionSinkBase extends StringConversionSinkMixin {} | 152 class StringConversionSinkBase extends StringConversionSinkMixin {} |
| 153 let _sink = Symbol('_sink'); |
160 class _UnicodeSubsetEncoderSink extends StringConversionSinkBase { | 154 class _UnicodeSubsetEncoderSink extends StringConversionSinkBase { |
161 _UnicodeSubsetEncoderSink(subsetMask, sink) { | 155 _UnicodeSubsetEncoderSink(subsetMask, sink) { |
162 this[_subsetMask] = subsetMask; | 156 this[_subsetMask] = subsetMask; |
163 this[_sink] = sink; | 157 this[_sink] = sink; |
164 } | 158 } |
165 close() { | 159 close() { |
166 this[_sink].close(); | 160 this[_sink].close(); |
167 } | 161 } |
168 addSlice(source, start, end, isLast) { | 162 addSlice(source, start, end, isLast) { |
169 core.RangeError.checkValidRange(start, end, source.length); | 163 core.RangeError.checkValidRange(start, end, source.length); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 } else { | 227 } else { |
234 stringSink = new StringConversionSink.from(sink); | 228 stringSink = new StringConversionSink.from(sink); |
235 } | 229 } |
236 if (this[_allowInvalid]) { | 230 if (this[_allowInvalid]) { |
237 return new _ErrorHandlingAsciiDecoderSink(stringSink.asUtf8Sink(false)); | 231 return new _ErrorHandlingAsciiDecoderSink(stringSink.asUtf8Sink(false)); |
238 } else { | 232 } else { |
239 return new _SimpleAsciiDecoderSink(stringSink); | 233 return new _SimpleAsciiDecoderSink(stringSink); |
240 } | 234 } |
241 } | 235 } |
242 } | 236 } |
243 let _utf8Sink = Symbol('_utf8Sink'); | |
244 let ChunkedConversionSink$ = dart.generic(function(T) { | 237 let ChunkedConversionSink$ = dart.generic(function(T) { |
245 class ChunkedConversionSink extends core.Object { | 238 class ChunkedConversionSink extends core.Object { |
246 ChunkedConversionSink() { | 239 ChunkedConversionSink() { |
247 } | 240 } |
248 withCallback(callback) { | 241 withCallback(callback) { |
249 return new _SimpleCallbackSink(callback); | 242 return new _SimpleCallbackSink(callback); |
250 } | 243 } |
251 } | 244 } |
252 ChunkedConversionSink[dart.implements] = () => [core.Sink$(T)]; | 245 ChunkedConversionSink[dart.implements] = () => [core.Sink$(T)]; |
253 dart.defineNamedConstructor(ChunkedConversionSink, 'withCallback'); | 246 dart.defineNamedConstructor(ChunkedConversionSink, 'withCallback'); |
(...skipping 16 matching lines...) Expand all Loading... |
270 class ByteConversionSinkBase extends ByteConversionSink { | 263 class ByteConversionSinkBase extends ByteConversionSink { |
271 ByteConversionSinkBase() { | 264 ByteConversionSinkBase() { |
272 super.ByteConversionSink(); | 265 super.ByteConversionSink(); |
273 } | 266 } |
274 addSlice(chunk, start, end, isLast) { | 267 addSlice(chunk, start, end, isLast) { |
275 this.add(chunk[core.$sublist](start, end)); | 268 this.add(chunk[core.$sublist](start, end)); |
276 if (isLast) | 269 if (isLast) |
277 this.close(); | 270 this.close(); |
278 } | 271 } |
279 } | 272 } |
| 273 let _utf8Sink = Symbol('_utf8Sink'); |
280 class _ErrorHandlingAsciiDecoderSink extends ByteConversionSinkBase { | 274 class _ErrorHandlingAsciiDecoderSink extends ByteConversionSinkBase { |
281 _ErrorHandlingAsciiDecoderSink(utf8Sink) { | 275 _ErrorHandlingAsciiDecoderSink(utf8Sink) { |
282 this[_utf8Sink] = utf8Sink; | 276 this[_utf8Sink] = utf8Sink; |
283 } | 277 } |
284 close() { | 278 close() { |
285 this[_utf8Sink].close(); | 279 this[_utf8Sink].close(); |
286 } | 280 } |
287 add(source) { | 281 add(source) { |
288 this.addSlice(source, 0, source[core.$length], false); | 282 this.addSlice(source, 0, source[core.$length], false); |
289 } | 283 } |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 v = dart.notNull(v) | dart.notNull(v) >> 16; | 368 v = dart.notNull(v) | dart.notNull(v) >> 16; |
375 v = dart.notNull(v) + 1; | 369 v = dart.notNull(v) + 1; |
376 return v; | 370 return v; |
377 } | 371 } |
378 close() { | 372 close() { |
379 this[_callback](this[_buffer][core.$sublist](0, this[_bufferIndex])); | 373 this[_callback](this[_buffer][core.$sublist](0, this[_bufferIndex])); |
380 } | 374 } |
381 } | 375 } |
382 _ByteCallbackSink._INITIAL_BUFFER_SIZE = 1024; | 376 _ByteCallbackSink._INITIAL_BUFFER_SIZE = 1024; |
383 let _ChunkedConversionCallback$ = dart.generic(function(T) { | 377 let _ChunkedConversionCallback$ = dart.generic(function(T) { |
384 let _ChunkedConversionCallback = dart.typedef('_ChunkedConversionCallback',
() => dart.functionType(dart.void, [T])); | 378 let _ChunkedConversionCallback = dart.typedef('_ChunkedConversionCallback',
dart.functionType(dart.void, [T])); |
385 return _ChunkedConversionCallback; | 379 return _ChunkedConversionCallback; |
386 }); | 380 }); |
387 let _ChunkedConversionCallback = _ChunkedConversionCallback$(); | 381 let _ChunkedConversionCallback = _ChunkedConversionCallback$(); |
388 let _accumulated = Symbol('_accumulated'); | 382 let _accumulated = Symbol('_accumulated'); |
389 let _SimpleCallbackSink$ = dart.generic(function(T) { | 383 let _SimpleCallbackSink$ = dart.generic(function(T) { |
390 class _SimpleCallbackSink extends ChunkedConversionSink$(T) { | 384 class _SimpleCallbackSink extends ChunkedConversionSink$(T) { |
391 _SimpleCallbackSink(callback) { | 385 _SimpleCallbackSink(callback) { |
392 this[_accumulated] = dart.setType([], core.List$(T)); | 386 this[_accumulated] = dart.setType([], core.List$(T)); |
393 this[_callback] = callback; | 387 this[_callback] = callback; |
394 super.ChunkedConversionSink(); | 388 super.ChunkedConversionSink(); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 return dart.as(this[_second].convert(this[_first].convert(input)), T); | 491 return dart.as(this[_second].convert(this[_first].convert(input)), T); |
498 } | 492 } |
499 startChunkedConversion(sink) { | 493 startChunkedConversion(sink) { |
500 dart.as(sink, core.Sink$(T)); | 494 dart.as(sink, core.Sink$(T)); |
501 return this[_first].startChunkedConversion(this[_second].startChunkedCon
version(sink)); | 495 return this[_first].startChunkedConversion(this[_second].startChunkedCon
version(sink)); |
502 } | 496 } |
503 } | 497 } |
504 return _FusedConverter; | 498 return _FusedConverter; |
505 }); | 499 }); |
506 let _FusedConverter = _FusedConverter$(); | 500 let _FusedConverter = _FusedConverter$(); |
507 let HTML_ESCAPE = dart.const(new HtmlEscape()); | 501 dart.defineLazyProperties(Encoding, { |
508 let _name = Symbol('_name'); | 502 get _nameToEncoding() { |
509 class HtmlEscapeMode extends core.Object { | 503 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}); |
510 _(name, escapeLtGt, escapeQuot, escapeApos, escapeSlash) { | 504 }, |
511 this[_name] = name; | 505 set _nameToEncoding(_) {} |
512 this.escapeLtGt = escapeLtGt; | 506 }); |
513 this.escapeQuot = escapeQuot; | |
514 this.escapeApos = escapeApos; | |
515 this.escapeSlash = escapeSlash; | |
516 } | |
517 toString() { | |
518 return this[_name]; | |
519 } | |
520 } | |
521 dart.defineNamedConstructor(HtmlEscapeMode, '_'); | |
522 HtmlEscapeMode.UNKNOWN = dart.const(new HtmlEscapeMode._('unknown', true, true
, true, true)); | |
523 HtmlEscapeMode.ATTRIBUTE = dart.const(new HtmlEscapeMode._('attribute', false,
true, false, false)); | |
524 HtmlEscapeMode.ELEMENT = dart.const(new HtmlEscapeMode._('element', true, fals
e, false, true)); | |
525 let _convert = Symbol('_convert'); | 507 let _convert = Symbol('_convert'); |
526 class HtmlEscape extends Converter$(core.String, core.String) { | 508 class HtmlEscape extends Converter$(core.String, core.String) { |
527 HtmlEscape(mode) { | 509 HtmlEscape(mode) { |
528 if (mode === void 0) | 510 if (mode === void 0) |
529 mode = HtmlEscapeMode.UNKNOWN; | 511 mode = HtmlEscapeMode.UNKNOWN; |
530 this.mode = mode; | 512 this.mode = mode; |
531 super.Converter(); | 513 super.Converter(); |
532 } | 514 } |
533 convert(text) { | 515 convert(text) { |
534 let val = this[_convert](text, 0, text.length); | 516 let val = this[_convert](text, 0, text.length); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 } | 573 } |
592 return result != null ? dart.toString(result) : null; | 574 return result != null ? dart.toString(result) : null; |
593 } | 575 } |
594 startChunkedConversion(sink) { | 576 startChunkedConversion(sink) { |
595 if (!dart.is(sink, StringConversionSink)) { | 577 if (!dart.is(sink, StringConversionSink)) { |
596 sink = new StringConversionSink.from(sink); | 578 sink = new StringConversionSink.from(sink); |
597 } | 579 } |
598 return new _HtmlEscapeSink(this, dart.as(sink, StringConversionSink)); | 580 return new _HtmlEscapeSink(this, dart.as(sink, StringConversionSink)); |
599 } | 581 } |
600 } | 582 } |
| 583 let HTML_ESCAPE = dart.const(new HtmlEscape()); |
| 584 let _name = Symbol('_name'); |
| 585 class HtmlEscapeMode extends core.Object { |
| 586 _(name, escapeLtGt, escapeQuot, escapeApos, escapeSlash) { |
| 587 this[_name] = name; |
| 588 this.escapeLtGt = escapeLtGt; |
| 589 this.escapeQuot = escapeQuot; |
| 590 this.escapeApos = escapeApos; |
| 591 this.escapeSlash = escapeSlash; |
| 592 } |
| 593 toString() { |
| 594 return this[_name]; |
| 595 } |
| 596 } |
| 597 dart.defineNamedConstructor(HtmlEscapeMode, '_'); |
| 598 HtmlEscapeMode.UNKNOWN = dart.const(new HtmlEscapeMode._('unknown', true, true
, true, true)); |
| 599 HtmlEscapeMode.ATTRIBUTE = dart.const(new HtmlEscapeMode._('attribute', false,
true, false, false)); |
| 600 HtmlEscapeMode.ELEMENT = dart.const(new HtmlEscapeMode._('element', true, fals
e, false, true)); |
601 let _escape = Symbol('_escape'); | 601 let _escape = Symbol('_escape'); |
602 class _HtmlEscapeSink extends StringConversionSinkBase { | 602 class _HtmlEscapeSink extends StringConversionSinkBase { |
603 _HtmlEscapeSink(escape, sink) { | 603 _HtmlEscapeSink(escape, sink) { |
604 this[_escape] = escape; | 604 this[_escape] = escape; |
605 this[_sink] = sink; | 605 this[_sink] = sink; |
606 } | 606 } |
607 addSlice(chunk, start, end, isLast) { | 607 addSlice(chunk, start, end, isLast) { |
608 let val = this[_escape][_convert](chunk, start, end); | 608 let val = this[_escape][_convert](chunk, start, end); |
609 if (val == null) { | 609 if (val == null) { |
610 this[_sink].addSlice(chunk, start, end, isLast); | 610 this[_sink].addSlice(chunk, start, end, isLast); |
(...skipping 23 matching lines...) Expand all Loading... |
634 } | 634 } |
635 } | 635 } |
636 class JsonCyclicError extends JsonUnsupportedObjectError { | 636 class JsonCyclicError extends JsonUnsupportedObjectError { |
637 JsonCyclicError(object) { | 637 JsonCyclicError(object) { |
638 super.JsonUnsupportedObjectError(object); | 638 super.JsonUnsupportedObjectError(object); |
639 } | 639 } |
640 toString() { | 640 toString() { |
641 return "Cyclic error in JSON stringify"; | 641 return "Cyclic error in JSON stringify"; |
642 } | 642 } |
643 } | 643 } |
644 let JSON = dart.const(new JsonCodec()); | |
645 let _Reviver = dart.typedef('_Reviver', () => dart.functionType(dart.dynamic,
[dart.dynamic, dart.dynamic])); | |
646 let _ToEncodable = dart.typedef('_ToEncodable', () => dart.functionType(dart.d
ynamic, [dart.dynamic])); | |
647 let _reviver = Symbol('_reviver'); | 644 let _reviver = Symbol('_reviver'); |
648 let _toEncodable$ = Symbol('_toEncodable'); | 645 let _toEncodable$ = Symbol('_toEncodable'); |
649 class JsonCodec extends Codec$(core.Object, core.String) { | 646 class JsonCodec extends Codec$(core.Object, core.String) { |
650 JsonCodec(opts) { | 647 JsonCodec(opts) { |
651 let reviver = opts && 'reviver' in opts ? opts.reviver : null; | 648 let reviver = opts && 'reviver' in opts ? opts.reviver : null; |
652 let toEncodable = opts && 'toEncodable' in opts ? opts.toEncodable : null; | 649 let toEncodable = opts && 'toEncodable' in opts ? opts.toEncodable : null; |
653 this[_reviver] = reviver; | 650 this[_reviver] = reviver; |
654 this[_toEncodable$] = toEncodable; | 651 this[_toEncodable$] = toEncodable; |
655 super.Codec(); | 652 super.Codec(); |
656 } | 653 } |
(...skipping 21 matching lines...) Expand all Loading... |
678 return dart.const(new JsonEncoder()); | 675 return dart.const(new JsonEncoder()); |
679 return new JsonEncoder(dart.as(this[_toEncodable$], dart.functionType(core
.Object, [core.Object]))); | 676 return new JsonEncoder(dart.as(this[_toEncodable$], dart.functionType(core
.Object, [core.Object]))); |
680 } | 677 } |
681 get decoder() { | 678 get decoder() { |
682 if (this[_reviver] == null) | 679 if (this[_reviver] == null) |
683 return dart.const(new JsonDecoder()); | 680 return dart.const(new JsonDecoder()); |
684 return new JsonDecoder(this[_reviver]); | 681 return new JsonDecoder(this[_reviver]); |
685 } | 682 } |
686 } | 683 } |
687 dart.defineNamedConstructor(JsonCodec, 'withReviver'); | 684 dart.defineNamedConstructor(JsonCodec, 'withReviver'); |
| 685 let JSON = dart.const(new JsonCodec()); |
| 686 let _Reviver = dart.typedef('_Reviver', dart.functionType(dart.dynamic, [dart.
dynamic, dart.dynamic])); |
| 687 let _ToEncodable = dart.typedef('_ToEncodable', dart.functionType(dart.dynamic
, [dart.dynamic])); |
688 class JsonEncoder extends Converter$(core.Object, core.String) { | 688 class JsonEncoder extends Converter$(core.Object, core.String) { |
689 JsonEncoder(toEncodable) { | 689 JsonEncoder(toEncodable) { |
690 if (toEncodable === void 0) | 690 if (toEncodable === void 0) |
691 toEncodable = null; | 691 toEncodable = null; |
692 this.indent = null; | 692 this.indent = null; |
693 this[_toEncodable$] = toEncodable; | 693 this[_toEncodable$] = toEncodable; |
694 super.Converter(); | 694 super.Converter(); |
695 } | 695 } |
696 withIndent(indent, toEncodable) { | 696 withIndent(indent, toEncodable) { |
697 if (toEncodable === void 0) | 697 if (toEncodable === void 0) |
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1267 this.buffer[core.$setRange](this.index, end, indent); | 1267 this.buffer[core.$setRange](this.index, end, indent); |
1268 this.index = end; | 1268 this.index = end; |
1269 } else { | 1269 } else { |
1270 for (let i = 0; dart.notNull(i) < dart.notNull(indentLength); i = dart
.notNull(i) + 1) { | 1270 for (let i = 0; dart.notNull(i) < dart.notNull(indentLength); i = dart
.notNull(i) + 1) { |
1271 this.writeByte(indent[core.$get](i)); | 1271 this.writeByte(indent[core.$get](i)); |
1272 } | 1272 } |
1273 } | 1273 } |
1274 } | 1274 } |
1275 } | 1275 } |
1276 } | 1276 } |
1277 let __CastType0 = dart.typedef('__CastType0', () => dart.functionType(core.Obj
ect, [core.Object])); | 1277 let __CastType0 = dart.typedef('__CastType0', dart.functionType(core.Object, [
core.Object])); |
1278 let __CastType2 = dart.typedef('__CastType2', () => dart.functionType(dart.dyn
amic, [dart.dynamic])); | 1278 let __CastType2 = dart.typedef('__CastType2', dart.functionType(dart.dynamic,
[dart.dynamic])); |
1279 let __CastType4 = dart.typedef('__CastType4', () => dart.functionType(dart.dyn
amic, [core.Object])); | 1279 let __CastType4 = dart.typedef('__CastType4', dart.functionType(dart.dynamic,
[core.Object])); |
1280 let LATIN1 = dart.const(new Latin1Codec()); | |
1281 let _LATIN1_MASK = 255; | |
1282 class Latin1Codec extends Encoding { | 1280 class Latin1Codec extends Encoding { |
1283 Latin1Codec(opts) { | 1281 Latin1Codec(opts) { |
1284 let allowInvalid = opts && 'allowInvalid' in opts ? opts.allowInvalid : fa
lse; | 1282 let allowInvalid = opts && 'allowInvalid' in opts ? opts.allowInvalid : fa
lse; |
1285 this[_allowInvalid] = allowInvalid; | 1283 this[_allowInvalid] = allowInvalid; |
1286 super.Encoding(); | 1284 super.Encoding(); |
1287 } | 1285 } |
1288 get name() { | 1286 get name() { |
1289 return "iso-8859-1"; | 1287 return "iso-8859-1"; |
1290 } | 1288 } |
1291 decode(bytes, opts) { | 1289 decode(bytes, opts) { |
1292 let allowInvalid = opts && 'allowInvalid' in opts ? opts.allowInvalid : nu
ll; | 1290 let allowInvalid = opts && 'allowInvalid' in opts ? opts.allowInvalid : nu
ll; |
1293 if (allowInvalid == null) | 1291 if (allowInvalid == null) |
1294 allowInvalid = this[_allowInvalid]; | 1292 allowInvalid = this[_allowInvalid]; |
1295 if (allowInvalid) { | 1293 if (allowInvalid) { |
1296 return dart.const(new Latin1Decoder({allowInvalid: true})).convert(bytes
); | 1294 return dart.const(new Latin1Decoder({allowInvalid: true})).convert(bytes
); |
1297 } else { | 1295 } else { |
1298 return dart.const(new Latin1Decoder({allowInvalid: false})).convert(byte
s); | 1296 return dart.const(new Latin1Decoder({allowInvalid: false})).convert(byte
s); |
1299 } | 1297 } |
1300 } | 1298 } |
1301 get encoder() { | 1299 get encoder() { |
1302 return dart.const(new Latin1Encoder()); | 1300 return dart.const(new Latin1Encoder()); |
1303 } | 1301 } |
1304 get decoder() { | 1302 get decoder() { |
1305 return this[_allowInvalid] ? dart.const(new Latin1Decoder({allowInvalid: t
rue})) : dart.const(new Latin1Decoder({allowInvalid: false})); | 1303 return this[_allowInvalid] ? dart.const(new Latin1Decoder({allowInvalid: t
rue})) : dart.const(new Latin1Decoder({allowInvalid: false})); |
1306 } | 1304 } |
1307 } | 1305 } |
| 1306 let LATIN1 = dart.const(new Latin1Codec()); |
| 1307 let _LATIN1_MASK = 255; |
1308 class Latin1Encoder extends _UnicodeSubsetEncoder { | 1308 class Latin1Encoder extends _UnicodeSubsetEncoder { |
1309 Latin1Encoder() { | 1309 Latin1Encoder() { |
1310 super._UnicodeSubsetEncoder(_LATIN1_MASK); | 1310 super._UnicodeSubsetEncoder(_LATIN1_MASK); |
1311 } | 1311 } |
1312 } | 1312 } |
1313 class Latin1Decoder extends _UnicodeSubsetDecoder { | 1313 class Latin1Decoder extends _UnicodeSubsetDecoder { |
1314 Latin1Decoder(opts) { | 1314 Latin1Decoder(opts) { |
1315 let allowInvalid = opts && 'allowInvalid' in opts ? opts.allowInvalid : fa
lse; | 1315 let allowInvalid = opts && 'allowInvalid' in opts ? opts.allowInvalid : fa
lse; |
1316 super._UnicodeSubsetDecoder(allowInvalid, _LATIN1_MASK); | 1316 super._UnicodeSubsetDecoder(allowInvalid, _LATIN1_MASK); |
1317 } | 1317 } |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1471 } | 1471 } |
1472 dart.defineNamedConstructor(StringConversionSink, 'withCallback'); | 1472 dart.defineNamedConstructor(StringConversionSink, 'withCallback'); |
1473 dart.defineNamedConstructor(StringConversionSink, 'from'); | 1473 dart.defineNamedConstructor(StringConversionSink, 'from'); |
1474 dart.defineNamedConstructor(StringConversionSink, 'fromStringSink'); | 1474 dart.defineNamedConstructor(StringConversionSink, 'fromStringSink'); |
1475 class ClosableStringSink extends core.StringSink { | 1475 class ClosableStringSink extends core.StringSink { |
1476 fromStringSink(sink, onClose) { | 1476 fromStringSink(sink, onClose) { |
1477 return new _ClosableStringSink(sink, onClose); | 1477 return new _ClosableStringSink(sink, onClose); |
1478 } | 1478 } |
1479 } | 1479 } |
1480 dart.defineNamedConstructor(ClosableStringSink, 'fromStringSink'); | 1480 dart.defineNamedConstructor(ClosableStringSink, 'fromStringSink'); |
1481 let _StringSinkCloseCallback = dart.typedef('_StringSinkCloseCallback', () =>
dart.functionType(dart.void, [])); | 1481 let _StringSinkCloseCallback = dart.typedef('_StringSinkCloseCallback', dart.f
unctionType(dart.void, [])); |
1482 class _ClosableStringSink extends core.Object { | 1482 class _ClosableStringSink extends core.Object { |
1483 _ClosableStringSink(sink, callback) { | 1483 _ClosableStringSink(sink, callback) { |
1484 this[_sink] = sink; | 1484 this[_sink] = sink; |
1485 this[_callback] = callback; | 1485 this[_callback] = callback; |
1486 } | 1486 } |
1487 close() { | 1487 close() { |
1488 return this[_callback](); | 1488 return this[_callback](); |
1489 } | 1489 } |
1490 writeCharCode(charCode) { | 1490 writeCharCode(charCode) { |
1491 return this[_sink].writeCharCode(charCode); | 1491 return this[_sink].writeCharCode(charCode); |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1676 this[_buffer].clear(); | 1676 this[_buffer].clear(); |
1677 return; | 1677 return; |
1678 } | 1678 } |
1679 if (isLast) | 1679 if (isLast) |
1680 this.close(); | 1680 this.close(); |
1681 } | 1681 } |
1682 } | 1682 } |
1683 dart.defineNamedConstructor(_Utf8ConversionSink, '_'); | 1683 dart.defineNamedConstructor(_Utf8ConversionSink, '_'); |
1684 let UNICODE_REPLACEMENT_CHARACTER_RUNE = 65533; | 1684 let UNICODE_REPLACEMENT_CHARACTER_RUNE = 65533; |
1685 let UNICODE_BOM_CHARACTER_RUNE = 65279; | 1685 let UNICODE_BOM_CHARACTER_RUNE = 65279; |
1686 let UTF8 = dart.const(new Utf8Codec()); | |
1687 let _allowMalformed = Symbol('_allowMalformed'); | 1686 let _allowMalformed = Symbol('_allowMalformed'); |
1688 class Utf8Codec extends Encoding { | 1687 class Utf8Codec extends Encoding { |
1689 Utf8Codec(opts) { | 1688 Utf8Codec(opts) { |
1690 let allowMalformed = opts && 'allowMalformed' in opts ? opts.allowMalforme
d : false; | 1689 let allowMalformed = opts && 'allowMalformed' in opts ? opts.allowMalforme
d : false; |
1691 this[_allowMalformed] = allowMalformed; | 1690 this[_allowMalformed] = allowMalformed; |
1692 super.Encoding(); | 1691 super.Encoding(); |
1693 } | 1692 } |
1694 get name() { | 1693 get name() { |
1695 return "utf-8"; | 1694 return "utf-8"; |
1696 } | 1695 } |
1697 decode(codeUnits, opts) { | 1696 decode(codeUnits, opts) { |
1698 let allowMalformed = opts && 'allowMalformed' in opts ? opts.allowMalforme
d : null; | 1697 let allowMalformed = opts && 'allowMalformed' in opts ? opts.allowMalforme
d : null; |
1699 if (allowMalformed == null) | 1698 if (allowMalformed == null) |
1700 allowMalformed = this[_allowMalformed]; | 1699 allowMalformed = this[_allowMalformed]; |
1701 return new Utf8Decoder({allowMalformed: allowMalformed}).convert(codeUnits
); | 1700 return new Utf8Decoder({allowMalformed: allowMalformed}).convert(codeUnits
); |
1702 } | 1701 } |
1703 get encoder() { | 1702 get encoder() { |
1704 return new Utf8Encoder(); | 1703 return new Utf8Encoder(); |
1705 } | 1704 } |
1706 get decoder() { | 1705 get decoder() { |
1707 return new Utf8Decoder({allowMalformed: this[_allowMalformed]}); | 1706 return new Utf8Decoder({allowMalformed: this[_allowMalformed]}); |
1708 } | 1707 } |
1709 } | 1708 } |
| 1709 let UTF8 = dart.const(new Utf8Codec()); |
1710 let _fillBuffer = Symbol('_fillBuffer'); | 1710 let _fillBuffer = Symbol('_fillBuffer'); |
1711 let _writeSurrogate = Symbol('_writeSurrogate'); | 1711 let _writeSurrogate = Symbol('_writeSurrogate'); |
1712 class Utf8Encoder extends Converter$(core.String, core.List$(core.int)) { | 1712 class Utf8Encoder extends Converter$(core.String, core.List$(core.int)) { |
1713 Utf8Encoder() { | 1713 Utf8Encoder() { |
1714 super.Converter(); | 1714 super.Converter(); |
1715 } | 1715 } |
1716 convert(string, start, end) { | 1716 convert(string, start, end) { |
1717 if (start === void 0) | 1717 if (start === void 0) |
1718 start = 0; | 1718 start = 0; |
1719 if (end === void 0) | 1719 if (end === void 0) |
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2389 super.close(); | 2389 super.close(); |
2390 let buffer = dart.as(this[_stringSink], core.StringBuffer); | 2390 let buffer = dart.as(this[_stringSink], core.StringBuffer); |
2391 let accumulated = dart.toString(buffer); | 2391 let accumulated = dart.toString(buffer); |
2392 buffer.clear(); | 2392 buffer.clear(); |
2393 let decoded = _parseJson(accumulated, this[_reviver]); | 2393 let decoded = _parseJson(accumulated, this[_reviver]); |
2394 this[_sink].add(decoded); | 2394 this[_sink].add(decoded); |
2395 this[_sink].close(); | 2395 this[_sink].close(); |
2396 } | 2396 } |
2397 } | 2397 } |
2398 // Exports: | 2398 // Exports: |
2399 exports.ASCII = ASCII; | |
2400 exports.AsciiCodec = AsciiCodec; | |
2401 exports.Encoding = Encoding; | |
2402 exports.Codec$ = Codec$; | 2399 exports.Codec$ = Codec$; |
2403 exports.Codec = Codec; | 2400 exports.Codec = Codec; |
| 2401 exports.Encoding = Encoding; |
| 2402 exports.AsciiCodec = AsciiCodec; |
| 2403 exports.ASCII = ASCII; |
2404 exports.Converter$ = Converter$; | 2404 exports.Converter$ = Converter$; |
2405 exports.Converter = Converter; | 2405 exports.Converter = Converter; |
2406 exports.AsciiEncoder = AsciiEncoder; | 2406 exports.AsciiEncoder = AsciiEncoder; |
| 2407 exports.StringConversionSinkMixin = StringConversionSinkMixin; |
2407 exports.StringConversionSinkBase = StringConversionSinkBase; | 2408 exports.StringConversionSinkBase = StringConversionSinkBase; |
2408 exports.StringConversionSinkMixin = StringConversionSinkMixin; | |
2409 exports.AsciiDecoder = AsciiDecoder; | 2409 exports.AsciiDecoder = AsciiDecoder; |
2410 exports.ByteConversionSinkBase = ByteConversionSinkBase; | |
2411 exports.ByteConversionSink = ByteConversionSink; | |
2412 exports.ChunkedConversionSink$ = ChunkedConversionSink$; | 2410 exports.ChunkedConversionSink$ = ChunkedConversionSink$; |
2413 exports.ChunkedConversionSink = ChunkedConversionSink; | 2411 exports.ChunkedConversionSink = ChunkedConversionSink; |
| 2412 exports.ByteConversionSink = ByteConversionSink; |
| 2413 exports.ByteConversionSinkBase = ByteConversionSinkBase; |
| 2414 exports.HtmlEscape = HtmlEscape; |
2414 exports.HTML_ESCAPE = HTML_ESCAPE; | 2415 exports.HTML_ESCAPE = HTML_ESCAPE; |
2415 exports.HtmlEscapeMode = HtmlEscapeMode; | 2416 exports.HtmlEscapeMode = HtmlEscapeMode; |
2416 exports.HtmlEscape = HtmlEscape; | |
2417 exports.JsonUnsupportedObjectError = JsonUnsupportedObjectError; | 2417 exports.JsonUnsupportedObjectError = JsonUnsupportedObjectError; |
2418 exports.JsonCyclicError = JsonCyclicError; | 2418 exports.JsonCyclicError = JsonCyclicError; |
| 2419 exports.JsonCodec = JsonCodec; |
2419 exports.JSON = JSON; | 2420 exports.JSON = JSON; |
2420 exports.JsonCodec = JsonCodec; | |
2421 exports.JsonEncoder = JsonEncoder; | 2421 exports.JsonEncoder = JsonEncoder; |
2422 exports.JsonUtf8Encoder = JsonUtf8Encoder; | 2422 exports.JsonUtf8Encoder = JsonUtf8Encoder; |
2423 exports.JsonDecoder = JsonDecoder; | 2423 exports.JsonDecoder = JsonDecoder; |
| 2424 exports.Latin1Codec = Latin1Codec; |
2424 exports.LATIN1 = LATIN1; | 2425 exports.LATIN1 = LATIN1; |
2425 exports.Latin1Codec = Latin1Codec; | |
2426 exports.Latin1Encoder = Latin1Encoder; | 2426 exports.Latin1Encoder = Latin1Encoder; |
2427 exports.Latin1Decoder = Latin1Decoder; | 2427 exports.Latin1Decoder = Latin1Decoder; |
2428 exports.LineSplitter = LineSplitter; | 2428 exports.LineSplitter = LineSplitter; |
2429 exports.StringConversionSink = StringConversionSink; | 2429 exports.StringConversionSink = StringConversionSink; |
2430 exports.ClosableStringSink = ClosableStringSink; | 2430 exports.ClosableStringSink = ClosableStringSink; |
2431 exports.UNICODE_REPLACEMENT_CHARACTER_RUNE = UNICODE_REPLACEMENT_CHARACTER_RUN
E; | 2431 exports.UNICODE_REPLACEMENT_CHARACTER_RUNE = UNICODE_REPLACEMENT_CHARACTER_RUN
E; |
2432 exports.UNICODE_BOM_CHARACTER_RUNE = UNICODE_BOM_CHARACTER_RUNE; | 2432 exports.UNICODE_BOM_CHARACTER_RUNE = UNICODE_BOM_CHARACTER_RUNE; |
| 2433 exports.Utf8Codec = Utf8Codec; |
2433 exports.UTF8 = UTF8; | 2434 exports.UTF8 = UTF8; |
2434 exports.Utf8Codec = Utf8Codec; | |
2435 exports.Utf8Encoder = Utf8Encoder; | 2435 exports.Utf8Encoder = Utf8Encoder; |
2436 exports.Utf8Decoder = Utf8Decoder; | 2436 exports.Utf8Decoder = Utf8Decoder; |
2437 })(convert, core, async, typed_data, _internal, collection); | 2437 })(convert, core, async, typed_data, _internal, collection); |
OLD | NEW |