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.import(async); | 3 var async = dart.import(async); |
4 var typed_data = dart.import(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 Codec$ = dart.generic(function(S, T) { | 9 let Codec$ = dart.generic(function(S, T) { |
10 class Codec extends core.Object { | 10 class Codec extends core.Object { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 this[_allowInvalid] = allowInvalid; | 67 this[_allowInvalid] = allowInvalid; |
68 super.Encoding(); | 68 super.Encoding(); |
69 } | 69 } |
70 get name() { | 70 get name() { |
71 return "us-ascii"; | 71 return "us-ascii"; |
72 } | 72 } |
73 decode(bytes, opts) { | 73 decode(bytes, opts) { |
74 let allowInvalid = opts && 'allowInvalid' in opts ? opts.allowInvalid : nu
ll; | 74 let allowInvalid = opts && 'allowInvalid' in opts ? opts.allowInvalid : nu
ll; |
75 if (allowInvalid == null) | 75 if (allowInvalid == null) |
76 allowInvalid = this[_allowInvalid]; | 76 allowInvalid = this[_allowInvalid]; |
77 if (allowInvalid) { | 77 if (dart.notNull(allowInvalid)) { |
78 return dart.const(new AsciiDecoder({allowInvalid: true})).convert(bytes)
; | 78 return dart.const(new AsciiDecoder({allowInvalid: true})).convert(bytes)
; |
79 } else { | 79 } else { |
80 return dart.const(new AsciiDecoder({allowInvalid: false})).convert(bytes
); | 80 return dart.const(new AsciiDecoder({allowInvalid: false})).convert(bytes
); |
81 } | 81 } |
82 } | 82 } |
83 get encoder() { | 83 get encoder() { |
84 return dart.const(new AsciiEncoder()); | 84 return dart.const(new AsciiEncoder()); |
85 } | 85 } |
86 get decoder() { | 86 get decoder() { |
87 return this[_allowInvalid] ? dart.const(new AsciiDecoder({allowInvalid: tr
ue})) : dart.const(new AsciiDecoder({allowInvalid: false})); | 87 return dart.notNull(this[_allowInvalid]) ? dart.const(new AsciiDecoder({al
lowInvalid: true})) : dart.const(new AsciiDecoder({allowInvalid: false})); |
88 } | 88 } |
89 } | 89 } |
90 dart.setSignature(AsciiCodec, { | 90 dart.setSignature(AsciiCodec, { |
91 constructors: () => ({AsciiCodec: [AsciiCodec, [], {allowInvalid: core.bool}
]}), | 91 constructors: () => ({AsciiCodec: [AsciiCodec, [], {allowInvalid: core.bool}
]}), |
92 methods: () => ({decode: [core.String, [core.List$(core.int)], {allowInvalid
: core.bool}]}) | 92 methods: () => ({decode: [core.String, [core.List$(core.int)], {allowInvalid
: core.bool}]}) |
93 }); | 93 }); |
94 let ASCII = dart.const(new AsciiCodec()); | 94 let ASCII = dart.const(new AsciiCodec()); |
95 let _ASCII_MASK = 127; | 95 let _ASCII_MASK = 127; |
96 let Converter$ = dart.generic(function(S, T) { | 96 let Converter$ = dart.generic(function(S, T) { |
97 class Converter extends core.Object { | 97 class Converter extends core.Object { |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 } | 205 } |
206 addSlice(source, start, end, isLast) { | 206 addSlice(source, start, end, isLast) { |
207 core.RangeError.checkValidRange(start, end, source.length); | 207 core.RangeError.checkValidRange(start, end, source.length); |
208 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { | 208 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { |
209 let codeUnit = source[dartx.codeUnitAt](i); | 209 let codeUnit = source[dartx.codeUnitAt](i); |
210 if ((dart.notNull(codeUnit) & ~dart.notNull(this[_subsetMask])) != 0) { | 210 if ((dart.notNull(codeUnit) & ~dart.notNull(this[_subsetMask])) != 0) { |
211 throw new core.ArgumentError(`Source contains invalid character with c
ode point: ${codeUnit}.`); | 211 throw new core.ArgumentError(`Source contains invalid character with c
ode point: ${codeUnit}.`); |
212 } | 212 } |
213 } | 213 } |
214 this[_sink].add(source[dartx.codeUnits][dartx.sublist](start, end)); | 214 this[_sink].add(source[dartx.codeUnits][dartx.sublist](start, end)); |
215 if (isLast) { | 215 if (dart.notNull(isLast)) { |
216 this.close(); | 216 this.close(); |
217 } | 217 } |
218 } | 218 } |
219 } | 219 } |
220 dart.setSignature(_UnicodeSubsetEncoderSink, { | 220 dart.setSignature(_UnicodeSubsetEncoderSink, { |
221 constructors: () => ({_UnicodeSubsetEncoderSink: [_UnicodeSubsetEncoderSink,
[core.int, ByteConversionSink]]}), | 221 constructors: () => ({_UnicodeSubsetEncoderSink: [_UnicodeSubsetEncoderSink,
[core.int, ByteConversionSink]]}), |
222 methods: () => ({ | 222 methods: () => ({ |
223 close: [dart.void, []], | 223 close: [dart.void, []], |
224 addSlice: [dart.void, [core.String, core.int, core.int, core.bool]] | 224 addSlice: [dart.void, [core.String, core.int, core.int, core.bool]] |
225 }) | 225 }) |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 let allowInvalid = opts && 'allowInvalid' in opts ? opts.allowInvalid : fa
lse; | 279 let allowInvalid = opts && 'allowInvalid' in opts ? opts.allowInvalid : fa
lse; |
280 super._UnicodeSubsetDecoder(allowInvalid, _ASCII_MASK); | 280 super._UnicodeSubsetDecoder(allowInvalid, _ASCII_MASK); |
281 } | 281 } |
282 startChunkedConversion(sink) { | 282 startChunkedConversion(sink) { |
283 let stringSink = null; | 283 let stringSink = null; |
284 if (dart.is(sink, StringConversionSink)) { | 284 if (dart.is(sink, StringConversionSink)) { |
285 stringSink = sink; | 285 stringSink = sink; |
286 } else { | 286 } else { |
287 stringSink = StringConversionSink.from(sink); | 287 stringSink = StringConversionSink.from(sink); |
288 } | 288 } |
289 if (this[_allowInvalid]) { | 289 if (dart.notNull(this[_allowInvalid])) { |
290 return new _ErrorHandlingAsciiDecoderSink(stringSink.asUtf8Sink(false)); | 290 return new _ErrorHandlingAsciiDecoderSink(stringSink.asUtf8Sink(false)); |
291 } else { | 291 } else { |
292 return new _SimpleAsciiDecoderSink(stringSink); | 292 return new _SimpleAsciiDecoderSink(stringSink); |
293 } | 293 } |
294 } | 294 } |
295 } | 295 } |
296 dart.setSignature(AsciiDecoder, { | 296 dart.setSignature(AsciiDecoder, { |
297 constructors: () => ({AsciiDecoder: [AsciiDecoder, [], {allowInvalid: core.b
ool}]}), | 297 constructors: () => ({AsciiDecoder: [AsciiDecoder, [], {allowInvalid: core.b
ool}]}), |
298 methods: () => ({startChunkedConversion: [ByteConversionSink, [core.Sink$(co
re.String)]]}) | 298 methods: () => ({startChunkedConversion: [ByteConversionSink, [core.Sink$(co
re.String)]]}) |
299 }); | 299 }); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 withCallback: [ByteConversionSink, [dart.functionType(dart.void, [core.Lis
t$(core.int)])]], | 332 withCallback: [ByteConversionSink, [dart.functionType(dart.void, [core.Lis
t$(core.int)])]], |
333 from: [ByteConversionSink, [core.Sink$(core.List$(core.int))]] | 333 from: [ByteConversionSink, [core.Sink$(core.List$(core.int))]] |
334 }) | 334 }) |
335 }); | 335 }); |
336 class ByteConversionSinkBase extends ByteConversionSink { | 336 class ByteConversionSinkBase extends ByteConversionSink { |
337 ByteConversionSinkBase() { | 337 ByteConversionSinkBase() { |
338 super.ByteConversionSink(); | 338 super.ByteConversionSink(); |
339 } | 339 } |
340 addSlice(chunk, start, end, isLast) { | 340 addSlice(chunk, start, end, isLast) { |
341 this.add(chunk[dartx.sublist](start, end)); | 341 this.add(chunk[dartx.sublist](start, end)); |
342 if (isLast) | 342 if (dart.notNull(isLast)) |
343 this.close(); | 343 this.close(); |
344 } | 344 } |
345 } | 345 } |
346 dart.setSignature(ByteConversionSinkBase, { | 346 dart.setSignature(ByteConversionSinkBase, { |
347 methods: () => ({addSlice: [dart.void, [core.List$(core.int), core.int, core
.int, core.bool]]}) | 347 methods: () => ({addSlice: [dart.void, [core.List$(core.int), core.int, core
.int, core.bool]]}) |
348 }); | 348 }); |
349 let _utf8Sink = Symbol('_utf8Sink'); | 349 let _utf8Sink = Symbol('_utf8Sink'); |
350 class _ErrorHandlingAsciiDecoderSink extends ByteConversionSinkBase { | 350 class _ErrorHandlingAsciiDecoderSink extends ByteConversionSinkBase { |
351 _ErrorHandlingAsciiDecoderSink(utf8Sink) { | 351 _ErrorHandlingAsciiDecoderSink(utf8Sink) { |
352 this[_utf8Sink] = utf8Sink; | 352 this[_utf8Sink] = utf8Sink; |
353 } | 353 } |
354 close() { | 354 close() { |
355 this[_utf8Sink].close(); | 355 this[_utf8Sink].close(); |
356 } | 356 } |
357 add(source) { | 357 add(source) { |
358 this.addSlice(source, 0, source.length, false); | 358 this.addSlice(source, 0, source.length, false); |
359 } | 359 } |
360 addSlice(source, start, end, isLast) { | 360 addSlice(source, start, end, isLast) { |
361 core.RangeError.checkValidRange(start, end, source.length); | 361 core.RangeError.checkValidRange(start, end, source.length); |
362 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { | 362 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { |
363 if ((dart.notNull(source[dartx.get](i)) & ~dart.notNull(_ASCII_MASK)) !=
0) { | 363 if ((dart.notNull(source[dartx.get](i)) & ~dart.notNull(_ASCII_MASK)) !=
0) { |
364 if (dart.notNull(i) > dart.notNull(start)) | 364 if (dart.notNull(i) > dart.notNull(start)) |
365 this[_utf8Sink].addSlice(source, start, i, false); | 365 this[_utf8Sink].addSlice(source, start, i, false); |
366 this[_utf8Sink].add(dart.const(dart.list([239, 191, 189], core.int))); | 366 this[_utf8Sink].add(dart.const(dart.list([239, 191, 189], core.int))); |
367 start = dart.notNull(i) + 1; | 367 start = dart.notNull(i) + 1; |
368 } | 368 } |
369 } | 369 } |
370 if (dart.notNull(start) < dart.notNull(end)) { | 370 if (dart.notNull(start) < dart.notNull(end)) { |
371 this[_utf8Sink].addSlice(source, start, end, isLast); | 371 this[_utf8Sink].addSlice(source, start, end, isLast); |
372 } else if (isLast) { | 372 } else if (dart.notNull(isLast)) { |
373 this.close(); | 373 this.close(); |
374 } | 374 } |
375 } | 375 } |
376 } | 376 } |
377 dart.setSignature(_ErrorHandlingAsciiDecoderSink, { | 377 dart.setSignature(_ErrorHandlingAsciiDecoderSink, { |
378 constructors: () => ({_ErrorHandlingAsciiDecoderSink: [_ErrorHandlingAsciiDe
coderSink, [ByteConversionSink]]}), | 378 constructors: () => ({_ErrorHandlingAsciiDecoderSink: [_ErrorHandlingAsciiDe
coderSink, [ByteConversionSink]]}), |
379 methods: () => ({ | 379 methods: () => ({ |
380 close: [dart.void, []], | 380 close: [dart.void, []], |
381 add: [dart.void, [core.List$(core.int)]] | 381 add: [dart.void, [core.List$(core.int)]] |
382 }) | 382 }) |
(...skipping 15 matching lines...) Expand all Loading... |
398 } | 398 } |
399 addSlice(source, start, end, isLast) { | 399 addSlice(source, start, end, isLast) { |
400 let length = source.length; | 400 let length = source.length; |
401 core.RangeError.checkValidRange(start, end, length); | 401 core.RangeError.checkValidRange(start, end, length); |
402 if (dart.notNull(start) < dart.notNull(end)) { | 402 if (dart.notNull(start) < dart.notNull(end)) { |
403 if (start != 0 || end != length) { | 403 if (start != 0 || end != length) { |
404 source = source[dartx.sublist](start, end); | 404 source = source[dartx.sublist](start, end); |
405 } | 405 } |
406 this.add(source); | 406 this.add(source); |
407 } | 407 } |
408 if (isLast) | 408 if (dart.notNull(isLast)) |
409 this.close(); | 409 this.close(); |
410 } | 410 } |
411 } | 411 } |
412 dart.setSignature(_SimpleAsciiDecoderSink, { | 412 dart.setSignature(_SimpleAsciiDecoderSink, { |
413 constructors: () => ({_SimpleAsciiDecoderSink: [_SimpleAsciiDecoderSink, [co
re.Sink]]}), | 413 constructors: () => ({_SimpleAsciiDecoderSink: [_SimpleAsciiDecoderSink, [co
re.Sink]]}), |
414 methods: () => ({ | 414 methods: () => ({ |
415 close: [dart.void, []], | 415 close: [dart.void, []], |
416 add: [dart.void, [core.List$(core.int)]] | 416 add: [dart.void, [core.List$(core.int)]] |
417 }) | 417 }) |
418 }); | 418 }); |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
686 replace = '&'; | 686 replace = '&'; |
687 break; | 687 break; |
688 } | 688 } |
689 case ' ': | 689 case ' ': |
690 { | 690 { |
691 replace = ' '; | 691 replace = ' '; |
692 break; | 692 break; |
693 } | 693 } |
694 case '"': | 694 case '"': |
695 { | 695 { |
696 if (this.mode.escapeQuot) | 696 if (dart.notNull(this.mode.escapeQuot)) |
697 replace = '"'; | 697 replace = '"'; |
698 break; | 698 break; |
699 } | 699 } |
700 case "'": | 700 case "'": |
701 { | 701 { |
702 if (this.mode.escapeApos) | 702 if (dart.notNull(this.mode.escapeApos)) |
703 replace = '''; | 703 replace = '''; |
704 break; | 704 break; |
705 } | 705 } |
706 case '<': | 706 case '<': |
707 { | 707 { |
708 if (this.mode.escapeLtGt) | 708 if (dart.notNull(this.mode.escapeLtGt)) |
709 replace = '<'; | 709 replace = '<'; |
710 break; | 710 break; |
711 } | 711 } |
712 case '>': | 712 case '>': |
713 { | 713 { |
714 if (this.mode.escapeLtGt) | 714 if (dart.notNull(this.mode.escapeLtGt)) |
715 replace = '>'; | 715 replace = '>'; |
716 break; | 716 break; |
717 } | 717 } |
718 case '/': | 718 case '/': |
719 { | 719 { |
720 if (this.mode.escapeSlash) | 720 if (dart.notNull(this.mode.escapeSlash)) |
721 replace = '/'; | 721 replace = '/'; |
722 break; | 722 break; |
723 } | 723 } |
724 } | 724 } |
725 if (replace != null) { | 725 if (replace != null) { |
726 if (result == null) | 726 if (result == null) |
727 result = new core.StringBuffer(text[dartx.substring](start, i)); | 727 result = new core.StringBuffer(text[dartx.substring](start, i)); |
728 result.write(replace); | 728 result.write(replace); |
729 } else if (result != null) { | 729 } else if (result != null) { |
730 result.write(ch); | 730 result.write(ch); |
(...skipping 24 matching lines...) Expand all Loading... |
755 _HtmlEscapeSink(escape, sink) { | 755 _HtmlEscapeSink(escape, sink) { |
756 this[_escape] = escape; | 756 this[_escape] = escape; |
757 this[_sink] = sink; | 757 this[_sink] = sink; |
758 } | 758 } |
759 addSlice(chunk, start, end, isLast) { | 759 addSlice(chunk, start, end, isLast) { |
760 let val = this[_escape][_convert](chunk, start, end); | 760 let val = this[_escape][_convert](chunk, start, end); |
761 if (val == null) { | 761 if (val == null) { |
762 this[_sink].addSlice(chunk, start, end, isLast); | 762 this[_sink].addSlice(chunk, start, end, isLast); |
763 } else { | 763 } else { |
764 this[_sink].add(val); | 764 this[_sink].add(val); |
765 if (isLast) | 765 if (dart.notNull(isLast)) |
766 this[_sink].close(); | 766 this[_sink].close(); |
767 } | 767 } |
768 } | 768 } |
769 close() { | 769 close() { |
770 return this[_sink].close(); | 770 return this[_sink].close(); |
771 } | 771 } |
772 } | 772 } |
773 dart.setSignature(_HtmlEscapeSink, { | 773 dart.setSignature(_HtmlEscapeSink, { |
774 constructors: () => ({_HtmlEscapeSink: [_HtmlEscapeSink, [HtmlEscape, String
ConversionSink]]}), | 774 constructors: () => ({_HtmlEscapeSink: [_HtmlEscapeSink, [HtmlEscape, String
ConversionSink]]}), |
775 methods: () => ({ | 775 methods: () => ({ |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
920 if (bufferSize === void 0) | 920 if (bufferSize === void 0) |
921 bufferSize = JsonUtf8Encoder.DEFAULT_BUFFER_SIZE; | 921 bufferSize = JsonUtf8Encoder.DEFAULT_BUFFER_SIZE; |
922 this[_indent] = JsonUtf8Encoder._utf8Encode(indent); | 922 this[_indent] = JsonUtf8Encoder._utf8Encode(indent); |
923 this[_toEncodable$] = toEncodable; | 923 this[_toEncodable$] = toEncodable; |
924 this[_bufferSize] = bufferSize; | 924 this[_bufferSize] = bufferSize; |
925 super.Converter(); | 925 super.Converter(); |
926 } | 926 } |
927 static _utf8Encode(string) { | 927 static _utf8Encode(string) { |
928 if (string == null) | 928 if (string == null) |
929 return null; | 929 return null; |
930 if (string[dartx.isEmpty]) | 930 if (dart.notNull(string[dartx.isEmpty])) |
931 return typed_data.Uint8List.new(0); | 931 return typed_data.Uint8List.new(0); |
932 checkAscii: { | 932 checkAscii: { |
933 for (let i = 0; dart.notNull(i) < dart.notNull(string.length); i = dart.
notNull(i) + 1) { | 933 for (let i = 0; dart.notNull(i) < dart.notNull(string.length); i = dart.
notNull(i) + 1) { |
934 if (dart.notNull(string[dartx.codeUnitAt](i)) >= 128) | 934 if (dart.notNull(string[dartx.codeUnitAt](i)) >= 128) |
935 break checkAscii; | 935 break checkAscii; |
936 } | 936 } |
937 return string[dartx.codeUnits]; | 937 return string[dartx.codeUnits]; |
938 } | 938 } |
939 return UTF8.encode(string); | 939 return UTF8.encode(string); |
940 } | 940 } |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
995 let _isDone = Symbol('_isDone'); | 995 let _isDone = Symbol('_isDone'); |
996 class _JsonEncoderSink extends ChunkedConversionSink$(core.Object) { | 996 class _JsonEncoderSink extends ChunkedConversionSink$(core.Object) { |
997 _JsonEncoderSink(sink, toEncodable, indent) { | 997 _JsonEncoderSink(sink, toEncodable, indent) { |
998 this[_sink] = sink; | 998 this[_sink] = sink; |
999 this[_toEncodable$] = toEncodable; | 999 this[_toEncodable$] = toEncodable; |
1000 this[_indent] = indent; | 1000 this[_indent] = indent; |
1001 this[_isDone] = false; | 1001 this[_isDone] = false; |
1002 super.ChunkedConversionSink(); | 1002 super.ChunkedConversionSink(); |
1003 } | 1003 } |
1004 add(o) { | 1004 add(o) { |
1005 if (this[_isDone]) { | 1005 if (dart.notNull(this[_isDone])) { |
1006 throw new core.StateError("Only one call to add allowed"); | 1006 throw new core.StateError("Only one call to add allowed"); |
1007 } | 1007 } |
1008 this[_isDone] = true; | 1008 this[_isDone] = true; |
1009 let stringSink = this[_sink].asStringSink(); | 1009 let stringSink = this[_sink].asStringSink(); |
1010 _JsonStringStringifier.printOn(o, stringSink, dart.as(this[_toEncodable$],
dart.functionType(core.Object, [dart.bottom])), this[_indent]); | 1010 _JsonStringStringifier.printOn(o, stringSink, dart.as(this[_toEncodable$],
dart.functionType(core.Object, [dart.bottom])), this[_indent]); |
1011 stringSink.close(); | 1011 stringSink.close(); |
1012 } | 1012 } |
1013 close() {} | 1013 close() {} |
1014 } | 1014 } |
1015 dart.setSignature(_JsonEncoderSink, { | 1015 dart.setSignature(_JsonEncoderSink, { |
(...skipping 10 matching lines...) Expand all Loading... |
1026 this[_toEncodable$] = toEncodable; | 1026 this[_toEncodable$] = toEncodable; |
1027 this[_indent] = indent; | 1027 this[_indent] = indent; |
1028 this[_bufferSize] = bufferSize; | 1028 this[_bufferSize] = bufferSize; |
1029 this[_isDone] = false; | 1029 this[_isDone] = false; |
1030 super.ChunkedConversionSink(); | 1030 super.ChunkedConversionSink(); |
1031 } | 1031 } |
1032 [_addChunk](chunk, start, end) { | 1032 [_addChunk](chunk, start, end) { |
1033 this[_sink].addSlice(chunk, start, end, false); | 1033 this[_sink].addSlice(chunk, start, end, false); |
1034 } | 1034 } |
1035 add(object) { | 1035 add(object) { |
1036 if (this[_isDone]) { | 1036 if (dart.notNull(this[_isDone])) { |
1037 throw new core.StateError("Only one call to add allowed"); | 1037 throw new core.StateError("Only one call to add allowed"); |
1038 } | 1038 } |
1039 this[_isDone] = true; | 1039 this[_isDone] = true; |
1040 _JsonUtf8Stringifier.stringify(object, this[_indent], dart.as(this[_toEnco
dable$], dart.functionType(core.Object, [core.Object])), this[_bufferSize], dart
.bind(this, _addChunk)); | 1040 _JsonUtf8Stringifier.stringify(object, this[_indent], dart.as(this[_toEnco
dable$], dart.functionType(core.Object, [core.Object])), this[_bufferSize], dart
.bind(this, _addChunk)); |
1041 this[_sink].close(); | 1041 this[_sink].close(); |
1042 } | 1042 } |
1043 close() { | 1043 close() { |
1044 if (!dart.notNull(this[_isDone])) { | 1044 if (!dart.notNull(this[_isDone])) { |
1045 this[_isDone] = true; | 1045 this[_isDone] = true; |
1046 this[_sink].close(); | 1046 this[_sink].close(); |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1169 } | 1169 } |
1170 } | 1170 } |
1171 if (offset == 0) { | 1171 if (offset == 0) { |
1172 this.writeString(s); | 1172 this.writeString(s); |
1173 } else if (dart.notNull(offset) < dart.notNull(length)) { | 1173 } else if (dart.notNull(offset) < dart.notNull(length)) { |
1174 this.writeStringSlice(s, offset, length); | 1174 this.writeStringSlice(s, offset, length); |
1175 } | 1175 } |
1176 } | 1176 } |
1177 [_checkCycle](object) { | 1177 [_checkCycle](object) { |
1178 for (let i = 0; dart.notNull(i) < dart.notNull(this[_seen].length); i = da
rt.notNull(i) + 1) { | 1178 for (let i = 0; dart.notNull(i) < dart.notNull(this[_seen].length); i = da
rt.notNull(i) + 1) { |
1179 if (core.identical(object, this[_seen][dartx.get](i))) { | 1179 if (dart.notNull(core.identical(object, this[_seen][dartx.get](i)))) { |
1180 throw new JsonCyclicError(object); | 1180 throw new JsonCyclicError(object); |
1181 } | 1181 } |
1182 } | 1182 } |
1183 this[_seen][dartx.add](object); | 1183 this[_seen][dartx.add](object); |
1184 } | 1184 } |
1185 [_removeSeen](object) { | 1185 [_removeSeen](object) { |
1186 dart.assert(!dart.notNull(this[_seen][dartx.isEmpty])); | 1186 dart.assert(!dart.notNull(this[_seen][dartx.isEmpty])); |
1187 dart.assert(core.identical(this[_seen][dartx.last], object)); | 1187 dart.assert(core.identical(this[_seen][dartx.last], object)); |
1188 this[_seen][dartx.removeLast](); | 1188 this[_seen][dartx.removeLast](); |
1189 } | 1189 } |
1190 writeObject(object) { | 1190 writeObject(object) { |
1191 if (this.writeJsonValue(object)) | 1191 if (dart.notNull(this.writeJsonValue(object))) |
1192 return; | 1192 return; |
1193 this[_checkCycle](object); | 1193 this[_checkCycle](object); |
1194 try { | 1194 try { |
1195 let customJson = dart.dcall(this[_toEncodable$], object); | 1195 let customJson = dart.dcall(this[_toEncodable$], object); |
1196 if (!dart.notNull(this.writeJsonValue(customJson))) { | 1196 if (!dart.notNull(this.writeJsonValue(customJson))) { |
1197 throw new JsonUnsupportedObjectError(object); | 1197 throw new JsonUnsupportedObjectError(object); |
1198 } | 1198 } |
1199 this[_removeSeen](object); | 1199 this[_removeSeen](object); |
1200 } catch (e) { | 1200 } catch (e) { |
1201 throw new JsonUnsupportedObjectError(object, {cause: e}); | 1201 throw new JsonUnsupportedObjectError(object, {cause: e}); |
1202 } | 1202 } |
1203 | 1203 |
1204 } | 1204 } |
1205 writeJsonValue(object) { | 1205 writeJsonValue(object) { |
1206 if (dart.is(object, core.num)) { | 1206 if (dart.is(object, core.num)) { |
1207 if (dart.dsend(dart.dload(object, 'isFinite'), '!')) | 1207 if (!dart.notNull(dart.as(dart.dload(object, 'isFinite'), core.bool))) |
1208 return false; | 1208 return false; |
1209 this.writeNumber(dart.as(object, core.num)); | 1209 this.writeNumber(dart.as(object, core.num)); |
1210 return true; | 1210 return true; |
1211 } else if (core.identical(object, true)) { | 1211 } else if (dart.notNull(core.identical(object, true))) { |
1212 this.writeString('true'); | 1212 this.writeString('true'); |
1213 return true; | 1213 return true; |
1214 } else if (core.identical(object, false)) { | 1214 } else if (dart.notNull(core.identical(object, false))) { |
1215 this.writeString('false'); | 1215 this.writeString('false'); |
1216 return true; | 1216 return true; |
1217 } else if (object == null) { | 1217 } else if (object == null) { |
1218 this.writeString('null'); | 1218 this.writeString('null'); |
1219 return true; | 1219 return true; |
1220 } else if (typeof object == 'string') { | 1220 } else if (typeof object == 'string') { |
1221 this.writeString('"'); | 1221 this.writeString('"'); |
1222 this.writeStringContent(dart.as(object, core.String)); | 1222 this.writeStringContent(dart.as(object, core.String)); |
1223 this.writeString('"'); | 1223 this.writeString('"'); |
1224 return true; | 1224 return true; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1287 _JsonStringifier.CHAR_n = 110; | 1287 _JsonStringifier.CHAR_n = 110; |
1288 _JsonStringifier.CHAR_r = 114; | 1288 _JsonStringifier.CHAR_r = 114; |
1289 _JsonStringifier.CHAR_t = 116; | 1289 _JsonStringifier.CHAR_t = 116; |
1290 _JsonStringifier.CHAR_u = 117; | 1290 _JsonStringifier.CHAR_u = 117; |
1291 let _indentLevel = Symbol('_indentLevel'); | 1291 let _indentLevel = Symbol('_indentLevel'); |
1292 class _JsonPrettyPrintMixin extends core.Object { | 1292 class _JsonPrettyPrintMixin extends core.Object { |
1293 _JsonPrettyPrintMixin() { | 1293 _JsonPrettyPrintMixin() { |
1294 this[_indentLevel] = 0; | 1294 this[_indentLevel] = 0; |
1295 } | 1295 } |
1296 writeList(list) { | 1296 writeList(list) { |
1297 if (list[dartx.isEmpty]) { | 1297 if (dart.notNull(list[dartx.isEmpty])) { |
1298 this.writeString('[]'); | 1298 this.writeString('[]'); |
1299 } else { | 1299 } else { |
1300 this.writeString('[\n'); | 1300 this.writeString('[\n'); |
1301 this[_indentLevel] = dart.notNull(this[_indentLevel]) + 1; | 1301 this[_indentLevel] = dart.notNull(this[_indentLevel]) + 1; |
1302 this.writeIndentation(this[_indentLevel]); | 1302 this.writeIndentation(this[_indentLevel]); |
1303 this.writeObject(list[dartx.get](0)); | 1303 this.writeObject(list[dartx.get](0)); |
1304 for (let i = 1; dart.notNull(i) < dart.notNull(list.length); i = dart.no
tNull(i) + 1) { | 1304 for (let i = 1; dart.notNull(i) < dart.notNull(list.length); i = dart.no
tNull(i) + 1) { |
1305 this.writeString(',\n'); | 1305 this.writeString(',\n'); |
1306 this.writeIndentation(this[_indentLevel]); | 1306 this.writeIndentation(this[_indentLevel]); |
1307 this.writeObject(list[dartx.get](i)); | 1307 this.writeObject(list[dartx.get](i)); |
1308 } | 1308 } |
1309 this.writeString('\n'); | 1309 this.writeString('\n'); |
1310 this[_indentLevel] = dart.notNull(this[_indentLevel]) - 1; | 1310 this[_indentLevel] = dart.notNull(this[_indentLevel]) - 1; |
1311 this.writeIndentation(this[_indentLevel]); | 1311 this.writeIndentation(this[_indentLevel]); |
1312 this.writeString(']'); | 1312 this.writeString(']'); |
1313 } | 1313 } |
1314 } | 1314 } |
1315 writeMap(map) { | 1315 writeMap(map) { |
1316 if (map.isEmpty) { | 1316 if (dart.notNull(map.isEmpty)) { |
1317 this.writeString('{}'); | 1317 this.writeString('{}'); |
1318 } else { | 1318 } else { |
1319 this.writeString('{\n'); | 1319 this.writeString('{\n'); |
1320 this[_indentLevel] = dart.notNull(this[_indentLevel]) + 1; | 1320 this[_indentLevel] = dart.notNull(this[_indentLevel]) + 1; |
1321 let first = true; | 1321 let first = true; |
1322 map.forEach(dart.fn((key, value) => { | 1322 map.forEach(dart.fn((key, value) => { |
1323 if (!dart.notNull(first)) { | 1323 if (!dart.notNull(first)) { |
1324 this.writeString(",\n"); | 1324 this.writeString(",\n"); |
1325 } | 1325 } |
1326 this.writeIndentation(this[_indentLevel]); | 1326 this.writeIndentation(this[_indentLevel]); |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1562 this[_allowInvalid] = allowInvalid; | 1562 this[_allowInvalid] = allowInvalid; |
1563 super.Encoding(); | 1563 super.Encoding(); |
1564 } | 1564 } |
1565 get name() { | 1565 get name() { |
1566 return "iso-8859-1"; | 1566 return "iso-8859-1"; |
1567 } | 1567 } |
1568 decode(bytes, opts) { | 1568 decode(bytes, opts) { |
1569 let allowInvalid = opts && 'allowInvalid' in opts ? opts.allowInvalid : nu
ll; | 1569 let allowInvalid = opts && 'allowInvalid' in opts ? opts.allowInvalid : nu
ll; |
1570 if (allowInvalid == null) | 1570 if (allowInvalid == null) |
1571 allowInvalid = this[_allowInvalid]; | 1571 allowInvalid = this[_allowInvalid]; |
1572 if (allowInvalid) { | 1572 if (dart.notNull(allowInvalid)) { |
1573 return dart.const(new Latin1Decoder({allowInvalid: true})).convert(bytes
); | 1573 return dart.const(new Latin1Decoder({allowInvalid: true})).convert(bytes
); |
1574 } else { | 1574 } else { |
1575 return dart.const(new Latin1Decoder({allowInvalid: false})).convert(byte
s); | 1575 return dart.const(new Latin1Decoder({allowInvalid: false})).convert(byte
s); |
1576 } | 1576 } |
1577 } | 1577 } |
1578 get encoder() { | 1578 get encoder() { |
1579 return dart.const(new Latin1Encoder()); | 1579 return dart.const(new Latin1Encoder()); |
1580 } | 1580 } |
1581 get decoder() { | 1581 get decoder() { |
1582 return this[_allowInvalid] ? dart.const(new Latin1Decoder({allowInvalid: t
rue})) : dart.const(new Latin1Decoder({allowInvalid: false})); | 1582 return dart.notNull(this[_allowInvalid]) ? dart.const(new Latin1Decoder({a
llowInvalid: true})) : dart.const(new Latin1Decoder({allowInvalid: false})); |
1583 } | 1583 } |
1584 } | 1584 } |
1585 dart.setSignature(Latin1Codec, { | 1585 dart.setSignature(Latin1Codec, { |
1586 constructors: () => ({Latin1Codec: [Latin1Codec, [], {allowInvalid: core.boo
l}]}), | 1586 constructors: () => ({Latin1Codec: [Latin1Codec, [], {allowInvalid: core.boo
l}]}), |
1587 methods: () => ({decode: [core.String, [core.List$(core.int)], {allowInvalid
: core.bool}]}) | 1587 methods: () => ({decode: [core.String, [core.List$(core.int)], {allowInvalid
: core.bool}]}) |
1588 }); | 1588 }); |
1589 let LATIN1 = dart.const(new Latin1Codec()); | 1589 let LATIN1 = dart.const(new Latin1Codec()); |
1590 let _LATIN1_MASK = 255; | 1590 let _LATIN1_MASK = 255; |
1591 class Latin1Encoder extends _UnicodeSubsetEncoder { | 1591 class Latin1Encoder extends _UnicodeSubsetEncoder { |
1592 Latin1Encoder() { | 1592 Latin1Encoder() { |
(...skipping 30 matching lines...) Expand all Loading... |
1623 this[_sink] = sink; | 1623 this[_sink] = sink; |
1624 } | 1624 } |
1625 close() { | 1625 close() { |
1626 this[_sink].close(); | 1626 this[_sink].close(); |
1627 } | 1627 } |
1628 add(source) { | 1628 add(source) { |
1629 this.addSlice(source, 0, source.length, false); | 1629 this.addSlice(source, 0, source.length, false); |
1630 } | 1630 } |
1631 [_addSliceToSink](source, start, end, isLast) { | 1631 [_addSliceToSink](source, start, end, isLast) { |
1632 this[_sink].add(core.String.fromCharCodes(source, start, end)); | 1632 this[_sink].add(core.String.fromCharCodes(source, start, end)); |
1633 if (isLast) | 1633 if (dart.notNull(isLast)) |
1634 this.close(); | 1634 this.close(); |
1635 } | 1635 } |
1636 addSlice(source, start, end, isLast) { | 1636 addSlice(source, start, end, isLast) { |
1637 core.RangeError.checkValidRange(start, end, source.length); | 1637 core.RangeError.checkValidRange(start, end, source.length); |
1638 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { | 1638 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { |
1639 let char = source[dartx.get](i); | 1639 let char = source[dartx.get](i); |
1640 if (dart.notNull(char) > dart.notNull(_LATIN1_MASK) || dart.notNull(char
) < 0) { | 1640 if (dart.notNull(char) > dart.notNull(_LATIN1_MASK) || dart.notNull(char
) < 0) { |
1641 throw new core.FormatException("Source contains non-Latin-1 characters
."); | 1641 throw new core.FormatException("Source contains non-Latin-1 characters
."); |
1642 } | 1642 } |
1643 } | 1643 } |
1644 if (dart.notNull(start) < dart.notNull(end)) { | 1644 if (dart.notNull(start) < dart.notNull(end)) { |
1645 this[_addSliceToSink](source, start, end, isLast); | 1645 this[_addSliceToSink](source, start, end, isLast); |
1646 } | 1646 } |
1647 if (isLast) { | 1647 if (dart.notNull(isLast)) { |
1648 this.close(); | 1648 this.close(); |
1649 } | 1649 } |
1650 } | 1650 } |
1651 } | 1651 } |
1652 dart.setSignature(_Latin1DecoderSink, { | 1652 dart.setSignature(_Latin1DecoderSink, { |
1653 constructors: () => ({_Latin1DecoderSink: [_Latin1DecoderSink, [StringConver
sionSink]]}), | 1653 constructors: () => ({_Latin1DecoderSink: [_Latin1DecoderSink, [StringConver
sionSink]]}), |
1654 methods: () => ({ | 1654 methods: () => ({ |
1655 close: [dart.void, []], | 1655 close: [dart.void, []], |
1656 add: [dart.void, [core.List$(core.int)]], | 1656 add: [dart.void, [core.List$(core.int)]], |
1657 [_addSliceToSink]: [dart.void, [core.List$(core.int), core.int, core.int,
core.bool]] | 1657 [_addSliceToSink]: [dart.void, [core.List$(core.int), core.int, core.int,
core.bool]] |
(...skipping 10 matching lines...) Expand all Loading... |
1668 if (dart.notNull(char) > dart.notNull(_LATIN1_MASK) || dart.notNull(char
) < 0) { | 1668 if (dart.notNull(char) > dart.notNull(_LATIN1_MASK) || dart.notNull(char
) < 0) { |
1669 if (dart.notNull(i) > dart.notNull(start)) | 1669 if (dart.notNull(i) > dart.notNull(start)) |
1670 this[_addSliceToSink](source, start, i, false); | 1670 this[_addSliceToSink](source, start, i, false); |
1671 this[_addSliceToSink](dart.const(dart.list([65533], core.int)), 0, 1,
false); | 1671 this[_addSliceToSink](dart.const(dart.list([65533], core.int)), 0, 1,
false); |
1672 start = dart.notNull(i) + 1; | 1672 start = dart.notNull(i) + 1; |
1673 } | 1673 } |
1674 } | 1674 } |
1675 if (dart.notNull(start) < dart.notNull(end)) { | 1675 if (dart.notNull(start) < dart.notNull(end)) { |
1676 this[_addSliceToSink](source, start, end, isLast); | 1676 this[_addSliceToSink](source, start, end, isLast); |
1677 } | 1677 } |
1678 if (isLast) { | 1678 if (dart.notNull(isLast)) { |
1679 this.close(); | 1679 this.close(); |
1680 } | 1680 } |
1681 } | 1681 } |
1682 } | 1682 } |
1683 dart.setSignature(_Latin1AllowInvalidDecoderSink, { | 1683 dart.setSignature(_Latin1AllowInvalidDecoderSink, { |
1684 constructors: () => ({_Latin1AllowInvalidDecoderSink: [_Latin1AllowInvalidDe
coderSink, [StringConversionSink]]}) | 1684 constructors: () => ({_Latin1AllowInvalidDecoderSink: [_Latin1AllowInvalidDe
coderSink, [StringConversionSink]]}) |
1685 }); | 1685 }); |
1686 class LineSplitter extends Converter$(core.String, core.List$(core.String)) { | 1686 class LineSplitter extends Converter$(core.String, core.List$(core.String)) { |
1687 LineSplitter() { | 1687 LineSplitter() { |
1688 super.Converter(); | 1688 super.Converter(); |
(...skipping 24 matching lines...) Expand all Loading... |
1713 this[_carry] = null; | 1713 this[_carry] = null; |
1714 } | 1714 } |
1715 addSlice(chunk, start, end, isLast) { | 1715 addSlice(chunk, start, end, isLast) { |
1716 if (this[_carry] != null) { | 1716 if (this[_carry] != null) { |
1717 chunk = dart.notNull(this[_carry]) + dart.notNull(chunk[dartx.substring]
(start, end)); | 1717 chunk = dart.notNull(this[_carry]) + dart.notNull(chunk[dartx.substring]
(start, end)); |
1718 start = 0; | 1718 start = 0; |
1719 end = chunk.length; | 1719 end = chunk.length; |
1720 this[_carry] = null; | 1720 this[_carry] = null; |
1721 } | 1721 } |
1722 this[_carry] = _LineSplitterSink._addSlice(chunk, start, end, isLast, dart
.bind(this[_sink], 'add')); | 1722 this[_carry] = _LineSplitterSink._addSlice(chunk, start, end, isLast, dart
.bind(this[_sink], 'add')); |
1723 if (isLast) | 1723 if (dart.notNull(isLast)) |
1724 this[_sink].close(); | 1724 this[_sink].close(); |
1725 } | 1725 } |
1726 close() { | 1726 close() { |
1727 this.addSlice('', 0, 0, true); | 1727 this.addSlice('', 0, 0, true); |
1728 } | 1728 } |
1729 static _addSlice(chunk, start, end, isLast, adder) { | 1729 static _addSlice(chunk, start, end, isLast, adder) { |
1730 let pos = start; | 1730 let pos = start; |
1731 while (dart.notNull(pos) < dart.notNull(end)) { | 1731 while (dart.notNull(pos) < dart.notNull(end)) { |
1732 let skip = 0; | 1732 let skip = 0; |
1733 let char = chunk[dartx.codeUnitAt](pos); | 1733 let char = chunk[dartx.codeUnitAt](pos); |
(...skipping 11 matching lines...) Expand all Loading... |
1745 } | 1745 } |
1746 if (dart.notNull(skip) > 0) { | 1746 if (dart.notNull(skip) > 0) { |
1747 adder(chunk[dartx.substring](start, pos)); | 1747 adder(chunk[dartx.substring](start, pos)); |
1748 start = pos = dart.notNull(pos) + dart.notNull(skip); | 1748 start = pos = dart.notNull(pos) + dart.notNull(skip); |
1749 } else { | 1749 } else { |
1750 pos = dart.notNull(pos) + 1; | 1750 pos = dart.notNull(pos) + 1; |
1751 } | 1751 } |
1752 } | 1752 } |
1753 if (pos != start) { | 1753 if (pos != start) { |
1754 let carry = chunk[dartx.substring](start, pos); | 1754 let carry = chunk[dartx.substring](start, pos); |
1755 if (isLast) { | 1755 if (dart.notNull(isLast)) { |
1756 adder(carry); | 1756 adder(carry); |
1757 } else { | 1757 } else { |
1758 return carry; | 1758 return carry; |
1759 } | 1759 } |
1760 } | 1760 } |
1761 return null; | 1761 return null; |
1762 } | 1762 } |
1763 } | 1763 } |
1764 dart.setSignature(_LineSplitterSink, { | 1764 dart.setSignature(_LineSplitterSink, { |
1765 constructors: () => ({_LineSplitterSink: [_LineSplitterSink, [StringConversi
onSink]]}), | 1765 constructors: () => ({_LineSplitterSink: [_LineSplitterSink, [StringConversi
onSink]]}), |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1839 writeAll: [dart.void, [core.Iterable], [core.String]] | 1839 writeAll: [dart.void, [core.Iterable], [core.String]] |
1840 }) | 1840 }) |
1841 }); | 1841 }); |
1842 let _flush = Symbol('_flush'); | 1842 let _flush = Symbol('_flush'); |
1843 class _StringConversionSinkAsStringSinkAdapter extends core.Object { | 1843 class _StringConversionSinkAsStringSinkAdapter extends core.Object { |
1844 _StringConversionSinkAsStringSinkAdapter(chunkedSink) { | 1844 _StringConversionSinkAsStringSinkAdapter(chunkedSink) { |
1845 this[_chunkedSink] = chunkedSink; | 1845 this[_chunkedSink] = chunkedSink; |
1846 this[_buffer] = new core.StringBuffer(); | 1846 this[_buffer] = new core.StringBuffer(); |
1847 } | 1847 } |
1848 close() { | 1848 close() { |
1849 if (this[_buffer].isNotEmpty) | 1849 if (dart.notNull(this[_buffer].isNotEmpty)) |
1850 this[_flush](); | 1850 this[_flush](); |
1851 this[_chunkedSink].close(); | 1851 this[_chunkedSink].close(); |
1852 } | 1852 } |
1853 writeCharCode(charCode) { | 1853 writeCharCode(charCode) { |
1854 this[_buffer].writeCharCode(charCode); | 1854 this[_buffer].writeCharCode(charCode); |
1855 if (dart.notNull(this[_buffer].length) > dart.notNull(_StringConversionSin
kAsStringSinkAdapter._MIN_STRING_SIZE)) | 1855 if (dart.notNull(this[_buffer].length) > dart.notNull(_StringConversionSin
kAsStringSinkAdapter._MIN_STRING_SIZE)) |
1856 this[_flush](); | 1856 this[_flush](); |
1857 } | 1857 } |
1858 write(o) { | 1858 write(o) { |
1859 if (this[_buffer].isNotEmpty) | 1859 if (dart.notNull(this[_buffer].isNotEmpty)) |
1860 this[_flush](); | 1860 this[_flush](); |
1861 let str = dart.toString(o); | 1861 let str = dart.toString(o); |
1862 this[_chunkedSink].add(dart.toString(o)); | 1862 this[_chunkedSink].add(dart.toString(o)); |
1863 } | 1863 } |
1864 writeln(o) { | 1864 writeln(o) { |
1865 if (o === void 0) | 1865 if (o === void 0) |
1866 o = ""; | 1866 o = ""; |
1867 this[_buffer].writeln(o); | 1867 this[_buffer].writeln(o); |
1868 if (dart.notNull(this[_buffer].length) > dart.notNull(_StringConversionSin
kAsStringSinkAdapter._MIN_STRING_SIZE)) | 1868 if (dart.notNull(this[_buffer].length) > dart.notNull(_StringConversionSin
kAsStringSinkAdapter._MIN_STRING_SIZE)) |
1869 this[_flush](); | 1869 this[_flush](); |
1870 } | 1870 } |
1871 writeAll(objects, separator) { | 1871 writeAll(objects, separator) { |
1872 if (separator === void 0) | 1872 if (separator === void 0) |
1873 separator = ""; | 1873 separator = ""; |
1874 if (this[_buffer].isNotEmpty) | 1874 if (dart.notNull(this[_buffer].isNotEmpty)) |
1875 this[_flush](); | 1875 this[_flush](); |
1876 let iterator = objects[dartx.iterator]; | 1876 let iterator = objects[dartx.iterator]; |
1877 if (!dart.notNull(iterator.moveNext())) | 1877 if (!dart.notNull(iterator.moveNext())) |
1878 return; | 1878 return; |
1879 if (separator[dartx.isEmpty]) { | 1879 if (dart.notNull(separator[dartx.isEmpty])) { |
1880 do { | 1880 do { |
1881 this[_chunkedSink].add(dart.toString(iterator.current)); | 1881 this[_chunkedSink].add(dart.toString(iterator.current)); |
1882 } while (iterator.moveNext()); | 1882 } while (dart.notNull(iterator.moveNext())); |
1883 } else { | 1883 } else { |
1884 this[_chunkedSink].add(dart.toString(iterator.current)); | 1884 this[_chunkedSink].add(dart.toString(iterator.current)); |
1885 while (iterator.moveNext()) { | 1885 while (dart.notNull(iterator.moveNext())) { |
1886 this.write(separator); | 1886 this.write(separator); |
1887 this[_chunkedSink].add(dart.toString(iterator.current)); | 1887 this[_chunkedSink].add(dart.toString(iterator.current)); |
1888 } | 1888 } |
1889 } | 1889 } |
1890 } | 1890 } |
1891 [_flush]() { | 1891 [_flush]() { |
1892 let accumulated = dart.toString(this[_buffer]); | 1892 let accumulated = dart.toString(this[_buffer]); |
1893 this[_buffer].clear(); | 1893 this[_buffer].clear(); |
1894 this[_chunkedSink].add(accumulated); | 1894 this[_chunkedSink].add(accumulated); |
1895 } | 1895 } |
(...skipping 18 matching lines...) Expand all Loading... |
1914 } | 1914 } |
1915 close() {} | 1915 close() {} |
1916 addSlice(str, start, end, isLast) { | 1916 addSlice(str, start, end, isLast) { |
1917 if (start != 0 || end != str.length) { | 1917 if (start != 0 || end != str.length) { |
1918 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNul
l(i) + 1) { | 1918 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNul
l(i) + 1) { |
1919 this[_stringSink].writeCharCode(str[dartx.codeUnitAt](i)); | 1919 this[_stringSink].writeCharCode(str[dartx.codeUnitAt](i)); |
1920 } | 1920 } |
1921 } else { | 1921 } else { |
1922 this[_stringSink].write(str); | 1922 this[_stringSink].write(str); |
1923 } | 1923 } |
1924 if (isLast) | 1924 if (dart.notNull(isLast)) |
1925 this.close(); | 1925 this.close(); |
1926 } | 1926 } |
1927 add(str) { | 1927 add(str) { |
1928 return this[_stringSink].write(str); | 1928 return this[_stringSink].write(str); |
1929 } | 1929 } |
1930 asUtf8Sink(allowMalformed) { | 1930 asUtf8Sink(allowMalformed) { |
1931 return new _Utf8StringSinkAdapter(this, this[_stringSink], allowMalformed)
; | 1931 return new _Utf8StringSinkAdapter(this, this[_stringSink], allowMalformed)
; |
1932 } | 1932 } |
1933 asStringSink() { | 1933 asStringSink() { |
1934 return ClosableStringSink.fromStringSink(this[_stringSink], dart.bind(this
, 'close')); | 1934 return ClosableStringSink.fromStringSink(this[_stringSink], dart.bind(this
, 'close')); |
(...skipping 30 matching lines...) Expand all Loading... |
1965 } | 1965 } |
1966 add(str) { | 1966 add(str) { |
1967 return this[_sink].add(str); | 1967 return this[_sink].add(str); |
1968 } | 1968 } |
1969 addSlice(str, start, end, isLast) { | 1969 addSlice(str, start, end, isLast) { |
1970 if (start == 0 && end == str.length) { | 1970 if (start == 0 && end == str.length) { |
1971 this.add(str); | 1971 this.add(str); |
1972 } else { | 1972 } else { |
1973 this.add(str[dartx.substring](start, end)); | 1973 this.add(str[dartx.substring](start, end)); |
1974 } | 1974 } |
1975 if (isLast) | 1975 if (dart.notNull(isLast)) |
1976 this.close(); | 1976 this.close(); |
1977 } | 1977 } |
1978 close() { | 1978 close() { |
1979 return this[_sink].close(); | 1979 return this[_sink].close(); |
1980 } | 1980 } |
1981 } | 1981 } |
1982 dart.setSignature(_StringAdapterSink, { | 1982 dart.setSignature(_StringAdapterSink, { |
1983 constructors: () => ({_StringAdapterSink: [_StringAdapterSink, [core.Sink$(c
ore.String)]]}), | 1983 constructors: () => ({_StringAdapterSink: [_StringAdapterSink, [core.Sink$(c
ore.String)]]}), |
1984 methods: () => ({ | 1984 methods: () => ({ |
1985 addSlice: [dart.void, [core.String, core.int, core.int, core.bool]], | 1985 addSlice: [dart.void, [core.String, core.int, core.int, core.bool]], |
(...skipping 10 matching lines...) Expand all Loading... |
1996 close() { | 1996 close() { |
1997 this[_decoder].close(); | 1997 this[_decoder].close(); |
1998 if (this[_sink] != null) | 1998 if (this[_sink] != null) |
1999 this[_sink].close(); | 1999 this[_sink].close(); |
2000 } | 2000 } |
2001 add(chunk) { | 2001 add(chunk) { |
2002 this.addSlice(chunk, 0, chunk.length, false); | 2002 this.addSlice(chunk, 0, chunk.length, false); |
2003 } | 2003 } |
2004 addSlice(codeUnits, startIndex, endIndex, isLast) { | 2004 addSlice(codeUnits, startIndex, endIndex, isLast) { |
2005 this[_decoder].convert(codeUnits, startIndex, endIndex); | 2005 this[_decoder].convert(codeUnits, startIndex, endIndex); |
2006 if (isLast) | 2006 if (dart.notNull(isLast)) |
2007 this.close(); | 2007 this.close(); |
2008 } | 2008 } |
2009 } | 2009 } |
2010 dart.setSignature(_Utf8StringSinkAdapter, { | 2010 dart.setSignature(_Utf8StringSinkAdapter, { |
2011 constructors: () => ({_Utf8StringSinkAdapter: [_Utf8StringSinkAdapter, [core
.Sink, core.StringSink, core.bool]]}), | 2011 constructors: () => ({_Utf8StringSinkAdapter: [_Utf8StringSinkAdapter, [core
.Sink, core.StringSink, core.bool]]}), |
2012 methods: () => ({ | 2012 methods: () => ({ |
2013 close: [dart.void, []], | 2013 close: [dart.void, []], |
2014 add: [dart.void, [core.List$(core.int)]], | 2014 add: [dart.void, [core.List$(core.int)]], |
2015 addSlice: [dart.void, [core.List$(core.int), core.int, core.int, core.bool
]] | 2015 addSlice: [dart.void, [core.List$(core.int), core.int, core.int, core.bool
]] |
2016 }) | 2016 }) |
2017 }); | 2017 }); |
2018 class _Utf8ConversionSink extends ByteConversionSink { | 2018 class _Utf8ConversionSink extends ByteConversionSink { |
2019 _Utf8ConversionSink(sink, allowMalformed) { | 2019 _Utf8ConversionSink(sink, allowMalformed) { |
2020 this._(sink, new core.StringBuffer(), allowMalformed); | 2020 this._(sink, new core.StringBuffer(), allowMalformed); |
2021 } | 2021 } |
2022 _(chunkedSink, stringBuffer, allowMalformed) { | 2022 _(chunkedSink, stringBuffer, allowMalformed) { |
2023 this[_chunkedSink] = chunkedSink; | 2023 this[_chunkedSink] = chunkedSink; |
2024 this[_decoder] = new _Utf8Decoder(stringBuffer, allowMalformed); | 2024 this[_decoder] = new _Utf8Decoder(stringBuffer, allowMalformed); |
2025 this[_buffer] = stringBuffer; | 2025 this[_buffer] = stringBuffer; |
2026 super.ByteConversionSink(); | 2026 super.ByteConversionSink(); |
2027 } | 2027 } |
2028 close() { | 2028 close() { |
2029 this[_decoder].close(); | 2029 this[_decoder].close(); |
2030 if (this[_buffer].isNotEmpty) { | 2030 if (dart.notNull(this[_buffer].isNotEmpty)) { |
2031 let accumulated = dart.toString(this[_buffer]); | 2031 let accumulated = dart.toString(this[_buffer]); |
2032 this[_buffer].clear(); | 2032 this[_buffer].clear(); |
2033 this[_chunkedSink].addSlice(accumulated, 0, accumulated.length, true); | 2033 this[_chunkedSink].addSlice(accumulated, 0, accumulated.length, true); |
2034 } else { | 2034 } else { |
2035 this[_chunkedSink].close(); | 2035 this[_chunkedSink].close(); |
2036 } | 2036 } |
2037 } | 2037 } |
2038 add(chunk) { | 2038 add(chunk) { |
2039 this.addSlice(chunk, 0, chunk.length, false); | 2039 this.addSlice(chunk, 0, chunk.length, false); |
2040 } | 2040 } |
2041 addSlice(chunk, startIndex, endIndex, isLast) { | 2041 addSlice(chunk, startIndex, endIndex, isLast) { |
2042 this[_decoder].convert(chunk, startIndex, endIndex); | 2042 this[_decoder].convert(chunk, startIndex, endIndex); |
2043 if (this[_buffer].isNotEmpty) { | 2043 if (dart.notNull(this[_buffer].isNotEmpty)) { |
2044 let accumulated = dart.toString(this[_buffer]); | 2044 let accumulated = dart.toString(this[_buffer]); |
2045 this[_chunkedSink].addSlice(accumulated, 0, accumulated.length, isLast); | 2045 this[_chunkedSink].addSlice(accumulated, 0, accumulated.length, isLast); |
2046 this[_buffer].clear(); | 2046 this[_buffer].clear(); |
2047 return; | 2047 return; |
2048 } | 2048 } |
2049 if (isLast) | 2049 if (dart.notNull(isLast)) |
2050 this.close(); | 2050 this.close(); |
2051 } | 2051 } |
2052 } | 2052 } |
2053 dart.defineNamedConstructor(_Utf8ConversionSink, '_'); | 2053 dart.defineNamedConstructor(_Utf8ConversionSink, '_'); |
2054 dart.setSignature(_Utf8ConversionSink, { | 2054 dart.setSignature(_Utf8ConversionSink, { |
2055 constructors: () => ({ | 2055 constructors: () => ({ |
2056 _Utf8ConversionSink: [_Utf8ConversionSink, [StringConversionSink, core.boo
l]], | 2056 _Utf8ConversionSink: [_Utf8ConversionSink, [StringConversionSink, core.boo
l]], |
2057 _: [_Utf8ConversionSink, [StringConversionSink, core.StringBuffer, core.bo
ol]] | 2057 _: [_Utf8ConversionSink, [StringConversionSink, core.StringBuffer, core.bo
ol]] |
2058 }), | 2058 }), |
2059 methods: () => ({ | 2059 methods: () => ({ |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2145 } | 2145 } |
2146 withBufferSize(bufferSize) { | 2146 withBufferSize(bufferSize) { |
2147 this[_buffer] = _Utf8Encoder._createBuffer(bufferSize); | 2147 this[_buffer] = _Utf8Encoder._createBuffer(bufferSize); |
2148 this[_carry] = 0; | 2148 this[_carry] = 0; |
2149 this[_bufferIndex] = 0; | 2149 this[_bufferIndex] = 0; |
2150 } | 2150 } |
2151 static _createBuffer(size) { | 2151 static _createBuffer(size) { |
2152 return typed_data.Uint8List.new(size); | 2152 return typed_data.Uint8List.new(size); |
2153 } | 2153 } |
2154 [_writeSurrogate](leadingSurrogate, nextCodeUnit) { | 2154 [_writeSurrogate](leadingSurrogate, nextCodeUnit) { |
2155 if (_isTailSurrogate(nextCodeUnit)) { | 2155 if (dart.notNull(_isTailSurrogate(nextCodeUnit))) { |
2156 let rune = _combineSurrogatePair(leadingSurrogate, nextCodeUnit); | 2156 let rune = _combineSurrogatePair(leadingSurrogate, nextCodeUnit); |
2157 dart.assert(dart.notNull(rune) > dart.notNull(_THREE_BYTE_LIMIT)); | 2157 dart.assert(dart.notNull(rune) > dart.notNull(_THREE_BYTE_LIMIT)); |
2158 dart.assert(dart.notNull(rune) <= dart.notNull(_FOUR_BYTE_LIMIT)); | 2158 dart.assert(dart.notNull(rune) <= dart.notNull(_FOUR_BYTE_LIMIT)); |
2159 this[_buffer][dartx.set]((() => { | 2159 this[_buffer][dartx.set]((() => { |
2160 let x = this[_bufferIndex]; | 2160 let x = this[_bufferIndex]; |
2161 this[_bufferIndex] = dart.notNull(x) + 1; | 2161 this[_bufferIndex] = dart.notNull(x) + 1; |
2162 return x; | 2162 return x; |
2163 })(), 240 | dart.notNull(rune) >> 18); | 2163 })(), 240 | dart.notNull(rune) >> 18); |
2164 this[_buffer][dartx.set]((() => { | 2164 this[_buffer][dartx.set]((() => { |
2165 let x = this[_bufferIndex]; | 2165 let x = this[_bufferIndex]; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2204 for (stringIndex = start; dart.notNull(stringIndex) < dart.notNull(end); s
tringIndex = dart.notNull(stringIndex) + 1) { | 2204 for (stringIndex = start; dart.notNull(stringIndex) < dart.notNull(end); s
tringIndex = dart.notNull(stringIndex) + 1) { |
2205 let codeUnit = str[dartx.codeUnitAt](stringIndex); | 2205 let codeUnit = str[dartx.codeUnitAt](stringIndex); |
2206 if (dart.notNull(codeUnit) <= dart.notNull(_ONE_BYTE_LIMIT)) { | 2206 if (dart.notNull(codeUnit) <= dart.notNull(_ONE_BYTE_LIMIT)) { |
2207 if (dart.notNull(this[_bufferIndex]) >= dart.notNull(this[_buffer].len
gth)) | 2207 if (dart.notNull(this[_bufferIndex]) >= dart.notNull(this[_buffer].len
gth)) |
2208 break; | 2208 break; |
2209 this[_buffer][dartx.set]((() => { | 2209 this[_buffer][dartx.set]((() => { |
2210 let x = this[_bufferIndex]; | 2210 let x = this[_bufferIndex]; |
2211 this[_bufferIndex] = dart.notNull(x) + 1; | 2211 this[_bufferIndex] = dart.notNull(x) + 1; |
2212 return x; | 2212 return x; |
2213 })(), codeUnit); | 2213 })(), codeUnit); |
2214 } else if (_isLeadSurrogate(codeUnit)) { | 2214 } else if (dart.notNull(_isLeadSurrogate(codeUnit))) { |
2215 if (dart.notNull(this[_bufferIndex]) + 3 >= dart.notNull(this[_buffer]
.length)) | 2215 if (dart.notNull(this[_bufferIndex]) + 3 >= dart.notNull(this[_buffer]
.length)) |
2216 break; | 2216 break; |
2217 let nextCodeUnit = str[dartx.codeUnitAt](dart.notNull(stringIndex) + 1
); | 2217 let nextCodeUnit = str[dartx.codeUnitAt](dart.notNull(stringIndex) + 1
); |
2218 let wasCombined = this[_writeSurrogate](codeUnit, nextCodeUnit); | 2218 let wasCombined = this[_writeSurrogate](codeUnit, nextCodeUnit); |
2219 if (wasCombined) { | 2219 if (dart.notNull(wasCombined)) { |
2220 stringIndex = dart.notNull(stringIndex) + 1; | 2220 stringIndex = dart.notNull(stringIndex) + 1; |
2221 } | 2221 } |
2222 } else { | 2222 } else { |
2223 let rune = codeUnit; | 2223 let rune = codeUnit; |
2224 if (dart.notNull(rune) <= dart.notNull(_TWO_BYTE_LIMIT)) { | 2224 if (dart.notNull(rune) <= dart.notNull(_TWO_BYTE_LIMIT)) { |
2225 if (dart.notNull(this[_bufferIndex]) + 1 >= dart.notNull(this[_buffe
r].length)) | 2225 if (dart.notNull(this[_bufferIndex]) + 1 >= dart.notNull(this[_buffe
r].length)) |
2226 break; | 2226 break; |
2227 this[_buffer][dartx.set]((() => { | 2227 this[_buffer][dartx.set]((() => { |
2228 let x = this[_bufferIndex]; | 2228 let x = this[_bufferIndex]; |
2229 this[_bufferIndex] = dart.notNull(x) + 1; | 2229 this[_bufferIndex] = dart.notNull(x) + 1; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2292 } | 2292 } |
2293 if (this[_carry] != 0) { | 2293 if (this[_carry] != 0) { |
2294 let nextCodeUnit = 0; | 2294 let nextCodeUnit = 0; |
2295 if (start != end) { | 2295 if (start != end) { |
2296 nextCodeUnit = str[dartx.codeUnitAt](start); | 2296 nextCodeUnit = str[dartx.codeUnitAt](start); |
2297 } else { | 2297 } else { |
2298 dart.assert(isLast); | 2298 dart.assert(isLast); |
2299 } | 2299 } |
2300 let wasCombined = this[_writeSurrogate](this[_carry], nextCodeUnit); | 2300 let wasCombined = this[_writeSurrogate](this[_carry], nextCodeUnit); |
2301 dart.assert(!dart.notNull(wasCombined) || start != end); | 2301 dart.assert(!dart.notNull(wasCombined) || start != end); |
2302 if (wasCombined) { | 2302 if (dart.notNull(wasCombined)) { |
2303 start = dart.notNull(start) + 1; | 2303 start = dart.notNull(start) + 1; |
2304 } | 2304 } |
2305 this[_carry] = 0; | 2305 this[_carry] = 0; |
2306 } | 2306 } |
2307 do { | 2307 do { |
2308 start = this[_fillBuffer](str, start, end); | 2308 start = this[_fillBuffer](str, start, end); |
2309 let isLastSlice = dart.notNull(isLast) && start == end; | 2309 let isLastSlice = dart.notNull(isLast) && start == end; |
2310 if (start == dart.notNull(end) - 1 && dart.notNull(_isLeadSurrogate(str[
dartx.codeUnitAt](start)))) { | 2310 if (start == dart.notNull(end) - 1 && dart.notNull(_isLeadSurrogate(str[
dartx.codeUnitAt](start)))) { |
2311 if (dart.notNull(isLast) && dart.notNull(this[_bufferIndex]) < dart.no
tNull(this[_buffer].length) - 3) { | 2311 if (dart.notNull(isLast) && dart.notNull(this[_bufferIndex]) < dart.no
tNull(this[_buffer].length) - 3) { |
2312 let hasBeenCombined = this[_writeSurrogate](str[dartx.codeUnitAt](st
art), 0); | 2312 let hasBeenCombined = this[_writeSurrogate](str[dartx.codeUnitAt](st
art), 0); |
2313 dart.assert(!dart.notNull(hasBeenCombined)); | 2313 dart.assert(!dart.notNull(hasBeenCombined)); |
2314 } else { | 2314 } else { |
2315 this[_carry] = str[dartx.codeUnitAt](start); | 2315 this[_carry] = str[dartx.codeUnitAt](start); |
2316 } | 2316 } |
2317 start = dart.notNull(start) + 1; | 2317 start = dart.notNull(start) + 1; |
2318 } | 2318 } |
2319 this[_sink].addSlice(this[_buffer], 0, this[_bufferIndex], isLastSlice); | 2319 this[_sink].addSlice(this[_buffer], 0, this[_bufferIndex], isLastSlice); |
2320 this[_bufferIndex] = 0; | 2320 this[_bufferIndex] = 0; |
2321 } while (dart.notNull(start) < dart.notNull(end)); | 2321 } while (dart.notNull(start) < dart.notNull(end)); |
2322 if (isLast) | 2322 if (dart.notNull(isLast)) |
2323 this.close(); | 2323 this.close(); |
2324 } | 2324 } |
2325 } | 2325 } |
2326 dart.setSignature(_Utf8EncoderSink, { | 2326 dart.setSignature(_Utf8EncoderSink, { |
2327 constructors: () => ({_Utf8EncoderSink: [_Utf8EncoderSink, [ByteConversionSi
nk]]}), | 2327 constructors: () => ({_Utf8EncoderSink: [_Utf8EncoderSink, [ByteConversionSi
nk]]}), |
2328 methods: () => ({ | 2328 methods: () => ({ |
2329 close: [dart.void, []], | 2329 close: [dart.void, []], |
2330 addSlice: [dart.void, [core.String, core.int, core.int, core.bool]] | 2330 addSlice: [dart.void, [core.String, core.int, core.int, core.bool]] |
2331 }) | 2331 }) |
2332 }); | 2332 }); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2414 this[_expectedUnits] = 0; | 2414 this[_expectedUnits] = 0; |
2415 this[_extraUnits] = 0; | 2415 this[_extraUnits] = 0; |
2416 } | 2416 } |
2417 get hasPartialInput() { | 2417 get hasPartialInput() { |
2418 return dart.notNull(this[_expectedUnits]) > 0; | 2418 return dart.notNull(this[_expectedUnits]) > 0; |
2419 } | 2419 } |
2420 close() { | 2420 close() { |
2421 this.flush(); | 2421 this.flush(); |
2422 } | 2422 } |
2423 flush() { | 2423 flush() { |
2424 if (this.hasPartialInput) { | 2424 if (dart.notNull(this.hasPartialInput)) { |
2425 if (!dart.notNull(this[_allowMalformed])) { | 2425 if (!dart.notNull(this[_allowMalformed])) { |
2426 throw new core.FormatException("Unfinished UTF-8 octet sequence"); | 2426 throw new core.FormatException("Unfinished UTF-8 octet sequence"); |
2427 } | 2427 } |
2428 this[_stringSink].writeCharCode(UNICODE_REPLACEMENT_CHARACTER_RUNE); | 2428 this[_stringSink].writeCharCode(UNICODE_REPLACEMENT_CHARACTER_RUNE); |
2429 this[_value] = 0; | 2429 this[_value] = 0; |
2430 this[_expectedUnits] = 0; | 2430 this[_expectedUnits] = 0; |
2431 this[_extraUnits] = 0; | 2431 this[_extraUnits] = 0; |
2432 } | 2432 } |
2433 } | 2433 } |
2434 convert(codeUnits, startIndex, endIndex) { | 2434 convert(codeUnits, startIndex, endIndex) { |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2612 let _upgradedMap = Symbol('_upgradedMap'); | 2612 let _upgradedMap = Symbol('_upgradedMap'); |
2613 let _process = Symbol('_process'); | 2613 let _process = Symbol('_process'); |
2614 let _upgrade = Symbol('_upgrade'); | 2614 let _upgrade = Symbol('_upgrade'); |
2615 class _JsonMap extends core.Object { | 2615 class _JsonMap extends core.Object { |
2616 _JsonMap(original) { | 2616 _JsonMap(original) { |
2617 this[_processed] = _JsonMap._newJavaScriptObject(); | 2617 this[_processed] = _JsonMap._newJavaScriptObject(); |
2618 this[_original] = original; | 2618 this[_original] = original; |
2619 this[_data] = null; | 2619 this[_data] = null; |
2620 } | 2620 } |
2621 get(key) { | 2621 get(key) { |
2622 if (this[_isUpgraded]) { | 2622 if (dart.notNull(this[_isUpgraded])) { |
2623 return this[_upgradedMap].get(key); | 2623 return this[_upgradedMap].get(key); |
2624 } else if (!(typeof key == 'string')) { | 2624 } else if (!(typeof key == 'string')) { |
2625 return null; | 2625 return null; |
2626 } else { | 2626 } else { |
2627 let result = _JsonMap._getProperty(this[_processed], dart.as(key, core.S
tring)); | 2627 let result = _JsonMap._getProperty(this[_processed], dart.as(key, core.S
tring)); |
2628 if (_JsonMap._isUnprocessed(result)) | 2628 if (dart.notNull(_JsonMap._isUnprocessed(result))) |
2629 result = this[_process](dart.as(key, core.String)); | 2629 result = this[_process](dart.as(key, core.String)); |
2630 return result; | 2630 return result; |
2631 } | 2631 } |
2632 } | 2632 } |
2633 get length() { | 2633 get length() { |
2634 return this[_isUpgraded] ? this[_upgradedMap].length : this[_computeKeys](
).length; | 2634 return dart.notNull(this[_isUpgraded]) ? this[_upgradedMap].length : this[
_computeKeys]().length; |
2635 } | 2635 } |
2636 get isEmpty() { | 2636 get isEmpty() { |
2637 return this.length == 0; | 2637 return this.length == 0; |
2638 } | 2638 } |
2639 get isNotEmpty() { | 2639 get isNotEmpty() { |
2640 return dart.notNull(this.length) > 0; | 2640 return dart.notNull(this.length) > 0; |
2641 } | 2641 } |
2642 get keys() { | 2642 get keys() { |
2643 if (this[_isUpgraded]) | 2643 if (dart.notNull(this[_isUpgraded])) |
2644 return this[_upgradedMap].keys; | 2644 return this[_upgradedMap].keys; |
2645 return new _JsonMapKeyIterable(this); | 2645 return new _JsonMapKeyIterable(this); |
2646 } | 2646 } |
2647 get values() { | 2647 get values() { |
2648 if (this[_isUpgraded]) | 2648 if (dart.notNull(this[_isUpgraded])) |
2649 return this[_upgradedMap].values; | 2649 return this[_upgradedMap].values; |
2650 return _internal.MappedIterable.new(this[_computeKeys](), dart.fn(each =>
this.get(each))); | 2650 return _internal.MappedIterable.new(this[_computeKeys](), dart.fn(each =>
this.get(each))); |
2651 } | 2651 } |
2652 set(key, value) { | 2652 set(key, value) { |
2653 if (this[_isUpgraded]) { | 2653 if (dart.notNull(this[_isUpgraded])) { |
2654 this[_upgradedMap].set(key, value); | 2654 this[_upgradedMap].set(key, value); |
2655 } else if (this.containsKey(key)) { | 2655 } else if (dart.notNull(this.containsKey(key))) { |
2656 let processed = this[_processed]; | 2656 let processed = this[_processed]; |
2657 _JsonMap._setProperty(processed, dart.as(key, core.String), value); | 2657 _JsonMap._setProperty(processed, dart.as(key, core.String), value); |
2658 let original = this[_original]; | 2658 let original = this[_original]; |
2659 if (!dart.notNull(core.identical(original, processed))) { | 2659 if (!dart.notNull(core.identical(original, processed))) { |
2660 _JsonMap._setProperty(original, dart.as(key, core.String), null); | 2660 _JsonMap._setProperty(original, dart.as(key, core.String), null); |
2661 } | 2661 } |
2662 } else { | 2662 } else { |
2663 this[_upgrade]().set(key, value); | 2663 this[_upgrade]().set(key, value); |
2664 } | 2664 } |
2665 } | 2665 } |
2666 addAll(other) { | 2666 addAll(other) { |
2667 other.forEach(dart.fn((key, value) => { | 2667 other.forEach(dart.fn((key, value) => { |
2668 this.set(key, value); | 2668 this.set(key, value); |
2669 })); | 2669 })); |
2670 } | 2670 } |
2671 containsValue(value) { | 2671 containsValue(value) { |
2672 if (this[_isUpgraded]) | 2672 if (dart.notNull(this[_isUpgraded])) |
2673 return this[_upgradedMap].containsValue(value); | 2673 return this[_upgradedMap].containsValue(value); |
2674 let keys = this[_computeKeys](); | 2674 let keys = this[_computeKeys](); |
2675 for (let i = 0; dart.notNull(i) < dart.notNull(keys.length); i = dart.notN
ull(i) + 1) { | 2675 for (let i = 0; dart.notNull(i) < dart.notNull(keys.length); i = dart.notN
ull(i) + 1) { |
2676 let key = keys[dartx.get](i); | 2676 let key = keys[dartx.get](i); |
2677 if (dart.equals(this.get(key), value)) | 2677 if (dart.equals(this.get(key), value)) |
2678 return true; | 2678 return true; |
2679 } | 2679 } |
2680 return false; | 2680 return false; |
2681 } | 2681 } |
2682 containsKey(key) { | 2682 containsKey(key) { |
2683 if (this[_isUpgraded]) | 2683 if (dart.notNull(this[_isUpgraded])) |
2684 return this[_upgradedMap].containsKey(key); | 2684 return this[_upgradedMap].containsKey(key); |
2685 if (!(typeof key == 'string')) | 2685 if (!(typeof key == 'string')) |
2686 return false; | 2686 return false; |
2687 return _JsonMap._hasProperty(this[_original], dart.as(key, core.String)); | 2687 return _JsonMap._hasProperty(this[_original], dart.as(key, core.String)); |
2688 } | 2688 } |
2689 putIfAbsent(key, ifAbsent) { | 2689 putIfAbsent(key, ifAbsent) { |
2690 if (this.containsKey(key)) | 2690 if (dart.notNull(this.containsKey(key))) |
2691 return this.get(key); | 2691 return this.get(key); |
2692 let value = ifAbsent(); | 2692 let value = ifAbsent(); |
2693 this.set(key, value); | 2693 this.set(key, value); |
2694 return value; | 2694 return value; |
2695 } | 2695 } |
2696 remove(key) { | 2696 remove(key) { |
2697 if (!dart.notNull(this[_isUpgraded]) && !dart.notNull(this.containsKey(key
))) | 2697 if (!dart.notNull(this[_isUpgraded]) && !dart.notNull(this.containsKey(key
))) |
2698 return null; | 2698 return null; |
2699 return this[_upgrade]().remove(key); | 2699 return this[_upgrade]().remove(key); |
2700 } | 2700 } |
2701 clear() { | 2701 clear() { |
2702 if (this[_isUpgraded]) { | 2702 if (dart.notNull(this[_isUpgraded])) { |
2703 this[_upgradedMap].clear(); | 2703 this[_upgradedMap].clear(); |
2704 } else { | 2704 } else { |
2705 if (this[_data] != null) { | 2705 if (this[_data] != null) { |
2706 dart.dsend(this[_data], 'clear'); | 2706 dart.dsend(this[_data], 'clear'); |
2707 } | 2707 } |
2708 this[_original] = this[_processed] = null; | 2708 this[_original] = this[_processed] = null; |
2709 this[_data] = dart.map(); | 2709 this[_data] = dart.map(); |
2710 } | 2710 } |
2711 } | 2711 } |
2712 forEach(f) { | 2712 forEach(f) { |
2713 if (this[_isUpgraded]) | 2713 if (dart.notNull(this[_isUpgraded])) |
2714 return this[_upgradedMap].forEach(f); | 2714 return this[_upgradedMap].forEach(f); |
2715 let keys = this[_computeKeys](); | 2715 let keys = this[_computeKeys](); |
2716 for (let i = 0; dart.notNull(i) < dart.notNull(keys.length); i = dart.notN
ull(i) + 1) { | 2716 for (let i = 0; dart.notNull(i) < dart.notNull(keys.length); i = dart.notN
ull(i) + 1) { |
2717 let key = keys[dartx.get](i); | 2717 let key = keys[dartx.get](i); |
2718 let value = _JsonMap._getProperty(this[_processed], key); | 2718 let value = _JsonMap._getProperty(this[_processed], key); |
2719 if (_JsonMap._isUnprocessed(value)) { | 2719 if (dart.notNull(_JsonMap._isUnprocessed(value))) { |
2720 value = _convertJsonToDartLazy(_JsonMap._getProperty(this[_original],
key)); | 2720 value = _convertJsonToDartLazy(_JsonMap._getProperty(this[_original],
key)); |
2721 _JsonMap._setProperty(this[_processed], key, value); | 2721 _JsonMap._setProperty(this[_processed], key, value); |
2722 } | 2722 } |
2723 dart.dcall(f, key, value); | 2723 dart.dcall(f, key, value); |
2724 if (!dart.notNull(core.identical(keys, this[_data]))) { | 2724 if (!dart.notNull(core.identical(keys, this[_data]))) { |
2725 throw new core.ConcurrentModificationError(this); | 2725 throw new core.ConcurrentModificationError(this); |
2726 } | 2726 } |
2727 } | 2727 } |
2728 } | 2728 } |
2729 toString() { | 2729 toString() { |
2730 return collection.Maps.mapToString(this); | 2730 return collection.Maps.mapToString(this); |
2731 } | 2731 } |
2732 get [_isUpgraded]() { | 2732 get [_isUpgraded]() { |
2733 return this[_processed] == null; | 2733 return this[_processed] == null; |
2734 } | 2734 } |
2735 get [_upgradedMap]() { | 2735 get [_upgradedMap]() { |
2736 dart.assert(this[_isUpgraded]); | 2736 dart.assert(this[_isUpgraded]); |
2737 return dart.as(this[_data], core.Map); | 2737 return dart.as(this[_data], core.Map); |
2738 } | 2738 } |
2739 [_computeKeys]() { | 2739 [_computeKeys]() { |
2740 dart.assert(!dart.notNull(this[_isUpgraded])); | 2740 dart.assert(!dart.notNull(this[_isUpgraded])); |
2741 let keys = dart.as(this[_data], core.List); | 2741 let keys = dart.as(this[_data], core.List); |
2742 if (keys == null) { | 2742 if (keys == null) { |
2743 keys = this[_data] = _JsonMap._getPropertyNames(this[_original]); | 2743 keys = this[_data] = _JsonMap._getPropertyNames(this[_original]); |
2744 } | 2744 } |
2745 return dart.as(keys, core.List$(core.String)); | 2745 return dart.as(keys, core.List$(core.String)); |
2746 } | 2746 } |
2747 [_upgrade]() { | 2747 [_upgrade]() { |
2748 if (this[_isUpgraded]) | 2748 if (dart.notNull(this[_isUpgraded])) |
2749 return this[_upgradedMap]; | 2749 return this[_upgradedMap]; |
2750 let result = dart.map(); | 2750 let result = dart.map(); |
2751 let keys = this[_computeKeys](); | 2751 let keys = this[_computeKeys](); |
2752 for (let i = 0; dart.notNull(i) < dart.notNull(keys.length); i = dart.notN
ull(i) + 1) { | 2752 for (let i = 0; dart.notNull(i) < dart.notNull(keys.length); i = dart.notN
ull(i) + 1) { |
2753 let key = keys[dartx.get](i); | 2753 let key = keys[dartx.get](i); |
2754 result.set(key, this.get(key)); | 2754 result.set(key, this.get(key)); |
2755 } | 2755 } |
2756 if (keys[dartx.isEmpty]) { | 2756 if (dart.notNull(keys[dartx.isEmpty])) { |
2757 keys[dartx.add](null); | 2757 keys[dartx.add](null); |
2758 } else { | 2758 } else { |
2759 keys[dartx.clear](); | 2759 keys[dartx.clear](); |
2760 } | 2760 } |
2761 this[_original] = this[_processed] = null; | 2761 this[_original] = this[_processed] = null; |
2762 this[_data] = result; | 2762 this[_data] = result; |
2763 dart.assert(this[_isUpgraded]); | 2763 dart.assert(this[_isUpgraded]); |
2764 return result; | 2764 return result; |
2765 } | 2765 } |
2766 [_process](key) { | 2766 [_process](key) { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2818 let _parent = Symbol('_parent'); | 2818 let _parent = Symbol('_parent'); |
2819 class _JsonMapKeyIterable extends _internal.ListIterable { | 2819 class _JsonMapKeyIterable extends _internal.ListIterable { |
2820 _JsonMapKeyIterable(parent) { | 2820 _JsonMapKeyIterable(parent) { |
2821 this[_parent] = parent; | 2821 this[_parent] = parent; |
2822 super.ListIterable(); | 2822 super.ListIterable(); |
2823 } | 2823 } |
2824 get length() { | 2824 get length() { |
2825 return this[_parent].length; | 2825 return this[_parent].length; |
2826 } | 2826 } |
2827 elementAt(index) { | 2827 elementAt(index) { |
2828 return this[_parent][_isUpgraded] ? dart.as(this[_parent].keys[dartx.eleme
ntAt](index), core.String) : this[_parent][_computeKeys]()[dartx.get](index); | 2828 return dart.notNull(this[_parent][_isUpgraded]) ? dart.as(this[_parent].ke
ys[dartx.elementAt](index), core.String) : this[_parent][_computeKeys]()[dartx.g
et](index); |
2829 } | 2829 } |
2830 get iterator() { | 2830 get iterator() { |
2831 return this[_parent][_isUpgraded] ? this[_parent].keys[dartx.iterator] : t
his[_parent][_computeKeys]()[dartx.iterator]; | 2831 return dart.notNull(this[_parent][_isUpgraded]) ? this[_parent].keys[dartx
.iterator] : this[_parent][_computeKeys]()[dartx.iterator]; |
2832 } | 2832 } |
2833 contains(key) { | 2833 contains(key) { |
2834 return this[_parent].containsKey(key); | 2834 return this[_parent].containsKey(key); |
2835 } | 2835 } |
2836 } | 2836 } |
2837 dart.setSignature(_JsonMapKeyIterable, { | 2837 dart.setSignature(_JsonMapKeyIterable, { |
2838 constructors: () => ({_JsonMapKeyIterable: [_JsonMapKeyIterable, [_JsonMap]]
}), | 2838 constructors: () => ({_JsonMapKeyIterable: [_JsonMapKeyIterable, [_JsonMap]]
}), |
2839 methods: () => ({elementAt: [core.String, [core.int]]}) | 2839 methods: () => ({elementAt: [core.String, [core.int]]}) |
2840 }); | 2840 }); |
2841 class _JsonDecoderSink extends _StringSinkConversionSink { | 2841 class _JsonDecoderSink extends _StringSinkConversionSink { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2890 exports.LineSplitter = LineSplitter; | 2890 exports.LineSplitter = LineSplitter; |
2891 exports.StringConversionSink = StringConversionSink; | 2891 exports.StringConversionSink = StringConversionSink; |
2892 exports.ClosableStringSink = ClosableStringSink; | 2892 exports.ClosableStringSink = ClosableStringSink; |
2893 exports.UNICODE_REPLACEMENT_CHARACTER_RUNE = UNICODE_REPLACEMENT_CHARACTER_RUN
E; | 2893 exports.UNICODE_REPLACEMENT_CHARACTER_RUNE = UNICODE_REPLACEMENT_CHARACTER_RUN
E; |
2894 exports.UNICODE_BOM_CHARACTER_RUNE = UNICODE_BOM_CHARACTER_RUNE; | 2894 exports.UNICODE_BOM_CHARACTER_RUNE = UNICODE_BOM_CHARACTER_RUNE; |
2895 exports.Utf8Codec = Utf8Codec; | 2895 exports.Utf8Codec = Utf8Codec; |
2896 exports.UTF8 = UTF8; | 2896 exports.UTF8 = UTF8; |
2897 exports.Utf8Encoder = Utf8Encoder; | 2897 exports.Utf8Encoder = Utf8Encoder; |
2898 exports.Utf8Decoder = Utf8Decoder; | 2898 exports.Utf8Decoder = Utf8Decoder; |
2899 })(convert, core, async, typed_data, _internal, collection); | 2899 })(convert, core, async, typed_data, _internal, collection); |
OLD | NEW |