OLD | NEW |
1 dart_library.library('dart/convert', null, /* Imports */[ | 1 dart_library.library('dart/convert', null, /* Imports */[ |
2 'dart/_runtime', | 2 'dart/_runtime', |
3 'dart/core', | 3 'dart/core', |
4 'dart/async', | 4 'dart/async', |
5 'dart/typed_data', | 5 'dart/typed_data', |
6 'dart/_internal', | 6 'dart/_internal', |
7 'dart/collection' | 7 'dart/collection' |
8 ], /* Lazy imports */[ | 8 ], /* Lazy imports */[ |
9 ], function(exports, dart, core, async, typed_data, _internal, collection) { | 9 ], function(exports, dart, core, async, typed_data, _internal, collection) { |
10 'use strict'; | 10 'use strict'; |
(...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
812 decode(source, opts) { | 812 decode(source, opts) { |
813 let reviver = opts && 'reviver' in opts ? opts.reviver : null; | 813 let reviver = opts && 'reviver' in opts ? opts.reviver : null; |
814 if (reviver == null) reviver = this[_reviver]; | 814 if (reviver == null) reviver = this[_reviver]; |
815 if (reviver == null) return this.decoder.convert(source); | 815 if (reviver == null) return this.decoder.convert(source); |
816 return new JsonDecoder(reviver).convert(source); | 816 return new JsonDecoder(reviver).convert(source); |
817 } | 817 } |
818 encode(value, opts) { | 818 encode(value, opts) { |
819 let toEncodable = opts && 'toEncodable' in opts ? opts.toEncodable : null; | 819 let toEncodable = opts && 'toEncodable' in opts ? opts.toEncodable : null; |
820 if (toEncodable == null) toEncodable = this[_toEncodable$]; | 820 if (toEncodable == null) toEncodable = this[_toEncodable$]; |
821 if (toEncodable == null) return this.encoder.convert(value); | 821 if (toEncodable == null) return this.encoder.convert(value); |
822 return new JsonEncoder(dart.as(toEncodable, __CastType0)).convert(value); | 822 return new JsonEncoder(dart.as(toEncodable, dart.functionType(core.Object,
[core.Object]))).convert(value); |
823 } | 823 } |
824 get encoder() { | 824 get encoder() { |
825 if (this[_toEncodable$] == null) return dart.const(new JsonEncoder()); | 825 if (this[_toEncodable$] == null) return dart.const(new JsonEncoder()); |
826 return new JsonEncoder(dart.as(this[_toEncodable$], dart.functionType(core
.Object, [core.Object]))); | 826 return new JsonEncoder(dart.as(this[_toEncodable$], dart.functionType(core
.Object, [core.Object]))); |
827 } | 827 } |
828 get decoder() { | 828 get decoder() { |
829 if (this[_reviver] == null) return dart.const(new JsonDecoder()); | 829 if (this[_reviver] == null) return dart.const(new JsonDecoder()); |
830 return new JsonDecoder(this[_reviver]); | 830 return new JsonDecoder(this[_reviver]); |
831 } | 831 } |
832 } | 832 } |
(...skipping 18 matching lines...) Expand all Loading... |
851 this[_toEncodable$] = toEncodable; | 851 this[_toEncodable$] = toEncodable; |
852 super.Converter(); | 852 super.Converter(); |
853 } | 853 } |
854 withIndent(indent, toEncodable) { | 854 withIndent(indent, toEncodable) { |
855 if (toEncodable === void 0) toEncodable = null; | 855 if (toEncodable === void 0) toEncodable = null; |
856 this.indent = indent; | 856 this.indent = indent; |
857 this[_toEncodable$] = toEncodable; | 857 this[_toEncodable$] = toEncodable; |
858 super.Converter(); | 858 super.Converter(); |
859 } | 859 } |
860 convert(object) { | 860 convert(object) { |
861 return _JsonStringStringifier.stringify(object, dart.as(this[_toEncodable$
], __CastType2), this.indent); | 861 return _JsonStringStringifier.stringify(object, dart.as(this[_toEncodable$
], dart.functionType(dart.dynamic, [dart.dynamic])), this.indent); |
862 } | 862 } |
863 startChunkedConversion(sink) { | 863 startChunkedConversion(sink) { |
864 if (!dart.is(sink, StringConversionSink)) { | 864 if (!dart.is(sink, StringConversionSink)) { |
865 sink = StringConversionSink.from(sink); | 865 sink = StringConversionSink.from(sink); |
866 } else if (dart.is(sink, _Utf8EncoderSink)) { | 866 } else if (dart.is(sink, _Utf8EncoderSink)) { |
867 return new _JsonUtf8EncoderSink(sink[_sink], this[_toEncodable$], JsonUt
f8Encoder._utf8Encode(this.indent), JsonUtf8Encoder.DEFAULT_BUFFER_SIZE); | 867 return new _JsonUtf8EncoderSink(sink[_sink], this[_toEncodable$], JsonUt
f8Encoder._utf8Encode(this.indent), JsonUtf8Encoder.DEFAULT_BUFFER_SIZE); |
868 } | 868 } |
869 return new _JsonEncoderSink(dart.as(sink, StringConversionSink), this[_toE
ncodable$], this.indent); | 869 return new _JsonEncoderSink(dart.as(sink, StringConversionSink), this[_toE
ncodable$], this.indent); |
870 } | 870 } |
871 bind(stream) { | 871 bind(stream) { |
872 return super.bind(stream); | 872 return super.bind(stream); |
873 } | 873 } |
874 fuse(other) { | 874 fuse(other) { |
875 if (dart.is(other, Utf8Encoder)) { | 875 if (dart.is(other, Utf8Encoder)) { |
876 return new JsonUtf8Encoder(this.indent, dart.as(this[_toEncodable$], __C
astType4)); | 876 return new JsonUtf8Encoder(this.indent, dart.as(this[_toEncodable$], dar
t.functionType(dart.dynamic, [core.Object]))); |
877 } | 877 } |
878 return super.fuse(other); | 878 return super.fuse(other); |
879 } | 879 } |
880 } | 880 } |
881 dart.defineNamedConstructor(JsonEncoder, 'withIndent'); | 881 dart.defineNamedConstructor(JsonEncoder, 'withIndent'); |
882 dart.setSignature(JsonEncoder, { | 882 dart.setSignature(JsonEncoder, { |
883 constructors: () => ({ | 883 constructors: () => ({ |
884 JsonEncoder: [JsonEncoder, [], [dart.functionType(core.Object, [core.Objec
t])]], | 884 JsonEncoder: [JsonEncoder, [], [dart.functionType(core.Object, [core.Objec
t])]], |
885 withIndent: [JsonEncoder, [core.String], [dart.functionType(core.Object, [
core.Object])]] | 885 withIndent: [JsonEncoder, [core.String], [dart.functionType(core.Object, [
core.Object])]] |
886 }), | 886 }), |
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1514 this.writeByte(indent[dartx.get](i)); | 1514 this.writeByte(indent[dartx.get](i)); |
1515 } | 1515 } |
1516 } | 1516 } |
1517 } | 1517 } |
1518 } | 1518 } |
1519 } | 1519 } |
1520 dart.setSignature(_JsonUtf8StringifierPretty, { | 1520 dart.setSignature(_JsonUtf8StringifierPretty, { |
1521 constructors: () => ({_JsonUtf8StringifierPretty: [_JsonUtf8StringifierPrett
y, [dart.dynamic, core.List$(core.int), dart.dynamic, dart.dynamic]]}), | 1521 constructors: () => ({_JsonUtf8StringifierPretty: [_JsonUtf8StringifierPrett
y, [dart.dynamic, core.List$(core.int), dart.dynamic, dart.dynamic]]}), |
1522 methods: () => ({writeIndentation: [dart.void, [core.int]]}) | 1522 methods: () => ({writeIndentation: [dart.void, [core.int]]}) |
1523 }); | 1523 }); |
1524 const __CastType0 = dart.typedef('__CastType0', () => dart.functionType(core.O
bject, [core.Object])); | |
1525 const __CastType2 = dart.typedef('__CastType2', () => dart.functionType(dart.d
ynamic, [dart.dynamic])); | |
1526 const __CastType4 = dart.typedef('__CastType4', () => dart.functionType(dart.d
ynamic, [core.Object])); | |
1527 class Latin1Codec extends Encoding { | 1524 class Latin1Codec extends Encoding { |
1528 Latin1Codec(opts) { | 1525 Latin1Codec(opts) { |
1529 let allowInvalid = opts && 'allowInvalid' in opts ? opts.allowInvalid : fa
lse; | 1526 let allowInvalid = opts && 'allowInvalid' in opts ? opts.allowInvalid : fa
lse; |
1530 this[_allowInvalid] = allowInvalid; | 1527 this[_allowInvalid] = allowInvalid; |
1531 super.Encoding(); | 1528 super.Encoding(); |
1532 } | 1529 } |
1533 get name() { | 1530 get name() { |
1534 return "iso-8859-1"; | 1531 return "iso-8859-1"; |
1535 } | 1532 } |
1536 decode(bytes, opts) { | 1533 decode(bytes, opts) { |
(...skipping 1291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2828 exports.LineSplitter = LineSplitter; | 2825 exports.LineSplitter = LineSplitter; |
2829 exports.StringConversionSink = StringConversionSink; | 2826 exports.StringConversionSink = StringConversionSink; |
2830 exports.ClosableStringSink = ClosableStringSink; | 2827 exports.ClosableStringSink = ClosableStringSink; |
2831 exports.UNICODE_REPLACEMENT_CHARACTER_RUNE = UNICODE_REPLACEMENT_CHARACTER_RUN
E; | 2828 exports.UNICODE_REPLACEMENT_CHARACTER_RUNE = UNICODE_REPLACEMENT_CHARACTER_RUN
E; |
2832 exports.UNICODE_BOM_CHARACTER_RUNE = UNICODE_BOM_CHARACTER_RUNE; | 2829 exports.UNICODE_BOM_CHARACTER_RUNE = UNICODE_BOM_CHARACTER_RUNE; |
2833 exports.Utf8Codec = Utf8Codec; | 2830 exports.Utf8Codec = Utf8Codec; |
2834 exports.UTF8 = UTF8; | 2831 exports.UTF8 = UTF8; |
2835 exports.Utf8Encoder = Utf8Encoder; | 2832 exports.Utf8Encoder = Utf8Encoder; |
2836 exports.Utf8Decoder = Utf8Decoder; | 2833 exports.Utf8Decoder = Utf8Decoder; |
2837 }); | 2834 }); |
OLD | NEW |