Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(899)

Side by Side Diff: lib/runtime/dart/convert.js

Issue 1138793002: Tag closures with their types (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: More comment fixes Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/runtime/dart/collection.js ('k') | lib/runtime/dart/core.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 {
11 Codec() { 11 Codec() {
12 } 12 }
13 encode(input) { 13 encode(input) {
14 dart.as(input, S); 14 dart.as(input, S);
15 return this.encoder.convert(input); 15 return this.encoder.convert(input);
16 } 16 }
17 decode(encoded) { 17 decode(encoded) {
18 dart.as(encoded, T); 18 dart.as(encoded, T);
19 return this.decoder.convert(encoded); 19 return this.decoder.convert(encoded);
20 } 20 }
21 fuse(other) { 21 fuse(other) {
22 dart.as(other, Codec$(T, dart.dynamic)); 22 dart.as(other, Codec$(T, dart.dynamic));
23 return new (_FusedCodec$(S, T, dart.dynamic))(this, other); 23 return new (_FusedCodec$(S, T, dart.dynamic))(this, other);
24 } 24 }
25 get inverted() { 25 get inverted() {
26 return new (_InvertedCodec$(T, S))(this); 26 return new (_InvertedCodec$(T, S))(this);
27 } 27 }
28 } 28 }
29 dart.setSignature(Codec, {
30 methods: () => ({
31 encode: dart.functionType(T, [S]),
32 decode: dart.functionType(S, [T]),
33 fuse: dart.functionType(Codec$(S, dart.dynamic), [Codec$(T, dart.dynamic )])
34 })
35 });
29 return Codec; 36 return Codec;
30 }); 37 });
31 let Codec = Codec$(); 38 let Codec = Codec$();
32 class Encoding extends Codec$(core.String, core.List$(core.int)) { 39 class Encoding extends Codec$(core.String, core.List$(core.int)) {
33 Encoding() { 40 Encoding() {
34 super.Codec(); 41 super.Codec();
35 } 42 }
36 decodeStream(byteStream) { 43 decodeStream(byteStream) {
37 return dart.as(byteStream.transform(this.decoder).fold(new core.StringBuff er(), (buffer, string) => ((() => { 44 return dart.as(byteStream.transform(this.decoder).fold(new core.StringBuff er(), dart.fn((buffer, string) => ((() => {
38 dart.dsend(buffer, 'write', string); 45 dart.dsend(buffer, 'write', string);
39 return buffer; 46 return buffer;
40 })())).then(buffer => dart.toString(buffer)), async.Future$(core.String)); 47 })()))).then(dart.fn(buffer => dart.toString(buffer), core.String, [dart.d ynamic])), async.Future$(core.String));
41 } 48 }
42 static getByName(name) { 49 static getByName(name) {
43 if (name == null) 50 if (name == null)
44 return null; 51 return null;
45 name = name.toLowerCase(); 52 name = name.toLowerCase();
46 return Encoding._nameToEncoding.get(name); 53 return Encoding._nameToEncoding.get(name);
47 } 54 }
48 } 55 }
56 dart.setSignature(Encoding, {
57 methods: () => ({decodeStream: dart.functionType(async.Future$(core.String), [async.Stream$(core.List$(core.int))])}),
58 statics: () => ({getByName: dart.functionType(Encoding, [core.String])}),
59 names: ['getByName']
60 });
49 let _allowInvalid = Symbol('_allowInvalid'); 61 let _allowInvalid = Symbol('_allowInvalid');
50 class AsciiCodec extends Encoding { 62 class AsciiCodec extends Encoding {
51 AsciiCodec(opts) { 63 AsciiCodec(opts) {
52 let allowInvalid = opts && 'allowInvalid' in opts ? opts.allowInvalid : fa lse; 64 let allowInvalid = opts && 'allowInvalid' in opts ? opts.allowInvalid : fa lse;
53 this[_allowInvalid] = allowInvalid; 65 this[_allowInvalid] = allowInvalid;
54 super.Encoding(); 66 super.Encoding();
55 } 67 }
56 get name() { 68 get name() {
57 return "us-ascii"; 69 return "us-ascii";
58 } 70 }
59 decode(bytes, opts) { 71 decode(bytes, opts) {
60 let allowInvalid = opts && 'allowInvalid' in opts ? opts.allowInvalid : nu ll; 72 let allowInvalid = opts && 'allowInvalid' in opts ? opts.allowInvalid : nu ll;
61 if (allowInvalid == null) 73 if (allowInvalid == null)
62 allowInvalid = this[_allowInvalid]; 74 allowInvalid = this[_allowInvalid];
63 if (allowInvalid) { 75 if (allowInvalid) {
64 return dart.const(new AsciiDecoder({allowInvalid: true})).convert(bytes) ; 76 return dart.const(new AsciiDecoder({allowInvalid: true})).convert(bytes) ;
65 } else { 77 } else {
66 return dart.const(new AsciiDecoder({allowInvalid: false})).convert(bytes ); 78 return dart.const(new AsciiDecoder({allowInvalid: false})).convert(bytes );
67 } 79 }
68 } 80 }
69 get encoder() { 81 get encoder() {
70 return dart.const(new AsciiEncoder()); 82 return dart.const(new AsciiEncoder());
71 } 83 }
72 get decoder() { 84 get decoder() {
73 return this[_allowInvalid] ? dart.const(new AsciiDecoder({allowInvalid: tr ue})) : dart.const(new AsciiDecoder({allowInvalid: false})); 85 return this[_allowInvalid] ? dart.const(new AsciiDecoder({allowInvalid: tr ue})) : dart.const(new AsciiDecoder({allowInvalid: false}));
74 } 86 }
75 } 87 }
88 dart.setSignature(AsciiCodec, {
89 methods: () => ({decode: dart.functionType(core.String, [core.List$(core.int )], {llowInvali: core.bool})})
90 });
76 let ASCII = dart.const(new AsciiCodec()); 91 let ASCII = dart.const(new AsciiCodec());
77 let _ASCII_MASK = 127; 92 let _ASCII_MASK = 127;
78 let Converter$ = dart.generic(function(S, T) { 93 let Converter$ = dart.generic(function(S, T) {
79 class Converter extends core.Object { 94 class Converter extends core.Object {
80 Converter() { 95 Converter() {
81 } 96 }
82 fuse(other) { 97 fuse(other) {
83 dart.as(other, Converter$(T, dart.dynamic)); 98 dart.as(other, Converter$(T, dart.dynamic));
84 return new (_FusedConverter$(S, T, dart.dynamic))(this, other); 99 return new (_FusedConverter$(S, T, dart.dynamic))(this, other);
85 } 100 }
86 startChunkedConversion(sink) { 101 startChunkedConversion(sink) {
87 dart.as(sink, core.Sink$(T)); 102 dart.as(sink, core.Sink$(T));
88 throw new core.UnsupportedError(`This converter does not support chunked conversions: ${this}`); 103 throw new core.UnsupportedError(`This converter does not support chunked conversions: ${this}`);
89 } 104 }
90 bind(source) { 105 bind(source) {
91 dart.as(source, async.Stream$(S)); 106 dart.as(source, async.Stream$(S));
92 return new (async.Stream$(T)).eventTransformed(source, (sink => new _Con verterStreamEventSink(this, sink)).bind(this)); 107 return new (async.Stream$(T)).eventTransformed(source, dart.fn((sink => new _ConverterStreamEventSink(this, sink)).bind(this), _ConverterStreamEventSink , [async.EventSink]));
93 } 108 }
94 } 109 }
95 Converter[dart.implements] = () => [async.StreamTransformer$(S, T)]; 110 Converter[dart.implements] = () => [async.StreamTransformer$(S, T)];
111 dart.setSignature(Converter, {
112 methods: () => ({
113 fuse: dart.functionType(Converter$(S, dart.dynamic), [Converter$(T, dart .dynamic)]),
114 startChunkedConversion: dart.functionType(ChunkedConversionSink, [core.S ink$(T)]),
115 bind: dart.functionType(async.Stream$(T), [async.Stream$(S)])
116 })
117 });
96 return Converter; 118 return Converter;
97 }); 119 });
98 let Converter = Converter$(); 120 let Converter = Converter$();
99 let _subsetMask = Symbol('_subsetMask'); 121 let _subsetMask = Symbol('_subsetMask');
100 class _UnicodeSubsetEncoder extends Converter$(core.String, core.List$(core.in t)) { 122 class _UnicodeSubsetEncoder extends Converter$(core.String, core.List$(core.in t)) {
101 _UnicodeSubsetEncoder(subsetMask) { 123 _UnicodeSubsetEncoder(subsetMask) {
102 this[_subsetMask] = subsetMask; 124 this[_subsetMask] = subsetMask;
103 super.Converter(); 125 super.Converter();
104 } 126 }
105 convert(string, start, end) { 127 convert(string, start, end) {
(...skipping 19 matching lines...) Expand all
125 startChunkedConversion(sink) { 147 startChunkedConversion(sink) {
126 if (!dart.is(sink, ByteConversionSink)) { 148 if (!dart.is(sink, ByteConversionSink)) {
127 sink = new ByteConversionSink.from(sink); 149 sink = new ByteConversionSink.from(sink);
128 } 150 }
129 return new _UnicodeSubsetEncoderSink(this[_subsetMask], dart.as(sink, Byte ConversionSink)); 151 return new _UnicodeSubsetEncoderSink(this[_subsetMask], dart.as(sink, Byte ConversionSink));
130 } 152 }
131 bind(stream) { 153 bind(stream) {
132 return super.bind(stream); 154 return super.bind(stream);
133 } 155 }
134 } 156 }
157 dart.setSignature(_UnicodeSubsetEncoder, {
158 methods: () => ({
159 convert: dart.functionType(core.List$(core.int), [core.String], [core.int, core.int]),
160 startChunkedConversion: dart.functionType(StringConversionSink, [core.Sink $(core.List$(core.int))]),
161 bind: dart.functionType(async.Stream$(core.List$(core.int)), [async.Stream $(core.String)])
162 })
163 });
135 class AsciiEncoder extends _UnicodeSubsetEncoder { 164 class AsciiEncoder extends _UnicodeSubsetEncoder {
136 AsciiEncoder() { 165 AsciiEncoder() {
137 super._UnicodeSubsetEncoder(_ASCII_MASK); 166 super._UnicodeSubsetEncoder(_ASCII_MASK);
138 } 167 }
139 } 168 }
169 dart.setSignature(AsciiEncoder, {});
140 class StringConversionSinkMixin extends core.Object { 170 class StringConversionSinkMixin extends core.Object {
141 add(str) { 171 add(str) {
142 return this.addSlice(str, 0, str.length, false); 172 return this.addSlice(str, 0, str.length, false);
143 } 173 }
144 asUtf8Sink(allowMalformed) { 174 asUtf8Sink(allowMalformed) {
145 return new _Utf8ConversionSink(this, allowMalformed); 175 return new _Utf8ConversionSink(this, allowMalformed);
146 } 176 }
147 asStringSink() { 177 asStringSink() {
148 return new _StringConversionSinkAsStringSinkAdapter(this); 178 return new _StringConversionSinkAsStringSinkAdapter(this);
149 } 179 }
150 } 180 }
151 StringConversionSinkMixin[dart.implements] = () => [StringConversionSink]; 181 StringConversionSinkMixin[dart.implements] = () => [StringConversionSink];
182 dart.setSignature(StringConversionSinkMixin, {
183 methods: () => ({
184 add: dart.functionType(dart.void, [core.String]),
185 asUtf8Sink: dart.functionType(ByteConversionSink, [core.bool]),
186 asStringSink: dart.functionType(ClosableStringSink, [])
187 })
188 });
152 class StringConversionSinkBase extends StringConversionSinkMixin {} 189 class StringConversionSinkBase extends StringConversionSinkMixin {}
190 dart.setSignature(StringConversionSinkBase, {});
153 let _sink = Symbol('_sink'); 191 let _sink = Symbol('_sink');
154 class _UnicodeSubsetEncoderSink extends StringConversionSinkBase { 192 class _UnicodeSubsetEncoderSink extends StringConversionSinkBase {
155 _UnicodeSubsetEncoderSink(subsetMask, sink) { 193 _UnicodeSubsetEncoderSink(subsetMask, sink) {
156 this[_subsetMask] = subsetMask; 194 this[_subsetMask] = subsetMask;
157 this[_sink] = sink; 195 this[_sink] = sink;
158 } 196 }
159 close() { 197 close() {
160 this[_sink].close(); 198 this[_sink].close();
161 } 199 }
162 addSlice(source, start, end, isLast) { 200 addSlice(source, start, end, isLast) {
163 core.RangeError.checkValidRange(start, end, source.length); 201 core.RangeError.checkValidRange(start, end, source.length);
164 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull( i) + 1) { 202 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull( i) + 1) {
165 let codeUnit = source.codeUnitAt(i); 203 let codeUnit = source.codeUnitAt(i);
166 if ((dart.notNull(codeUnit) & ~dart.notNull(this[_subsetMask])) != 0) { 204 if ((dart.notNull(codeUnit) & ~dart.notNull(this[_subsetMask])) != 0) {
167 throw new core.ArgumentError(`Source contains invalid character with c ode point: ${codeUnit}.`); 205 throw new core.ArgumentError(`Source contains invalid character with c ode point: ${codeUnit}.`);
168 } 206 }
169 } 207 }
170 this[_sink].add(source.codeUnits[core.$sublist](start, end)); 208 this[_sink].add(source.codeUnits[core.$sublist](start, end));
171 if (isLast) { 209 if (isLast) {
172 this.close(); 210 this.close();
173 } 211 }
174 } 212 }
175 } 213 }
214 dart.setSignature(_UnicodeSubsetEncoderSink, {
215 methods: () => ({
216 close: dart.functionType(dart.void, []),
217 addSlice: dart.functionType(dart.void, [core.String, core.int, core.int, c ore.bool])
218 })
219 });
176 let _convertInvalid = Symbol('_convertInvalid'); 220 let _convertInvalid = Symbol('_convertInvalid');
177 class _UnicodeSubsetDecoder extends Converter$(core.List$(core.int), core.Stri ng) { 221 class _UnicodeSubsetDecoder extends Converter$(core.List$(core.int), core.Stri ng) {
178 _UnicodeSubsetDecoder(allowInvalid, subsetMask) { 222 _UnicodeSubsetDecoder(allowInvalid, subsetMask) {
179 this[_allowInvalid] = allowInvalid; 223 this[_allowInvalid] = allowInvalid;
180 this[_subsetMask] = subsetMask; 224 this[_subsetMask] = subsetMask;
181 super.Converter(); 225 super.Converter();
182 } 226 }
183 convert(bytes, start, end) { 227 convert(bytes, start, end) {
184 if (start === void 0) 228 if (start === void 0)
185 start = 0; 229 start = 0;
(...skipping 22 matching lines...) Expand all
208 if ((dart.notNull(value) & ~dart.notNull(this[_subsetMask])) != 0) 252 if ((dart.notNull(value) & ~dart.notNull(this[_subsetMask])) != 0)
209 value = 65533; 253 value = 65533;
210 buffer.writeCharCode(value); 254 buffer.writeCharCode(value);
211 } 255 }
212 return dart.toString(buffer); 256 return dart.toString(buffer);
213 } 257 }
214 bind(stream) { 258 bind(stream) {
215 return super.bind(stream); 259 return super.bind(stream);
216 } 260 }
217 } 261 }
262 dart.setSignature(_UnicodeSubsetDecoder, {
263 methods: () => ({
264 convert: dart.functionType(core.String, [core.List$(core.int)], [core.int, core.int]),
265 [_convertInvalid]: dart.functionType(core.String, [core.List$(core.int), c ore.int, core.int]),
266 bind: dart.functionType(async.Stream$(core.String), [async.Stream$(core.Li st$(core.int))])
267 })
268 });
218 class AsciiDecoder extends _UnicodeSubsetDecoder { 269 class AsciiDecoder extends _UnicodeSubsetDecoder {
219 AsciiDecoder(opts) { 270 AsciiDecoder(opts) {
220 let allowInvalid = opts && 'allowInvalid' in opts ? opts.allowInvalid : fa lse; 271 let allowInvalid = opts && 'allowInvalid' in opts ? opts.allowInvalid : fa lse;
221 super._UnicodeSubsetDecoder(allowInvalid, _ASCII_MASK); 272 super._UnicodeSubsetDecoder(allowInvalid, _ASCII_MASK);
222 } 273 }
223 startChunkedConversion(sink) { 274 startChunkedConversion(sink) {
224 let stringSink = null; 275 let stringSink = null;
225 if (dart.is(sink, StringConversionSink)) { 276 if (dart.is(sink, StringConversionSink)) {
226 stringSink = sink; 277 stringSink = sink;
227 } else { 278 } else {
228 stringSink = new StringConversionSink.from(sink); 279 stringSink = new StringConversionSink.from(sink);
229 } 280 }
230 if (this[_allowInvalid]) { 281 if (this[_allowInvalid]) {
231 return new _ErrorHandlingAsciiDecoderSink(stringSink.asUtf8Sink(false)); 282 return new _ErrorHandlingAsciiDecoderSink(stringSink.asUtf8Sink(false));
232 } else { 283 } else {
233 return new _SimpleAsciiDecoderSink(stringSink); 284 return new _SimpleAsciiDecoderSink(stringSink);
234 } 285 }
235 } 286 }
236 } 287 }
288 dart.setSignature(AsciiDecoder, {
289 methods: () => ({startChunkedConversion: dart.functionType(ByteConversionSin k, [core.Sink$(core.String)])})
290 });
237 let ChunkedConversionSink$ = dart.generic(function(T) { 291 let ChunkedConversionSink$ = dart.generic(function(T) {
238 class ChunkedConversionSink extends core.Object { 292 class ChunkedConversionSink extends core.Object {
239 ChunkedConversionSink() { 293 ChunkedConversionSink() {
240 } 294 }
241 withCallback(callback) { 295 withCallback(callback) {
242 return new _SimpleCallbackSink(callback); 296 return new _SimpleCallbackSink(callback);
243 } 297 }
244 } 298 }
245 ChunkedConversionSink[dart.implements] = () => [core.Sink$(T)]; 299 ChunkedConversionSink[dart.implements] = () => [core.Sink$(T)];
246 dart.defineNamedConstructor(ChunkedConversionSink, 'withCallback'); 300 dart.defineNamedConstructor(ChunkedConversionSink, 'withCallback');
301 dart.setSignature(ChunkedConversionSink, {});
247 return ChunkedConversionSink; 302 return ChunkedConversionSink;
248 }); 303 });
249 let ChunkedConversionSink = ChunkedConversionSink$(); 304 let ChunkedConversionSink = ChunkedConversionSink$();
250 class ByteConversionSink extends ChunkedConversionSink$(core.List$(core.int)) { 305 class ByteConversionSink extends ChunkedConversionSink$(core.List$(core.int)) {
251 ByteConversionSink() { 306 ByteConversionSink() {
252 super.ChunkedConversionSink(); 307 super.ChunkedConversionSink();
253 } 308 }
254 withCallback(callback) { 309 withCallback(callback) {
255 return new _ByteCallbackSink(callback); 310 return new _ByteCallbackSink(callback);
256 } 311 }
257 from(sink) { 312 from(sink) {
258 return new _ByteAdapterSink(sink); 313 return new _ByteAdapterSink(sink);
259 } 314 }
260 } 315 }
261 dart.defineNamedConstructor(ByteConversionSink, 'withCallback'); 316 dart.defineNamedConstructor(ByteConversionSink, 'withCallback');
262 dart.defineNamedConstructor(ByteConversionSink, 'from'); 317 dart.defineNamedConstructor(ByteConversionSink, 'from');
318 dart.setSignature(ByteConversionSink, {});
263 class ByteConversionSinkBase extends ByteConversionSink { 319 class ByteConversionSinkBase extends ByteConversionSink {
264 ByteConversionSinkBase() { 320 ByteConversionSinkBase() {
265 super.ByteConversionSink(); 321 super.ByteConversionSink();
266 } 322 }
267 addSlice(chunk, start, end, isLast) { 323 addSlice(chunk, start, end, isLast) {
268 this.add(chunk[core.$sublist](start, end)); 324 this.add(chunk[core.$sublist](start, end));
269 if (isLast) 325 if (isLast)
270 this.close(); 326 this.close();
271 } 327 }
272 } 328 }
329 dart.setSignature(ByteConversionSinkBase, {
330 methods: () => ({addSlice: dart.functionType(dart.void, [core.List$(core.int ), core.int, core.int, core.bool])})
331 });
273 let _utf8Sink = Symbol('_utf8Sink'); 332 let _utf8Sink = Symbol('_utf8Sink');
274 class _ErrorHandlingAsciiDecoderSink extends ByteConversionSinkBase { 333 class _ErrorHandlingAsciiDecoderSink extends ByteConversionSinkBase {
275 _ErrorHandlingAsciiDecoderSink(utf8Sink) { 334 _ErrorHandlingAsciiDecoderSink(utf8Sink) {
276 this[_utf8Sink] = utf8Sink; 335 this[_utf8Sink] = utf8Sink;
277 } 336 }
278 close() { 337 close() {
279 this[_utf8Sink].close(); 338 this[_utf8Sink].close();
280 } 339 }
281 add(source) { 340 add(source) {
282 this.addSlice(source, 0, source[core.$length], false); 341 this.addSlice(source, 0, source[core.$length], false);
283 } 342 }
284 addSlice(source, start, end, isLast) { 343 addSlice(source, start, end, isLast) {
285 core.RangeError.checkValidRange(start, end, source[core.$length]); 344 core.RangeError.checkValidRange(start, end, source[core.$length]);
286 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull( i) + 1) { 345 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull( i) + 1) {
287 if ((dart.notNull(source[core.$get](i)) & ~dart.notNull(_ASCII_MASK)) != 0) { 346 if ((dart.notNull(source[core.$get](i)) & ~dart.notNull(_ASCII_MASK)) != 0) {
288 if (dart.notNull(i) > dart.notNull(start)) 347 if (dart.notNull(i) > dart.notNull(start))
289 this[_utf8Sink].addSlice(source, start, i, false); 348 this[_utf8Sink].addSlice(source, start, i, false);
290 this[_utf8Sink].add(dart.const(dart.setType([239, 191, 189], core.List $(core.int)))); 349 this[_utf8Sink].add(dart.const(dart.setType([239, 191, 189], core.List $(core.int))));
291 start = dart.notNull(i) + 1; 350 start = dart.notNull(i) + 1;
292 } 351 }
293 } 352 }
294 if (dart.notNull(start) < dart.notNull(end)) { 353 if (dart.notNull(start) < dart.notNull(end)) {
295 this[_utf8Sink].addSlice(source, start, end, isLast); 354 this[_utf8Sink].addSlice(source, start, end, isLast);
296 } else if (isLast) { 355 } else if (isLast) {
297 this.close(); 356 this.close();
298 } 357 }
299 } 358 }
300 } 359 }
360 dart.setSignature(_ErrorHandlingAsciiDecoderSink, {
361 methods: () => ({
362 close: dart.functionType(dart.void, []),
363 add: dart.functionType(dart.void, [core.List$(core.int)]),
364 addSlice: dart.functionType(dart.void, [core.List$(core.int), core.int, co re.int, core.bool])
365 })
366 });
301 class _SimpleAsciiDecoderSink extends ByteConversionSinkBase { 367 class _SimpleAsciiDecoderSink extends ByteConversionSinkBase {
302 _SimpleAsciiDecoderSink(sink) { 368 _SimpleAsciiDecoderSink(sink) {
303 this[_sink] = sink; 369 this[_sink] = sink;
304 } 370 }
305 close() { 371 close() {
306 this[_sink].close(); 372 this[_sink].close();
307 } 373 }
308 add(source) { 374 add(source) {
309 for (let i = 0; dart.notNull(i) < dart.notNull(source[core.$length]); i = dart.notNull(i) + 1) { 375 for (let i = 0; dart.notNull(i) < dart.notNull(source[core.$length]); i = dart.notNull(i) + 1) {
310 if ((dart.notNull(source[core.$get](i)) & ~dart.notNull(_ASCII_MASK)) != 0) { 376 if ((dart.notNull(source[core.$get](i)) & ~dart.notNull(_ASCII_MASK)) != 0) {
311 throw new core.FormatException("Source contains non-ASCII bytes."); 377 throw new core.FormatException("Source contains non-ASCII bytes.");
312 } 378 }
313 } 379 }
314 this[_sink].add(new core.String.fromCharCodes(source)); 380 this[_sink].add(new core.String.fromCharCodes(source));
315 } 381 }
316 addSlice(source, start, end, isLast) { 382 addSlice(source, start, end, isLast) {
317 let length = source[core.$length]; 383 let length = source[core.$length];
318 core.RangeError.checkValidRange(start, end, length); 384 core.RangeError.checkValidRange(start, end, length);
319 if (dart.notNull(start) < dart.notNull(end)) { 385 if (dart.notNull(start) < dart.notNull(end)) {
320 if (start != 0 || end != length) { 386 if (start != 0 || end != length) {
321 source = source[core.$sublist](start, end); 387 source = source[core.$sublist](start, end);
322 } 388 }
323 this.add(source); 389 this.add(source);
324 } 390 }
325 if (isLast) 391 if (isLast)
326 this.close(); 392 this.close();
327 } 393 }
328 } 394 }
395 dart.setSignature(_SimpleAsciiDecoderSink, {
396 methods: () => ({
397 close: dart.functionType(dart.void, []),
398 add: dart.functionType(dart.void, [core.List$(core.int)]),
399 addSlice: dart.functionType(dart.void, [core.List$(core.int), core.int, co re.int, core.bool])
400 })
401 });
329 class _ByteAdapterSink extends ByteConversionSinkBase { 402 class _ByteAdapterSink extends ByteConversionSinkBase {
330 _ByteAdapterSink(sink) { 403 _ByteAdapterSink(sink) {
331 this[_sink] = sink; 404 this[_sink] = sink;
332 } 405 }
333 add(chunk) { 406 add(chunk) {
334 return this[_sink].add(chunk); 407 return this[_sink].add(chunk);
335 } 408 }
336 close() { 409 close() {
337 return this[_sink].close(); 410 return this[_sink].close();
338 } 411 }
339 } 412 }
413 dart.setSignature(_ByteAdapterSink, {
414 methods: () => ({
415 add: dart.functionType(dart.void, [core.List$(core.int)]),
416 close: dart.functionType(dart.void, [])
417 })
418 });
340 let _buffer = Symbol('_buffer'); 419 let _buffer = Symbol('_buffer');
341 let _callback = Symbol('_callback'); 420 let _callback = Symbol('_callback');
342 let _bufferIndex = Symbol('_bufferIndex'); 421 let _bufferIndex = Symbol('_bufferIndex');
343 class _ByteCallbackSink extends ByteConversionSinkBase { 422 class _ByteCallbackSink extends ByteConversionSinkBase {
344 _ByteCallbackSink(callback) { 423 _ByteCallbackSink(callback) {
345 this[_buffer] = new typed_data.Uint8List(_ByteCallbackSink._INITIAL_BUFFER _SIZE); 424 this[_buffer] = new typed_data.Uint8List(_ByteCallbackSink._INITIAL_BUFFER _SIZE);
346 this[_callback] = callback; 425 this[_callback] = callback;
347 this[_bufferIndex] = 0; 426 this[_bufferIndex] = 0;
348 } 427 }
349 add(chunk) { 428 add(chunk) {
(...skipping 16 matching lines...) Expand all
366 v = dart.notNull(v) | dart.notNull(v) >> 4; 445 v = dart.notNull(v) | dart.notNull(v) >> 4;
367 v = dart.notNull(v) | dart.notNull(v) >> 8; 446 v = dart.notNull(v) | dart.notNull(v) >> 8;
368 v = dart.notNull(v) | dart.notNull(v) >> 16; 447 v = dart.notNull(v) | dart.notNull(v) >> 16;
369 v = dart.notNull(v) + 1; 448 v = dart.notNull(v) + 1;
370 return v; 449 return v;
371 } 450 }
372 close() { 451 close() {
373 this[_callback](this[_buffer][core.$sublist](0, this[_bufferIndex])); 452 this[_callback](this[_buffer][core.$sublist](0, this[_bufferIndex]));
374 } 453 }
375 } 454 }
455 dart.setSignature(_ByteCallbackSink, {
456 methods: () => ({
457 add: dart.functionType(dart.void, [core.Iterable$(core.int)]),
458 close: dart.functionType(dart.void, [])
459 }),
460 statics: () => ({_roundToPowerOf2: dart.functionType(core.int, [core.int])}) ,
461 names: ['_roundToPowerOf2']
462 });
376 _ByteCallbackSink._INITIAL_BUFFER_SIZE = 1024; 463 _ByteCallbackSink._INITIAL_BUFFER_SIZE = 1024;
377 let _ChunkedConversionCallback$ = dart.generic(function(T) { 464 let _ChunkedConversionCallback$ = dart.generic(function(T) {
378 let _ChunkedConversionCallback = dart.typedef('_ChunkedConversionCallback', () => dart.functionType(dart.void, [T])); 465 let _ChunkedConversionCallback = dart.typedef('_ChunkedConversionCallback', () => dart.functionType(dart.void, [T]));
379 return _ChunkedConversionCallback; 466 return _ChunkedConversionCallback;
380 }); 467 });
381 let _ChunkedConversionCallback = _ChunkedConversionCallback$(); 468 let _ChunkedConversionCallback = _ChunkedConversionCallback$();
382 let _accumulated = Symbol('_accumulated'); 469 let _accumulated = Symbol('_accumulated');
383 let _SimpleCallbackSink$ = dart.generic(function(T) { 470 let _SimpleCallbackSink$ = dart.generic(function(T) {
384 class _SimpleCallbackSink extends ChunkedConversionSink$(T) { 471 class _SimpleCallbackSink extends ChunkedConversionSink$(T) {
385 _SimpleCallbackSink(callback) { 472 _SimpleCallbackSink(callback) {
386 this[_accumulated] = dart.setType([], core.List$(T)); 473 this[_accumulated] = dart.setType([], core.List$(T));
387 this[_callback] = callback; 474 this[_callback] = callback;
388 super.ChunkedConversionSink(); 475 super.ChunkedConversionSink();
389 } 476 }
390 add(chunk) { 477 add(chunk) {
391 dart.as(chunk, T); 478 dart.as(chunk, T);
392 this[_accumulated][core.$add](chunk); 479 this[_accumulated][core.$add](chunk);
393 } 480 }
394 close() { 481 close() {
395 this[_callback](this[_accumulated]); 482 this[_callback](this[_accumulated]);
396 } 483 }
397 } 484 }
485 dart.setSignature(_SimpleCallbackSink, {
486 methods: () => ({
487 add: dart.functionType(dart.void, [T]),
488 close: dart.functionType(dart.void, [])
489 })
490 });
398 return _SimpleCallbackSink; 491 return _SimpleCallbackSink;
399 }); 492 });
400 let _SimpleCallbackSink = _SimpleCallbackSink$(); 493 let _SimpleCallbackSink = _SimpleCallbackSink$();
401 let _EventSinkAdapter$ = dart.generic(function(T) { 494 let _EventSinkAdapter$ = dart.generic(function(T) {
402 class _EventSinkAdapter extends core.Object { 495 class _EventSinkAdapter extends core.Object {
403 _EventSinkAdapter(sink) { 496 _EventSinkAdapter(sink) {
404 this[_sink] = sink; 497 this[_sink] = sink;
405 } 498 }
406 add(data) { 499 add(data) {
407 dart.as(data, T); 500 dart.as(data, T);
408 return this[_sink].add(data); 501 return this[_sink].add(data);
409 } 502 }
410 close() { 503 close() {
411 return this[_sink].close(); 504 return this[_sink].close();
412 } 505 }
413 } 506 }
414 _EventSinkAdapter[dart.implements] = () => [ChunkedConversionSink$(T)]; 507 _EventSinkAdapter[dart.implements] = () => [ChunkedConversionSink$(T)];
508 dart.setSignature(_EventSinkAdapter, {
509 methods: () => ({
510 add: dart.functionType(dart.void, [T]),
511 close: dart.functionType(dart.void, [])
512 })
513 });
415 return _EventSinkAdapter; 514 return _EventSinkAdapter;
416 }); 515 });
417 let _EventSinkAdapter = _EventSinkAdapter$(); 516 let _EventSinkAdapter = _EventSinkAdapter$();
418 let _eventSink = Symbol('_eventSink'); 517 let _eventSink = Symbol('_eventSink');
419 let _chunkedSink = Symbol('_chunkedSink'); 518 let _chunkedSink = Symbol('_chunkedSink');
420 let _ConverterStreamEventSink$ = dart.generic(function(S, T) { 519 let _ConverterStreamEventSink$ = dart.generic(function(S, T) {
421 class _ConverterStreamEventSink extends core.Object { 520 class _ConverterStreamEventSink extends core.Object {
422 _ConverterStreamEventSink(converter, sink) { 521 _ConverterStreamEventSink(converter, sink) {
423 this[_eventSink] = sink; 522 this[_eventSink] = sink;
424 this[_chunkedSink] = converter.startChunkedConversion(sink); 523 this[_chunkedSink] = converter.startChunkedConversion(sink);
425 } 524 }
426 add(o) { 525 add(o) {
427 dart.as(o, S); 526 dart.as(o, S);
428 return this[_chunkedSink].add(o); 527 return this[_chunkedSink].add(o);
429 } 528 }
430 addError(error, stackTrace) { 529 addError(error, stackTrace) {
431 if (stackTrace === void 0) 530 if (stackTrace === void 0)
432 stackTrace = null; 531 stackTrace = null;
433 this[_eventSink].addError(error, stackTrace); 532 this[_eventSink].addError(error, stackTrace);
434 } 533 }
435 close() { 534 close() {
436 return this[_chunkedSink].close(); 535 return this[_chunkedSink].close();
437 } 536 }
438 } 537 }
439 _ConverterStreamEventSink[dart.implements] = () => [async.EventSink$(S)]; 538 _ConverterStreamEventSink[dart.implements] = () => [async.EventSink$(S)];
539 dart.setSignature(_ConverterStreamEventSink, {
540 methods: () => ({
541 add: dart.functionType(dart.void, [S]),
542 addError: dart.functionType(dart.void, [core.Object], [core.StackTrace]) ,
543 close: dart.functionType(dart.void, [])
544 })
545 });
440 return _ConverterStreamEventSink; 546 return _ConverterStreamEventSink;
441 }); 547 });
442 let _ConverterStreamEventSink = _ConverterStreamEventSink$(); 548 let _ConverterStreamEventSink = _ConverterStreamEventSink$();
443 let _first = Symbol('_first'); 549 let _first = Symbol('_first');
444 let _second = Symbol('_second'); 550 let _second = Symbol('_second');
445 let _FusedCodec$ = dart.generic(function(S, M, T) { 551 let _FusedCodec$ = dart.generic(function(S, M, T) {
446 class _FusedCodec extends Codec$(S, T) { 552 class _FusedCodec extends Codec$(S, T) {
447 get encoder() { 553 get encoder() {
448 return dart.as(this[_first].encoder.fuse(this[_second].encoder), Convert er$(S, T)); 554 return dart.as(this[_first].encoder.fuse(this[_second].encoder), Convert er$(S, T));
449 } 555 }
450 get decoder() { 556 get decoder() {
451 return dart.as(this[_second].decoder.fuse(this[_first].decoder), Convert er$(T, S)); 557 return dart.as(this[_second].decoder.fuse(this[_first].decoder), Convert er$(T, S));
452 } 558 }
453 _FusedCodec(first, second) { 559 _FusedCodec(first, second) {
454 this[_first] = first; 560 this[_first] = first;
455 this[_second] = second; 561 this[_second] = second;
456 super.Codec(); 562 super.Codec();
457 } 563 }
458 } 564 }
565 dart.setSignature(_FusedCodec, {});
459 return _FusedCodec; 566 return _FusedCodec;
460 }); 567 });
461 let _FusedCodec = _FusedCodec$(); 568 let _FusedCodec = _FusedCodec$();
462 let _codec = Symbol('_codec'); 569 let _codec = Symbol('_codec');
463 let _InvertedCodec$ = dart.generic(function(T, S) { 570 let _InvertedCodec$ = dart.generic(function(T, S) {
464 class _InvertedCodec extends Codec$(T, S) { 571 class _InvertedCodec extends Codec$(T, S) {
465 _InvertedCodec(codec) { 572 _InvertedCodec(codec) {
466 this[_codec] = codec; 573 this[_codec] = codec;
467 super.Codec(); 574 super.Codec();
468 } 575 }
469 get encoder() { 576 get encoder() {
470 return this[_codec].decoder; 577 return this[_codec].decoder;
471 } 578 }
472 get decoder() { 579 get decoder() {
473 return this[_codec].encoder; 580 return this[_codec].encoder;
474 } 581 }
475 get inverted() { 582 get inverted() {
476 return this[_codec]; 583 return this[_codec];
477 } 584 }
478 } 585 }
586 dart.setSignature(_InvertedCodec, {});
479 return _InvertedCodec; 587 return _InvertedCodec;
480 }); 588 });
481 let _InvertedCodec = _InvertedCodec$(); 589 let _InvertedCodec = _InvertedCodec$();
482 let _FusedConverter$ = dart.generic(function(S, M, T) { 590 let _FusedConverter$ = dart.generic(function(S, M, T) {
483 class _FusedConverter extends Converter$(S, T) { 591 class _FusedConverter extends Converter$(S, T) {
484 _FusedConverter(first, second) { 592 _FusedConverter(first, second) {
485 this[_first] = first; 593 this[_first] = first;
486 this[_second] = second; 594 this[_second] = second;
487 super.Converter(); 595 super.Converter();
488 } 596 }
489 convert(input) { 597 convert(input) {
490 dart.as(input, S); 598 dart.as(input, S);
491 return dart.as(this[_second].convert(this[_first].convert(input)), T); 599 return dart.as(this[_second].convert(this[_first].convert(input)), T);
492 } 600 }
493 startChunkedConversion(sink) { 601 startChunkedConversion(sink) {
494 dart.as(sink, core.Sink$(T)); 602 dart.as(sink, core.Sink$(T));
495 return this[_first].startChunkedConversion(this[_second].startChunkedCon version(sink)); 603 return this[_first].startChunkedConversion(this[_second].startChunkedCon version(sink));
496 } 604 }
497 } 605 }
606 dart.setSignature(_FusedConverter, {
607 methods: () => ({
608 convert: dart.functionType(T, [S]),
609 startChunkedConversion: dart.functionType(ChunkedConversionSink, [core.S ink$(T)])
610 })
611 });
498 return _FusedConverter; 612 return _FusedConverter;
499 }); 613 });
500 let _FusedConverter = _FusedConverter$(); 614 let _FusedConverter = _FusedConverter$();
501 dart.defineLazyProperties(Encoding, { 615 dart.defineLazyProperties(Encoding, {
502 get _nameToEncoding() { 616 get _nameToEncoding() {
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}); 617 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});
504 }, 618 },
505 set _nameToEncoding(_) {} 619 set _nameToEncoding(_) {}
506 }); 620 });
507 let _convert = Symbol('_convert'); 621 let _convert = Symbol('_convert');
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 } 687 }
574 return result != null ? dart.toString(result) : null; 688 return result != null ? dart.toString(result) : null;
575 } 689 }
576 startChunkedConversion(sink) { 690 startChunkedConversion(sink) {
577 if (!dart.is(sink, StringConversionSink)) { 691 if (!dart.is(sink, StringConversionSink)) {
578 sink = new StringConversionSink.from(sink); 692 sink = new StringConversionSink.from(sink);
579 } 693 }
580 return new _HtmlEscapeSink(this, dart.as(sink, StringConversionSink)); 694 return new _HtmlEscapeSink(this, dart.as(sink, StringConversionSink));
581 } 695 }
582 } 696 }
697 dart.setSignature(HtmlEscape, {
698 methods: () => ({
699 convert: dart.functionType(core.String, [core.String]),
700 [_convert]: dart.functionType(core.String, [core.String, core.int, core.in t]),
701 startChunkedConversion: dart.functionType(StringConversionSink, [core.Sink $(core.String)])
702 })
703 });
583 let HTML_ESCAPE = dart.const(new HtmlEscape()); 704 let HTML_ESCAPE = dart.const(new HtmlEscape());
584 let _name = Symbol('_name'); 705 let _name = Symbol('_name');
585 class HtmlEscapeMode extends core.Object { 706 class HtmlEscapeMode extends core.Object {
586 _(name, escapeLtGt, escapeQuot, escapeApos, escapeSlash) { 707 _(name, escapeLtGt, escapeQuot, escapeApos, escapeSlash) {
587 this[_name] = name; 708 this[_name] = name;
588 this.escapeLtGt = escapeLtGt; 709 this.escapeLtGt = escapeLtGt;
589 this.escapeQuot = escapeQuot; 710 this.escapeQuot = escapeQuot;
590 this.escapeApos = escapeApos; 711 this.escapeApos = escapeApos;
591 this.escapeSlash = escapeSlash; 712 this.escapeSlash = escapeSlash;
592 } 713 }
593 toString() { 714 toString() {
594 return this[_name]; 715 return this[_name];
595 } 716 }
596 } 717 }
597 dart.defineNamedConstructor(HtmlEscapeMode, '_'); 718 dart.defineNamedConstructor(HtmlEscapeMode, '_');
719 dart.setSignature(HtmlEscapeMode, {
720 methods: () => ({toString: dart.functionType(core.String, [])})
721 });
598 HtmlEscapeMode.UNKNOWN = dart.const(new HtmlEscapeMode._('unknown', true, true , true, true)); 722 HtmlEscapeMode.UNKNOWN = dart.const(new HtmlEscapeMode._('unknown', true, true , true, true));
599 HtmlEscapeMode.ATTRIBUTE = dart.const(new HtmlEscapeMode._('attribute', false, true, false, false)); 723 HtmlEscapeMode.ATTRIBUTE = dart.const(new HtmlEscapeMode._('attribute', false, true, false, false));
600 HtmlEscapeMode.ELEMENT = dart.const(new HtmlEscapeMode._('element', true, fals e, false, true)); 724 HtmlEscapeMode.ELEMENT = dart.const(new HtmlEscapeMode._('element', true, fals e, false, true));
601 let _escape = Symbol('_escape'); 725 let _escape = Symbol('_escape');
602 class _HtmlEscapeSink extends StringConversionSinkBase { 726 class _HtmlEscapeSink extends StringConversionSinkBase {
603 _HtmlEscapeSink(escape, sink) { 727 _HtmlEscapeSink(escape, sink) {
604 this[_escape] = escape; 728 this[_escape] = escape;
605 this[_sink] = sink; 729 this[_sink] = sink;
606 } 730 }
607 addSlice(chunk, start, end, isLast) { 731 addSlice(chunk, start, end, isLast) {
608 let val = this[_escape][_convert](chunk, start, end); 732 let val = this[_escape][_convert](chunk, start, end);
609 if (val == null) { 733 if (val == null) {
610 this[_sink].addSlice(chunk, start, end, isLast); 734 this[_sink].addSlice(chunk, start, end, isLast);
611 } else { 735 } else {
612 this[_sink].add(val); 736 this[_sink].add(val);
613 if (isLast) 737 if (isLast)
614 this[_sink].close(); 738 this[_sink].close();
615 } 739 }
616 } 740 }
617 close() { 741 close() {
618 return this[_sink].close(); 742 return this[_sink].close();
619 } 743 }
620 } 744 }
745 dart.setSignature(_HtmlEscapeSink, {
746 methods: () => ({
747 addSlice: dart.functionType(dart.void, [core.String, core.int, core.int, c ore.bool]),
748 close: dart.functionType(dart.void, [])
749 })
750 });
621 class JsonUnsupportedObjectError extends core.Error { 751 class JsonUnsupportedObjectError extends core.Error {
622 JsonUnsupportedObjectError(unsupportedObject, opts) { 752 JsonUnsupportedObjectError(unsupportedObject, opts) {
623 let cause = opts && 'cause' in opts ? opts.cause : null; 753 let cause = opts && 'cause' in opts ? opts.cause : null;
624 this.unsupportedObject = unsupportedObject; 754 this.unsupportedObject = unsupportedObject;
625 this.cause = cause; 755 this.cause = cause;
626 super.Error(); 756 super.Error();
627 } 757 }
628 toString() { 758 toString() {
629 if (this.cause != null) { 759 if (this.cause != null) {
630 return "Converting object to an encodable object failed."; 760 return "Converting object to an encodable object failed.";
631 } else { 761 } else {
632 return "Converting object did not return an encodable object."; 762 return "Converting object did not return an encodable object.";
633 } 763 }
634 } 764 }
635 } 765 }
766 dart.setSignature(JsonUnsupportedObjectError, {
767 methods: () => ({toString: dart.functionType(core.String, [])})
768 });
636 class JsonCyclicError extends JsonUnsupportedObjectError { 769 class JsonCyclicError extends JsonUnsupportedObjectError {
637 JsonCyclicError(object) { 770 JsonCyclicError(object) {
638 super.JsonUnsupportedObjectError(object); 771 super.JsonUnsupportedObjectError(object);
639 } 772 }
640 toString() { 773 toString() {
641 return "Cyclic error in JSON stringify"; 774 return "Cyclic error in JSON stringify";
642 } 775 }
643 } 776 }
777 dart.setSignature(JsonCyclicError, {
778 methods: () => ({toString: dart.functionType(core.String, [])})
779 });
644 let _reviver = Symbol('_reviver'); 780 let _reviver = Symbol('_reviver');
645 let _toEncodable$ = Symbol('_toEncodable'); 781 let _toEncodable$ = Symbol('_toEncodable');
646 class JsonCodec extends Codec$(core.Object, core.String) { 782 class JsonCodec extends Codec$(core.Object, core.String) {
647 JsonCodec(opts) { 783 JsonCodec(opts) {
648 let reviver = opts && 'reviver' in opts ? opts.reviver : null; 784 let reviver = opts && 'reviver' in opts ? opts.reviver : null;
649 let toEncodable = opts && 'toEncodable' in opts ? opts.toEncodable : null; 785 let toEncodable = opts && 'toEncodable' in opts ? opts.toEncodable : null;
650 this[_reviver] = reviver; 786 this[_reviver] = reviver;
651 this[_toEncodable$] = toEncodable; 787 this[_toEncodable$] = toEncodable;
652 super.Codec(); 788 super.Codec();
653 } 789 }
(...skipping 21 matching lines...) Expand all
675 return dart.const(new JsonEncoder()); 811 return dart.const(new JsonEncoder());
676 return new JsonEncoder(dart.as(this[_toEncodable$], dart.functionType(core .Object, [core.Object]))); 812 return new JsonEncoder(dart.as(this[_toEncodable$], dart.functionType(core .Object, [core.Object])));
677 } 813 }
678 get decoder() { 814 get decoder() {
679 if (this[_reviver] == null) 815 if (this[_reviver] == null)
680 return dart.const(new JsonDecoder()); 816 return dart.const(new JsonDecoder());
681 return new JsonDecoder(this[_reviver]); 817 return new JsonDecoder(this[_reviver]);
682 } 818 }
683 } 819 }
684 dart.defineNamedConstructor(JsonCodec, 'withReviver'); 820 dart.defineNamedConstructor(JsonCodec, 'withReviver');
821 dart.setSignature(JsonCodec, {
822 methods: () => ({
823 decode: dart.functionType(dart.dynamic, [core.String], {evive: dart.functi onType(dart.dynamic, [dart.dynamic, dart.dynamic])}),
824 encode: dart.functionType(core.String, [core.Object], {oEncodabl: dart.fun ctionType(dart.dynamic, [dart.dynamic])})
825 })
826 });
685 let JSON = dart.const(new JsonCodec()); 827 let JSON = dart.const(new JsonCodec());
686 let _Reviver = dart.typedef('_Reviver', () => dart.functionType(dart.dynamic, [dart.dynamic, dart.dynamic])); 828 let _Reviver = dart.typedef('_Reviver', () => dart.functionType(dart.dynamic, [dart.dynamic, dart.dynamic]));
687 let _ToEncodable = dart.typedef('_ToEncodable', () => dart.functionType(dart.d ynamic, [dart.dynamic])); 829 let _ToEncodable = dart.typedef('_ToEncodable', () => dart.functionType(dart.d ynamic, [dart.dynamic]));
688 class JsonEncoder extends Converter$(core.Object, core.String) { 830 class JsonEncoder extends Converter$(core.Object, core.String) {
689 JsonEncoder(toEncodable) { 831 JsonEncoder(toEncodable) {
690 if (toEncodable === void 0) 832 if (toEncodable === void 0)
691 toEncodable = null; 833 toEncodable = null;
692 this.indent = null; 834 this.indent = null;
693 this[_toEncodable$] = toEncodable; 835 this[_toEncodable$] = toEncodable;
694 super.Converter(); 836 super.Converter();
(...skipping 20 matching lines...) Expand all
715 return super.bind(stream); 857 return super.bind(stream);
716 } 858 }
717 fuse(other) { 859 fuse(other) {
718 if (dart.is(other, Utf8Encoder)) { 860 if (dart.is(other, Utf8Encoder)) {
719 return new JsonUtf8Encoder(this.indent, dart.as(this[_toEncodable$], __C astType4)); 861 return new JsonUtf8Encoder(this.indent, dart.as(this[_toEncodable$], __C astType4));
720 } 862 }
721 return super.fuse(other); 863 return super.fuse(other);
722 } 864 }
723 } 865 }
724 dart.defineNamedConstructor(JsonEncoder, 'withIndent'); 866 dart.defineNamedConstructor(JsonEncoder, 'withIndent');
867 dart.setSignature(JsonEncoder, {
868 methods: () => ({
869 convert: dart.functionType(core.String, [core.Object]),
870 startChunkedConversion: dart.functionType(ChunkedConversionSink$(core.Obje ct), [core.Sink$(core.String)]),
871 bind: dart.functionType(async.Stream$(core.String), [async.Stream$(core.Ob ject)]),
872 fuse: dart.functionType(Converter$(core.Object, dart.dynamic), [Converter$ (core.String, dart.dynamic)])
873 })
874 });
725 let _indent = Symbol('_indent'); 875 let _indent = Symbol('_indent');
726 let _bufferSize = Symbol('_bufferSize'); 876 let _bufferSize = Symbol('_bufferSize');
727 class JsonUtf8Encoder extends Converter$(core.Object, core.List$(core.int)) { 877 class JsonUtf8Encoder extends Converter$(core.Object, core.List$(core.int)) {
728 JsonUtf8Encoder(indent, toEncodable, bufferSize) { 878 JsonUtf8Encoder(indent, toEncodable, bufferSize) {
729 if (indent === void 0) 879 if (indent === void 0)
730 indent = null; 880 indent = null;
731 if (toEncodable === void 0) 881 if (toEncodable === void 0)
732 toEncodable = null; 882 toEncodable = null;
733 if (bufferSize === void 0) 883 if (bufferSize === void 0)
734 bufferSize = JsonUtf8Encoder.DEFAULT_BUFFER_SIZE; 884 bufferSize = JsonUtf8Encoder.DEFAULT_BUFFER_SIZE;
(...skipping 11 matching lines...) Expand all
746 for (let i = 0; dart.notNull(i) < dart.notNull(string.length); i = dart. notNull(i) + 1) { 896 for (let i = 0; dart.notNull(i) < dart.notNull(string.length); i = dart. notNull(i) + 1) {
747 if (dart.notNull(string.codeUnitAt(i)) >= 128) 897 if (dart.notNull(string.codeUnitAt(i)) >= 128)
748 break checkAscii; 898 break checkAscii;
749 } 899 }
750 return string.codeUnits; 900 return string.codeUnits;
751 } 901 }
752 return UTF8.encode(string); 902 return UTF8.encode(string);
753 } 903 }
754 convert(object) { 904 convert(object) {
755 let bytes = dart.setType([], core.List$(core.List$(core.int))); 905 let bytes = dart.setType([], core.List$(core.List$(core.int)));
756 // Function addChunk: (Uint8List, int, int) → void
757 let addChunk = (chunk, start, end) => { 906 let addChunk = (chunk, start, end) => {
758 if (dart.notNull(start) > 0 || dart.notNull(end) < dart.notNull(chunk[co re.$length])) { 907 if (dart.notNull(start) > 0 || dart.notNull(end) < dart.notNull(chunk[co re.$length])) {
759 let length = dart.notNull(end) - dart.notNull(start); 908 let length = dart.notNull(end) - dart.notNull(start);
760 chunk = new typed_data.Uint8List.view(chunk.buffer, dart.notNull(chunk .offsetInBytes) + dart.notNull(start), length); 909 chunk = new typed_data.Uint8List.view(chunk.buffer, dart.notNull(chunk .offsetInBytes) + dart.notNull(start), length);
761 } 910 }
762 bytes[core.$add](chunk); 911 bytes[core.$add](chunk);
763 }; 912 };
913 dart.fn(addChunk, dart.void, [typed_data.Uint8List, core.int, core.int]);
764 _JsonUtf8Stringifier.stringify(object, this[_indent], dart.as(this[_toEnco dable$], dart.functionType(dart.dynamic, [core.Object])), this[_bufferSize], add Chunk); 914 _JsonUtf8Stringifier.stringify(object, this[_indent], dart.as(this[_toEnco dable$], dart.functionType(dart.dynamic, [core.Object])), this[_bufferSize], add Chunk);
765 if (bytes[core.$length] == 1) 915 if (bytes[core.$length] == 1)
766 return bytes[core.$get](0); 916 return bytes[core.$get](0);
767 let length = 0; 917 let length = 0;
768 for (let i = 0; dart.notNull(i) < dart.notNull(bytes[core.$length]); i = d art.notNull(i) + 1) { 918 for (let i = 0; dart.notNull(i) < dart.notNull(bytes[core.$length]); i = d art.notNull(i) + 1) {
769 length = dart.notNull(length) + dart.notNull(bytes[core.$get](i)[core.$l ength]); 919 length = dart.notNull(length) + dart.notNull(bytes[core.$get](i)[core.$l ength]);
770 } 920 }
771 let result = new typed_data.Uint8List(length); 921 let result = new typed_data.Uint8List(length);
772 for (let i = 0, offset = 0; dart.notNull(i) < dart.notNull(bytes[core.$len gth]); i = dart.notNull(i) + 1) { 922 for (let i = 0, offset = 0; dart.notNull(i) < dart.notNull(bytes[core.$len gth]); i = dart.notNull(i) + 1) {
773 let byteList = bytes[core.$get](i); 923 let byteList = bytes[core.$get](i);
(...skipping 12 matching lines...) Expand all
786 } 936 }
787 return new _JsonUtf8EncoderSink(byteSink, this[_toEncodable$], this[_inden t], this[_bufferSize]); 937 return new _JsonUtf8EncoderSink(byteSink, this[_toEncodable$], this[_inden t], this[_bufferSize]);
788 } 938 }
789 bind(stream) { 939 bind(stream) {
790 return super.bind(stream); 940 return super.bind(stream);
791 } 941 }
792 fuse(other) { 942 fuse(other) {
793 return super.fuse(other); 943 return super.fuse(other);
794 } 944 }
795 } 945 }
946 dart.setSignature(JsonUtf8Encoder, {
947 methods: () => ({
948 convert: dart.functionType(core.List$(core.int), [core.Object]),
949 startChunkedConversion: dart.functionType(ChunkedConversionSink$(core.Obje ct), [core.Sink$(core.List$(core.int))]),
950 bind: dart.functionType(async.Stream$(core.List$(core.int)), [async.Stream $(core.Object)]),
951 fuse: dart.functionType(Converter$(core.Object, dart.dynamic), [Converter$ (core.List$(core.int), dart.dynamic)])
952 }),
953 statics: () => ({_utf8Encode: dart.functionType(core.List$(core.int), [core. String])}),
954 names: ['_utf8Encode']
955 });
796 JsonUtf8Encoder.DEFAULT_BUFFER_SIZE = 256; 956 JsonUtf8Encoder.DEFAULT_BUFFER_SIZE = 256;
797 let _isDone = Symbol('_isDone'); 957 let _isDone = Symbol('_isDone');
798 class _JsonEncoderSink extends ChunkedConversionSink$(core.Object) { 958 class _JsonEncoderSink extends ChunkedConversionSink$(core.Object) {
799 _JsonEncoderSink(sink, toEncodable, indent) { 959 _JsonEncoderSink(sink, toEncodable, indent) {
800 this[_sink] = sink; 960 this[_sink] = sink;
801 this[_toEncodable$] = toEncodable; 961 this[_toEncodable$] = toEncodable;
802 this[_indent] = indent; 962 this[_indent] = indent;
803 this[_isDone] = false; 963 this[_isDone] = false;
804 super.ChunkedConversionSink(); 964 super.ChunkedConversionSink();
805 } 965 }
806 add(o) { 966 add(o) {
807 if (this[_isDone]) { 967 if (this[_isDone]) {
808 throw new core.StateError("Only one call to add allowed"); 968 throw new core.StateError("Only one call to add allowed");
809 } 969 }
810 this[_isDone] = true; 970 this[_isDone] = true;
811 let stringSink = this[_sink].asStringSink(); 971 let stringSink = this[_sink].asStringSink();
812 _JsonStringStringifier.printOn(o, stringSink, dart.as(this[_toEncodable$], dart.functionType(dart.dynamic, [dart.dynamic])), this[_indent]); 972 _JsonStringStringifier.printOn(o, stringSink, dart.as(this[_toEncodable$], dart.functionType(dart.dynamic, [dart.dynamic])), this[_indent]);
813 stringSink.close(); 973 stringSink.close();
814 } 974 }
815 close() {} 975 close() {}
816 } 976 }
977 dart.setSignature(_JsonEncoderSink, {
978 methods: () => ({
979 add: dart.functionType(dart.void, [core.Object]),
980 close: dart.functionType(dart.void, [])
981 })
982 });
817 let _addChunk = Symbol('_addChunk'); 983 let _addChunk = Symbol('_addChunk');
818 class _JsonUtf8EncoderSink extends ChunkedConversionSink$(core.Object) { 984 class _JsonUtf8EncoderSink extends ChunkedConversionSink$(core.Object) {
819 _JsonUtf8EncoderSink(sink, toEncodable, indent, bufferSize) { 985 _JsonUtf8EncoderSink(sink, toEncodable, indent, bufferSize) {
820 this[_sink] = sink; 986 this[_sink] = sink;
821 this[_toEncodable$] = toEncodable; 987 this[_toEncodable$] = toEncodable;
822 this[_indent] = indent; 988 this[_indent] = indent;
823 this[_bufferSize] = bufferSize; 989 this[_bufferSize] = bufferSize;
824 this[_isDone] = false; 990 this[_isDone] = false;
825 super.ChunkedConversionSink(); 991 super.ChunkedConversionSink();
826 } 992 }
827 [_addChunk](chunk, start, end) { 993 [_addChunk](chunk, start, end) {
828 this[_sink].addSlice(chunk, start, end, false); 994 this[_sink].addSlice(chunk, start, end, false);
829 } 995 }
830 add(object) { 996 add(object) {
831 if (this[_isDone]) { 997 if (this[_isDone]) {
832 throw new core.StateError("Only one call to add allowed"); 998 throw new core.StateError("Only one call to add allowed");
833 } 999 }
834 this[_isDone] = true; 1000 this[_isDone] = true;
835 _JsonUtf8Stringifier.stringify(object, this[_indent], dart.as(this[_toEnco dable$], dart.functionType(dart.dynamic, [core.Object])), this[_bufferSize], thi s[_addChunk].bind(this)); 1001 _JsonUtf8Stringifier.stringify(object, this[_indent], dart.as(this[_toEnco dable$], dart.functionType(dart.dynamic, [core.Object])), this[_bufferSize], thi s[_addChunk].bind(this));
836 this[_sink].close(); 1002 this[_sink].close();
837 } 1003 }
838 close() { 1004 close() {
839 if (!dart.notNull(this[_isDone])) { 1005 if (!dart.notNull(this[_isDone])) {
840 this[_isDone] = true; 1006 this[_isDone] = true;
841 this[_sink].close(); 1007 this[_sink].close();
842 } 1008 }
843 } 1009 }
844 } 1010 }
1011 dart.setSignature(_JsonUtf8EncoderSink, {
1012 methods: () => ({
1013 [_addChunk]: dart.functionType(dart.void, [typed_data.Uint8List, core.int, core.int]),
1014 add: dart.functionType(dart.void, [core.Object]),
1015 close: dart.functionType(dart.void, [])
1016 })
1017 });
845 class JsonDecoder extends Converter$(core.String, core.Object) { 1018 class JsonDecoder extends Converter$(core.String, core.Object) {
846 JsonDecoder(reviver) { 1019 JsonDecoder(reviver) {
847 if (reviver === void 0) 1020 if (reviver === void 0)
848 reviver = null; 1021 reviver = null;
849 this[_reviver] = reviver; 1022 this[_reviver] = reviver;
850 super.Converter(); 1023 super.Converter();
851 } 1024 }
852 convert(input) { 1025 convert(input) {
853 return _parseJson(input, this[_reviver]); 1026 return _parseJson(input, this[_reviver]);
854 } 1027 }
855 startChunkedConversion(sink) { 1028 startChunkedConversion(sink) {
856 return new _JsonDecoderSink(this[_reviver], sink); 1029 return new _JsonDecoderSink(this[_reviver], sink);
857 } 1030 }
858 bind(stream) { 1031 bind(stream) {
859 return super.bind(stream); 1032 return super.bind(stream);
860 } 1033 }
861 } 1034 }
862 // Function _parseJson: (String, (dynamic, dynamic) → dynamic) → dynamic 1035 dart.setSignature(JsonDecoder, {
1036 methods: () => ({
1037 convert: dart.functionType(dart.dynamic, [core.String]),
1038 startChunkedConversion: dart.functionType(StringConversionSink, [core.Sink $(core.Object)]),
1039 bind: dart.functionType(async.Stream$(core.Object), [async.Stream$(core.St ring)])
1040 })
1041 });
863 function _parseJson(source, reviver) { 1042 function _parseJson(source, reviver) {
864 if (!(typeof source == 'string')) 1043 if (!(typeof source == 'string'))
865 throw new core.ArgumentError(source); 1044 throw new core.ArgumentError(source);
866 let parsed = null; 1045 let parsed = null;
867 try { 1046 try {
868 parsed = JSON.parse(source); 1047 parsed = JSON.parse(source);
869 } catch (e) { 1048 } catch (e) {
870 throw new core.FormatException(String(e)); 1049 throw new core.FormatException(String(e));
871 } 1050 }
872 1051
873 if (reviver == null) { 1052 if (reviver == null) {
874 return _convertJsonToDartLazy(parsed); 1053 return _convertJsonToDartLazy(parsed);
875 } else { 1054 } else {
876 return _convertJsonToDart(parsed, reviver); 1055 return _convertJsonToDart(parsed, reviver);
877 } 1056 }
878 } 1057 }
879 // Function _defaultToEncodable: (dynamic) → Object 1058 dart.fn(_parseJson, dart.dynamic, [core.String, dart.functionType(dart.dynamic , [dart.dynamic, dart.dynamic])]);
880 function _defaultToEncodable(object) { 1059 function _defaultToEncodable(object) {
881 return dart.dsend(object, 'toJson'); 1060 return dart.dsend(object, 'toJson');
882 } 1061 }
1062 dart.fn(_defaultToEncodable, core.Object, [dart.dynamic]);
883 let _seen = Symbol('_seen'); 1063 let _seen = Symbol('_seen');
884 let _checkCycle = Symbol('_checkCycle'); 1064 let _checkCycle = Symbol('_checkCycle');
885 let _removeSeen = Symbol('_removeSeen'); 1065 let _removeSeen = Symbol('_removeSeen');
886 class _JsonStringifier extends core.Object { 1066 class _JsonStringifier extends core.Object {
887 _JsonStringifier(_toEncodable) { 1067 _JsonStringifier(_toEncodable) {
888 this[_seen] = new core.List(); 1068 this[_seen] = new core.List();
889 this[_toEncodable$] = _toEncodable != null ? _toEncodable : _defaultToEnco dable; 1069 this[_toEncodable$] = _toEncodable != null ? _toEncodable : _defaultToEnco dable;
890 } 1070 }
891 static hexDigit(x) { 1071 static hexDigit(x) {
892 return dart.notNull(x) < 10 ? 48 + dart.notNull(x) : 87 + dart.notNull(x); 1072 return dart.notNull(x) < 10 ? 48 + dart.notNull(x) : 87 + dart.notNull(x);
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
1022 for (let i = 1; dart.notNull(i) < dart.notNull(list[core.$length]); i = dart.notNull(i) + 1) { 1202 for (let i = 1; dart.notNull(i) < dart.notNull(list[core.$length]); i = dart.notNull(i) + 1) {
1023 this.writeString(','); 1203 this.writeString(',');
1024 this.writeObject(list[core.$get](i)); 1204 this.writeObject(list[core.$get](i));
1025 } 1205 }
1026 } 1206 }
1027 this.writeString(']'); 1207 this.writeString(']');
1028 } 1208 }
1029 writeMap(map) { 1209 writeMap(map) {
1030 this.writeString('{'); 1210 this.writeString('{');
1031 let separator = '"'; 1211 let separator = '"';
1032 map.forEach(((key, value) => { 1212 map.forEach(dart.fn(((key, value) => {
1033 this.writeString(separator); 1213 this.writeString(separator);
1034 separator = ',"'; 1214 separator = ',"';
1035 this.writeStringContent(key); 1215 this.writeStringContent(key);
1036 this.writeString('":'); 1216 this.writeString('":');
1037 this.writeObject(value); 1217 this.writeObject(value);
1038 }).bind(this)); 1218 }).bind(this), dart.dynamic, [core.String, dart.dynamic]));
1039 this.writeString('}'); 1219 this.writeString('}');
1040 } 1220 }
1041 } 1221 }
1222 dart.setSignature(_JsonStringifier, {
1223 methods: () => ({
1224 writeStringContent: dart.functionType(dart.void, [core.String]),
1225 [_checkCycle]: dart.functionType(dart.void, [dart.dynamic]),
1226 [_removeSeen]: dart.functionType(dart.void, [dart.dynamic]),
1227 writeObject: dart.functionType(dart.void, [dart.dynamic]),
1228 writeJsonValue: dart.functionType(core.bool, [dart.dynamic]),
1229 writeList: dart.functionType(dart.void, [core.List]),
1230 writeMap: dart.functionType(dart.void, [core.Map$(core.String, core.Object )])
1231 }),
1232 statics: () => ({hexDigit: dart.functionType(core.int, [core.int])}),
1233 names: ['hexDigit']
1234 });
1042 _JsonStringifier.BACKSPACE = 8; 1235 _JsonStringifier.BACKSPACE = 8;
1043 _JsonStringifier.TAB = 9; 1236 _JsonStringifier.TAB = 9;
1044 _JsonStringifier.NEWLINE = 10; 1237 _JsonStringifier.NEWLINE = 10;
1045 _JsonStringifier.CARRIAGE_RETURN = 13; 1238 _JsonStringifier.CARRIAGE_RETURN = 13;
1046 _JsonStringifier.FORM_FEED = 12; 1239 _JsonStringifier.FORM_FEED = 12;
1047 _JsonStringifier.QUOTE = 34; 1240 _JsonStringifier.QUOTE = 34;
1048 _JsonStringifier.CHAR_0 = 48; 1241 _JsonStringifier.CHAR_0 = 48;
1049 _JsonStringifier.BACKSLASH = 92; 1242 _JsonStringifier.BACKSLASH = 92;
1050 _JsonStringifier.CHAR_b = 98; 1243 _JsonStringifier.CHAR_b = 98;
1051 _JsonStringifier.CHAR_f = 102; 1244 _JsonStringifier.CHAR_f = 102;
(...skipping 25 matching lines...) Expand all
1077 this.writeString(']'); 1270 this.writeString(']');
1078 } 1271 }
1079 } 1272 }
1080 writeMap(map) { 1273 writeMap(map) {
1081 if (map.isEmpty) { 1274 if (map.isEmpty) {
1082 this.writeString('{}'); 1275 this.writeString('{}');
1083 } else { 1276 } else {
1084 this.writeString('{\n'); 1277 this.writeString('{\n');
1085 this[_indentLevel] = dart.notNull(this[_indentLevel]) + 1; 1278 this[_indentLevel] = dart.notNull(this[_indentLevel]) + 1;
1086 let first = true; 1279 let first = true;
1087 map.forEach(((key, value) => { 1280 map.forEach(dart.fn(((key, value) => {
1088 if (!dart.notNull(first)) { 1281 if (!dart.notNull(first)) {
1089 this.writeString(",\n"); 1282 this.writeString(",\n");
1090 } 1283 }
1091 this.writeIndentation(this[_indentLevel]); 1284 this.writeIndentation(this[_indentLevel]);
1092 this.writeString('"'); 1285 this.writeString('"');
1093 this.writeStringContent(key); 1286 this.writeStringContent(key);
1094 this.writeString('": '); 1287 this.writeString('": ');
1095 this.writeObject(value); 1288 this.writeObject(value);
1096 first = false; 1289 first = false;
1097 }).bind(this)); 1290 }).bind(this), dart.dynamic, [core.String, core.Object]));
1098 this.writeString('\n'); 1291 this.writeString('\n');
1099 this[_indentLevel] = dart.notNull(this[_indentLevel]) - 1; 1292 this[_indentLevel] = dart.notNull(this[_indentLevel]) - 1;
1100 this.writeIndentation(this[_indentLevel]); 1293 this.writeIndentation(this[_indentLevel]);
1101 this.writeString('}'); 1294 this.writeString('}');
1102 } 1295 }
1103 } 1296 }
1104 } 1297 }
1105 _JsonPrettyPrintMixin[dart.implements] = () => [_JsonStringifier]; 1298 _JsonPrettyPrintMixin[dart.implements] = () => [_JsonStringifier];
1299 dart.setSignature(_JsonPrettyPrintMixin, {
1300 methods: () => ({
1301 writeList: dart.functionType(dart.void, [core.List]),
1302 writeMap: dart.functionType(dart.void, [core.Map])
1303 })
1304 });
1106 class _JsonStringStringifier extends _JsonStringifier { 1305 class _JsonStringStringifier extends _JsonStringifier {
1107 _JsonStringStringifier(sink, _toEncodable) { 1306 _JsonStringStringifier(sink, _toEncodable) {
1108 this[_sink] = sink; 1307 this[_sink] = sink;
1109 super._JsonStringifier(dart.as(_toEncodable, dart.functionType(core.Object , [core.Object]))); 1308 super._JsonStringifier(dart.as(_toEncodable, dart.functionType(core.Object , [core.Object])));
1110 } 1309 }
1111 static stringify(object, toEncodable, indent) { 1310 static stringify(object, toEncodable, indent) {
1112 let output = new core.StringBuffer(); 1311 let output = new core.StringBuffer();
1113 _JsonStringStringifier.printOn(object, output, toEncodable, indent); 1312 _JsonStringStringifier.printOn(object, output, toEncodable, indent);
1114 return dart.toString(output); 1313 return dart.toString(output);
1115 } 1314 }
(...skipping 12 matching lines...) Expand all
1128 writeString(string) { 1327 writeString(string) {
1129 this[_sink].write(string); 1328 this[_sink].write(string);
1130 } 1329 }
1131 writeStringSlice(string, start, end) { 1330 writeStringSlice(string, start, end) {
1132 this[_sink].write(string.substring(start, end)); 1331 this[_sink].write(string.substring(start, end));
1133 } 1332 }
1134 writeCharCode(charCode) { 1333 writeCharCode(charCode) {
1135 this[_sink].writeCharCode(charCode); 1334 this[_sink].writeCharCode(charCode);
1136 } 1335 }
1137 } 1336 }
1337 dart.setSignature(_JsonStringStringifier, {
1338 methods: () => ({
1339 writeNumber: dart.functionType(dart.void, [core.num]),
1340 writeString: dart.functionType(dart.void, [core.String]),
1341 writeStringSlice: dart.functionType(dart.void, [core.String, core.int, cor e.int]),
1342 writeCharCode: dart.functionType(dart.void, [core.int])
1343 }),
1344 statics: () => ({
1345 stringify: dart.functionType(core.String, [dart.dynamic, dart.functionType (dart.dynamic, [dart.dynamic]), core.String]),
1346 printOn: dart.functionType(dart.void, [dart.dynamic, core.StringSink, dart .functionType(dart.dynamic, [dart.dynamic]), core.String])
1347 }),
1348 names: ['stringify', 'printOn']
1349 });
1138 class _JsonStringStringifierPretty extends dart.mixin(_JsonStringStringifier, _JsonPrettyPrintMixin) { 1350 class _JsonStringStringifierPretty extends dart.mixin(_JsonStringStringifier, _JsonPrettyPrintMixin) {
1139 _JsonStringStringifierPretty(sink, toEncodable, indent) { 1351 _JsonStringStringifierPretty(sink, toEncodable, indent) {
1140 this[_indent] = indent; 1352 this[_indent] = indent;
1141 super._JsonStringStringifier(sink, toEncodable); 1353 super._JsonStringStringifier(sink, toEncodable);
1142 } 1354 }
1143 writeIndentation(count) { 1355 writeIndentation(count) {
1144 for (let i = 0; dart.notNull(i) < dart.notNull(count); i = dart.notNull(i) + 1) 1356 for (let i = 0; dart.notNull(i) < dart.notNull(count); i = dart.notNull(i) + 1)
1145 this.writeString(this[_indent]); 1357 this.writeString(this[_indent]);
1146 } 1358 }
1147 } 1359 }
1360 dart.setSignature(_JsonStringStringifierPretty, {
1361 methods: () => ({writeIndentation: dart.functionType(dart.void, [core.int])} )
1362 });
1148 class _JsonUtf8Stringifier extends _JsonStringifier { 1363 class _JsonUtf8Stringifier extends _JsonStringifier {
1149 _JsonUtf8Stringifier(toEncodable, bufferSize, addChunk) { 1364 _JsonUtf8Stringifier(toEncodable, bufferSize, addChunk) {
1150 this.addChunk = addChunk; 1365 this.addChunk = addChunk;
1151 this.bufferSize = bufferSize; 1366 this.bufferSize = bufferSize;
1152 this.buffer = new typed_data.Uint8List(bufferSize); 1367 this.buffer = new typed_data.Uint8List(bufferSize);
1153 this.index = 0; 1368 this.index = 0;
1154 super._JsonStringifier(dart.as(toEncodable, dart.functionType(core.Object, [core.Object]))); 1369 super._JsonStringifier(dart.as(toEncodable, dart.functionType(core.Object, [core.Object])));
1155 } 1370 }
1156 static stringify(object, indent, toEncodableFunction, bufferSize, addChunk) { 1371 static stringify(object, indent, toEncodableFunction, bufferSize, addChunk) {
1157 let stringifier = null; 1372 let stringifier = null;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
1237 this.buffer = new typed_data.Uint8List(this.bufferSize); 1452 this.buffer = new typed_data.Uint8List(this.bufferSize);
1238 this.index = 0; 1453 this.index = 0;
1239 } 1454 }
1240 this.buffer[core.$set]((() => { 1455 this.buffer[core.$set]((() => {
1241 let x = this.index; 1456 let x = this.index;
1242 this.index = dart.notNull(x) + 1; 1457 this.index = dart.notNull(x) + 1;
1243 return x; 1458 return x;
1244 }).bind(this)(), byte); 1459 }).bind(this)(), byte);
1245 } 1460 }
1246 } 1461 }
1462 dart.setSignature(_JsonUtf8Stringifier, {
1463 methods: () => ({
1464 flush: dart.functionType(dart.void, []),
1465 writeNumber: dart.functionType(dart.void, [core.num]),
1466 writeAsciiString: dart.functionType(dart.void, [core.String]),
1467 writeString: dart.functionType(dart.void, [core.String]),
1468 writeStringSlice: dart.functionType(dart.void, [core.String, core.int, cor e.int]),
1469 writeCharCode: dart.functionType(dart.void, [core.int]),
1470 writeMultiByteCharCode: dart.functionType(dart.void, [core.int]),
1471 writeFourByteCharCode: dart.functionType(dart.void, [core.int]),
1472 writeByte: dart.functionType(dart.void, [core.int])
1473 }),
1474 statics: () => ({stringify: dart.functionType(dart.void, [core.Object, core. List$(core.int), dart.functionType(dart.dynamic, [core.Object]), core.int, dart. functionType(dart.void, [typed_data.Uint8List, core.int, core.int])])}),
1475 names: ['stringify']
1476 });
1247 class _JsonUtf8StringifierPretty extends dart.mixin(_JsonUtf8Stringifier, _Jso nPrettyPrintMixin) { 1477 class _JsonUtf8StringifierPretty extends dart.mixin(_JsonUtf8Stringifier, _Jso nPrettyPrintMixin) {
1248 _JsonUtf8StringifierPretty(toEncodableFunction, indent, bufferSize, addChunk ) { 1478 _JsonUtf8StringifierPretty(toEncodableFunction, indent, bufferSize, addChunk ) {
1249 this.indent = indent; 1479 this.indent = indent;
1250 super._JsonUtf8Stringifier(toEncodableFunction, dart.as(bufferSize, core.i nt), dart.as(addChunk, core.Function)); 1480 super._JsonUtf8Stringifier(toEncodableFunction, dart.as(bufferSize, core.i nt), dart.as(addChunk, core.Function));
1251 } 1481 }
1252 writeIndentation(count) { 1482 writeIndentation(count) {
1253 let indent = this.indent; 1483 let indent = this.indent;
1254 let indentLength = indent[core.$length]; 1484 let indentLength = indent[core.$length];
1255 if (indentLength == 1) { 1485 if (indentLength == 1) {
1256 let char = indent[core.$get](0); 1486 let char = indent[core.$get](0);
(...skipping 10 matching lines...) Expand all
1267 this.buffer[core.$setRange](this.index, end, indent); 1497 this.buffer[core.$setRange](this.index, end, indent);
1268 this.index = end; 1498 this.index = end;
1269 } else { 1499 } else {
1270 for (let i = 0; dart.notNull(i) < dart.notNull(indentLength); i = dart .notNull(i) + 1) { 1500 for (let i = 0; dart.notNull(i) < dart.notNull(indentLength); i = dart .notNull(i) + 1) {
1271 this.writeByte(indent[core.$get](i)); 1501 this.writeByte(indent[core.$get](i));
1272 } 1502 }
1273 } 1503 }
1274 } 1504 }
1275 } 1505 }
1276 } 1506 }
1507 dart.setSignature(_JsonUtf8StringifierPretty, {
1508 methods: () => ({writeIndentation: dart.functionType(dart.void, [core.int])} )
1509 });
1277 let __CastType0 = dart.typedef('__CastType0', () => dart.functionType(core.Obj ect, [core.Object])); 1510 let __CastType0 = dart.typedef('__CastType0', () => dart.functionType(core.Obj ect, [core.Object]));
1278 let __CastType2 = dart.typedef('__CastType2', () => dart.functionType(dart.dyn amic, [dart.dynamic])); 1511 let __CastType2 = dart.typedef('__CastType2', () => dart.functionType(dart.dyn amic, [dart.dynamic]));
1279 let __CastType4 = dart.typedef('__CastType4', () => dart.functionType(dart.dyn amic, [core.Object])); 1512 let __CastType4 = dart.typedef('__CastType4', () => dart.functionType(dart.dyn amic, [core.Object]));
1280 class Latin1Codec extends Encoding { 1513 class Latin1Codec extends Encoding {
1281 Latin1Codec(opts) { 1514 Latin1Codec(opts) {
1282 let allowInvalid = opts && 'allowInvalid' in opts ? opts.allowInvalid : fa lse; 1515 let allowInvalid = opts && 'allowInvalid' in opts ? opts.allowInvalid : fa lse;
1283 this[_allowInvalid] = allowInvalid; 1516 this[_allowInvalid] = allowInvalid;
1284 super.Encoding(); 1517 super.Encoding();
1285 } 1518 }
1286 get name() { 1519 get name() {
1287 return "iso-8859-1"; 1520 return "iso-8859-1";
1288 } 1521 }
1289 decode(bytes, opts) { 1522 decode(bytes, opts) {
1290 let allowInvalid = opts && 'allowInvalid' in opts ? opts.allowInvalid : nu ll; 1523 let allowInvalid = opts && 'allowInvalid' in opts ? opts.allowInvalid : nu ll;
1291 if (allowInvalid == null) 1524 if (allowInvalid == null)
1292 allowInvalid = this[_allowInvalid]; 1525 allowInvalid = this[_allowInvalid];
1293 if (allowInvalid) { 1526 if (allowInvalid) {
1294 return dart.const(new Latin1Decoder({allowInvalid: true})).convert(bytes ); 1527 return dart.const(new Latin1Decoder({allowInvalid: true})).convert(bytes );
1295 } else { 1528 } else {
1296 return dart.const(new Latin1Decoder({allowInvalid: false})).convert(byte s); 1529 return dart.const(new Latin1Decoder({allowInvalid: false})).convert(byte s);
1297 } 1530 }
1298 } 1531 }
1299 get encoder() { 1532 get encoder() {
1300 return dart.const(new Latin1Encoder()); 1533 return dart.const(new Latin1Encoder());
1301 } 1534 }
1302 get decoder() { 1535 get decoder() {
1303 return this[_allowInvalid] ? dart.const(new Latin1Decoder({allowInvalid: t rue})) : dart.const(new Latin1Decoder({allowInvalid: false})); 1536 return this[_allowInvalid] ? dart.const(new Latin1Decoder({allowInvalid: t rue})) : dart.const(new Latin1Decoder({allowInvalid: false}));
1304 } 1537 }
1305 } 1538 }
1539 dart.setSignature(Latin1Codec, {
1540 methods: () => ({decode: dart.functionType(core.String, [core.List$(core.int )], {llowInvali: core.bool})})
1541 });
1306 let LATIN1 = dart.const(new Latin1Codec()); 1542 let LATIN1 = dart.const(new Latin1Codec());
1307 let _LATIN1_MASK = 255; 1543 let _LATIN1_MASK = 255;
1308 class Latin1Encoder extends _UnicodeSubsetEncoder { 1544 class Latin1Encoder extends _UnicodeSubsetEncoder {
1309 Latin1Encoder() { 1545 Latin1Encoder() {
1310 super._UnicodeSubsetEncoder(_LATIN1_MASK); 1546 super._UnicodeSubsetEncoder(_LATIN1_MASK);
1311 } 1547 }
1312 } 1548 }
1549 dart.setSignature(Latin1Encoder, {});
1313 class Latin1Decoder extends _UnicodeSubsetDecoder { 1550 class Latin1Decoder extends _UnicodeSubsetDecoder {
1314 Latin1Decoder(opts) { 1551 Latin1Decoder(opts) {
1315 let allowInvalid = opts && 'allowInvalid' in opts ? opts.allowInvalid : fa lse; 1552 let allowInvalid = opts && 'allowInvalid' in opts ? opts.allowInvalid : fa lse;
1316 super._UnicodeSubsetDecoder(allowInvalid, _LATIN1_MASK); 1553 super._UnicodeSubsetDecoder(allowInvalid, _LATIN1_MASK);
1317 } 1554 }
1318 startChunkedConversion(sink) { 1555 startChunkedConversion(sink) {
1319 let stringSink = null; 1556 let stringSink = null;
1320 if (dart.is(sink, StringConversionSink)) { 1557 if (dart.is(sink, StringConversionSink)) {
1321 stringSink = sink; 1558 stringSink = sink;
1322 } else { 1559 } else {
1323 stringSink = new StringConversionSink.from(sink); 1560 stringSink = new StringConversionSink.from(sink);
1324 } 1561 }
1325 if (!dart.notNull(this[_allowInvalid])) 1562 if (!dart.notNull(this[_allowInvalid]))
1326 return new _Latin1DecoderSink(stringSink); 1563 return new _Latin1DecoderSink(stringSink);
1327 return new _Latin1AllowInvalidDecoderSink(stringSink); 1564 return new _Latin1AllowInvalidDecoderSink(stringSink);
1328 } 1565 }
1329 } 1566 }
1567 dart.setSignature(Latin1Decoder, {
1568 methods: () => ({startChunkedConversion: dart.functionType(ByteConversionSin k, [core.Sink$(core.String)])})
1569 });
1330 let _addSliceToSink = Symbol('_addSliceToSink'); 1570 let _addSliceToSink = Symbol('_addSliceToSink');
1331 class _Latin1DecoderSink extends ByteConversionSinkBase { 1571 class _Latin1DecoderSink extends ByteConversionSinkBase {
1332 _Latin1DecoderSink(sink) { 1572 _Latin1DecoderSink(sink) {
1333 this[_sink] = sink; 1573 this[_sink] = sink;
1334 } 1574 }
1335 close() { 1575 close() {
1336 this[_sink].close(); 1576 this[_sink].close();
1337 } 1577 }
1338 add(source) { 1578 add(source) {
1339 this.addSlice(source, 0, source[core.$length], false); 1579 this.addSlice(source, 0, source[core.$length], false);
(...skipping 12 matching lines...) Expand all
1352 } 1592 }
1353 } 1593 }
1354 if (dart.notNull(start) < dart.notNull(end)) { 1594 if (dart.notNull(start) < dart.notNull(end)) {
1355 this[_addSliceToSink](source, start, end, isLast); 1595 this[_addSliceToSink](source, start, end, isLast);
1356 } 1596 }
1357 if (isLast) { 1597 if (isLast) {
1358 this.close(); 1598 this.close();
1359 } 1599 }
1360 } 1600 }
1361 } 1601 }
1602 dart.setSignature(_Latin1DecoderSink, {
1603 methods: () => ({
1604 close: dart.functionType(dart.void, []),
1605 add: dart.functionType(dart.void, [core.List$(core.int)]),
1606 [_addSliceToSink]: dart.functionType(dart.void, [core.List$(core.int), cor e.int, core.int, core.bool]),
1607 addSlice: dart.functionType(dart.void, [core.List$(core.int), core.int, co re.int, core.bool])
1608 })
1609 });
1362 class _Latin1AllowInvalidDecoderSink extends _Latin1DecoderSink { 1610 class _Latin1AllowInvalidDecoderSink extends _Latin1DecoderSink {
1363 _Latin1AllowInvalidDecoderSink(sink) { 1611 _Latin1AllowInvalidDecoderSink(sink) {
1364 super._Latin1DecoderSink(sink); 1612 super._Latin1DecoderSink(sink);
1365 } 1613 }
1366 addSlice(source, start, end, isLast) { 1614 addSlice(source, start, end, isLast) {
1367 core.RangeError.checkValidRange(start, end, source[core.$length]); 1615 core.RangeError.checkValidRange(start, end, source[core.$length]);
1368 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull( i) + 1) { 1616 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull( i) + 1) {
1369 let char = source[core.$get](i); 1617 let char = source[core.$get](i);
1370 if (dart.notNull(char) > dart.notNull(_LATIN1_MASK) || dart.notNull(char ) < 0) { 1618 if (dart.notNull(char) > dart.notNull(_LATIN1_MASK) || dart.notNull(char ) < 0) {
1371 if (dart.notNull(i) > dart.notNull(start)) 1619 if (dart.notNull(i) > dart.notNull(start))
1372 this[_addSliceToSink](source, start, i, false); 1620 this[_addSliceToSink](source, start, i, false);
1373 this[_addSliceToSink](dart.const(dart.setType([65533], core.List$(core .int))), 0, 1, false); 1621 this[_addSliceToSink](dart.const(dart.setType([65533], core.List$(core .int))), 0, 1, false);
1374 start = dart.notNull(i) + 1; 1622 start = dart.notNull(i) + 1;
1375 } 1623 }
1376 } 1624 }
1377 if (dart.notNull(start) < dart.notNull(end)) { 1625 if (dart.notNull(start) < dart.notNull(end)) {
1378 this[_addSliceToSink](source, start, end, isLast); 1626 this[_addSliceToSink](source, start, end, isLast);
1379 } 1627 }
1380 if (isLast) { 1628 if (isLast) {
1381 this.close(); 1629 this.close();
1382 } 1630 }
1383 } 1631 }
1384 } 1632 }
1633 dart.setSignature(_Latin1AllowInvalidDecoderSink, {
1634 methods: () => ({addSlice: dart.functionType(dart.void, [core.List$(core.int ), core.int, core.int, core.bool])})
1635 });
1385 class LineSplitter extends Converter$(core.String, core.List$(core.String)) { 1636 class LineSplitter extends Converter$(core.String, core.List$(core.String)) {
1386 LineSplitter() { 1637 LineSplitter() {
1387 super.Converter(); 1638 super.Converter();
1388 } 1639 }
1389 convert(data) { 1640 convert(data) {
1390 let lines = new (core.List$(core.String))(); 1641 let lines = new (core.List$(core.String))();
1391 _LineSplitterSink._addSlice(data, 0, data.length, true, lines[core.$add].b ind(lines)); 1642 _LineSplitterSink._addSlice(data, 0, data.length, true, lines[core.$add].b ind(lines));
1392 return lines; 1643 return lines;
1393 } 1644 }
1394 startChunkedConversion(sink) { 1645 startChunkedConversion(sink) {
1395 if (!dart.is(sink, StringConversionSink)) { 1646 if (!dart.is(sink, StringConversionSink)) {
1396 sink = new StringConversionSink.from(dart.as(sink, core.Sink$(core.Strin g))); 1647 sink = new StringConversionSink.from(dart.as(sink, core.Sink$(core.Strin g)));
1397 } 1648 }
1398 return new _LineSplitterSink(dart.as(sink, StringConversionSink)); 1649 return new _LineSplitterSink(dart.as(sink, StringConversionSink));
1399 } 1650 }
1400 } 1651 }
1652 dart.setSignature(LineSplitter, {
1653 methods: () => ({
1654 convert: dart.functionType(core.List$(core.String), [core.String]),
1655 startChunkedConversion: dart.functionType(StringConversionSink, [core.Sink ])
1656 })
1657 });
1401 let _carry = Symbol('_carry'); 1658 let _carry = Symbol('_carry');
1402 class _LineSplitterSink extends StringConversionSinkBase { 1659 class _LineSplitterSink extends StringConversionSinkBase {
1403 _LineSplitterSink(sink) { 1660 _LineSplitterSink(sink) {
1404 this[_sink] = sink; 1661 this[_sink] = sink;
1405 this[_carry] = null; 1662 this[_carry] = null;
1406 } 1663 }
1407 addSlice(chunk, start, end, isLast) { 1664 addSlice(chunk, start, end, isLast) {
1408 if (this[_carry] != null) { 1665 if (this[_carry] != null) {
1409 chunk = dart.notNull(this[_carry]) + dart.notNull(chunk.substring(start, end)); 1666 chunk = dart.notNull(this[_carry]) + dart.notNull(chunk.substring(start, end));
1410 start = 0; 1667 start = 0;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1446 let carry = chunk.substring(start, pos); 1703 let carry = chunk.substring(start, pos);
1447 if (isLast) { 1704 if (isLast) {
1448 adder(carry); 1705 adder(carry);
1449 } else { 1706 } else {
1450 return carry; 1707 return carry;
1451 } 1708 }
1452 } 1709 }
1453 return null; 1710 return null;
1454 } 1711 }
1455 } 1712 }
1713 dart.setSignature(_LineSplitterSink, {
1714 methods: () => ({
1715 addSlice: dart.functionType(dart.void, [core.String, core.int, core.int, c ore.bool]),
1716 close: dart.functionType(dart.void, [])
1717 }),
1718 statics: () => ({_addSlice: dart.functionType(core.String, [core.String, cor e.int, core.int, core.bool, dart.functionType(dart.void, [core.String])])}),
1719 names: ['_addSlice']
1720 });
1456 _LineSplitterSink._LF = 10; 1721 _LineSplitterSink._LF = 10;
1457 _LineSplitterSink._CR = 13; 1722 _LineSplitterSink._CR = 13;
1458 class StringConversionSink extends ChunkedConversionSink$(core.String) { 1723 class StringConversionSink extends ChunkedConversionSink$(core.String) {
1459 StringConversionSink() { 1724 StringConversionSink() {
1460 super.ChunkedConversionSink(); 1725 super.ChunkedConversionSink();
1461 } 1726 }
1462 withCallback(callback) { 1727 withCallback(callback) {
1463 return new _StringCallbackSink(callback); 1728 return new _StringCallbackSink(callback);
1464 } 1729 }
1465 from(sink) { 1730 from(sink) {
1466 return new _StringAdapterSink(sink); 1731 return new _StringAdapterSink(sink);
1467 } 1732 }
1468 fromStringSink(sink) { 1733 fromStringSink(sink) {
1469 return new _StringSinkConversionSink(sink); 1734 return new _StringSinkConversionSink(sink);
1470 } 1735 }
1471 } 1736 }
1472 dart.defineNamedConstructor(StringConversionSink, 'withCallback'); 1737 dart.defineNamedConstructor(StringConversionSink, 'withCallback');
1473 dart.defineNamedConstructor(StringConversionSink, 'from'); 1738 dart.defineNamedConstructor(StringConversionSink, 'from');
1474 dart.defineNamedConstructor(StringConversionSink, 'fromStringSink'); 1739 dart.defineNamedConstructor(StringConversionSink, 'fromStringSink');
1740 dart.setSignature(StringConversionSink, {});
1475 class ClosableStringSink extends core.StringSink { 1741 class ClosableStringSink extends core.StringSink {
1476 fromStringSink(sink, onClose) { 1742 fromStringSink(sink, onClose) {
1477 return new _ClosableStringSink(sink, onClose); 1743 return new _ClosableStringSink(sink, onClose);
1478 } 1744 }
1479 } 1745 }
1480 dart.defineNamedConstructor(ClosableStringSink, 'fromStringSink'); 1746 dart.defineNamedConstructor(ClosableStringSink, 'fromStringSink');
1747 dart.setSignature(ClosableStringSink, {});
1481 let _StringSinkCloseCallback = dart.typedef('_StringSinkCloseCallback', () => dart.functionType(dart.void, [])); 1748 let _StringSinkCloseCallback = dart.typedef('_StringSinkCloseCallback', () => dart.functionType(dart.void, []));
1482 class _ClosableStringSink extends core.Object { 1749 class _ClosableStringSink extends core.Object {
1483 _ClosableStringSink(sink, callback) { 1750 _ClosableStringSink(sink, callback) {
1484 this[_sink] = sink; 1751 this[_sink] = sink;
1485 this[_callback] = callback; 1752 this[_callback] = callback;
1486 } 1753 }
1487 close() { 1754 close() {
1488 return this[_callback](); 1755 return this[_callback]();
1489 } 1756 }
1490 writeCharCode(charCode) { 1757 writeCharCode(charCode) {
1491 return this[_sink].writeCharCode(charCode); 1758 return this[_sink].writeCharCode(charCode);
1492 } 1759 }
1493 write(o) { 1760 write(o) {
1494 return this[_sink].write(o); 1761 return this[_sink].write(o);
1495 } 1762 }
1496 writeln(o) { 1763 writeln(o) {
1497 if (o === void 0) 1764 if (o === void 0)
1498 o = ""; 1765 o = "";
1499 return this[_sink].writeln(o); 1766 return this[_sink].writeln(o);
1500 } 1767 }
1501 writeAll(objects, separator) { 1768 writeAll(objects, separator) {
1502 if (separator === void 0) 1769 if (separator === void 0)
1503 separator = ""; 1770 separator = "";
1504 return this[_sink].writeAll(objects, separator); 1771 return this[_sink].writeAll(objects, separator);
1505 } 1772 }
1506 } 1773 }
1507 _ClosableStringSink[dart.implements] = () => [ClosableStringSink]; 1774 _ClosableStringSink[dart.implements] = () => [ClosableStringSink];
1775 dart.setSignature(_ClosableStringSink, {
1776 methods: () => ({
1777 close: dart.functionType(dart.void, []),
1778 writeCharCode: dart.functionType(dart.void, [core.int]),
1779 write: dart.functionType(dart.void, [core.Object]),
1780 writeln: dart.functionType(dart.void, [], [core.Object]),
1781 writeAll: dart.functionType(dart.void, [core.Iterable], [core.String])
1782 })
1783 });
1508 let _flush = Symbol('_flush'); 1784 let _flush = Symbol('_flush');
1509 class _StringConversionSinkAsStringSinkAdapter extends core.Object { 1785 class _StringConversionSinkAsStringSinkAdapter extends core.Object {
1510 _StringConversionSinkAsStringSinkAdapter(chunkedSink) { 1786 _StringConversionSinkAsStringSinkAdapter(chunkedSink) {
1511 this[_chunkedSink] = chunkedSink; 1787 this[_chunkedSink] = chunkedSink;
1512 this[_buffer] = new core.StringBuffer(); 1788 this[_buffer] = new core.StringBuffer();
1513 } 1789 }
1514 close() { 1790 close() {
1515 if (this[_buffer].isNotEmpty) 1791 if (this[_buffer].isNotEmpty)
1516 this[_flush](); 1792 this[_flush]();
1517 this[_chunkedSink].close(); 1793 this[_chunkedSink].close();
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1554 } 1830 }
1555 } 1831 }
1556 } 1832 }
1557 [_flush]() { 1833 [_flush]() {
1558 let accumulated = dart.toString(this[_buffer]); 1834 let accumulated = dart.toString(this[_buffer]);
1559 this[_buffer].clear(); 1835 this[_buffer].clear();
1560 this[_chunkedSink].add(accumulated); 1836 this[_chunkedSink].add(accumulated);
1561 } 1837 }
1562 } 1838 }
1563 _StringConversionSinkAsStringSinkAdapter[dart.implements] = () => [ClosableStr ingSink]; 1839 _StringConversionSinkAsStringSinkAdapter[dart.implements] = () => [ClosableStr ingSink];
1840 dart.setSignature(_StringConversionSinkAsStringSinkAdapter, {
1841 methods: () => ({
1842 close: dart.functionType(dart.void, []),
1843 writeCharCode: dart.functionType(dart.void, [core.int]),
1844 write: dart.functionType(dart.void, [core.Object]),
1845 writeln: dart.functionType(dart.void, [], [core.Object]),
1846 writeAll: dart.functionType(dart.void, [core.Iterable], [core.String]),
1847 [_flush]: dart.functionType(dart.void, [])
1848 })
1849 });
1564 _StringConversionSinkAsStringSinkAdapter._MIN_STRING_SIZE = 16; 1850 _StringConversionSinkAsStringSinkAdapter._MIN_STRING_SIZE = 16;
1565 let _stringSink = Symbol('_stringSink'); 1851 let _stringSink = Symbol('_stringSink');
1566 class _StringSinkConversionSink extends StringConversionSinkBase { 1852 class _StringSinkConversionSink extends StringConversionSinkBase {
1567 _StringSinkConversionSink(stringSink) { 1853 _StringSinkConversionSink(stringSink) {
1568 this[_stringSink] = stringSink; 1854 this[_stringSink] = stringSink;
1569 } 1855 }
1570 close() {} 1856 close() {}
1571 addSlice(str, start, end, isLast) { 1857 addSlice(str, start, end, isLast) {
1572 if (start != 0 || end != str.length) { 1858 if (start != 0 || end != str.length) {
1573 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNul l(i) + 1) { 1859 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNul l(i) + 1) {
1574 this[_stringSink].writeCharCode(str.codeUnitAt(i)); 1860 this[_stringSink].writeCharCode(str.codeUnitAt(i));
1575 } 1861 }
1576 } else { 1862 } else {
1577 this[_stringSink].write(str); 1863 this[_stringSink].write(str);
1578 } 1864 }
1579 if (isLast) 1865 if (isLast)
1580 this.close(); 1866 this.close();
1581 } 1867 }
1582 add(str) { 1868 add(str) {
1583 return this[_stringSink].write(str); 1869 return this[_stringSink].write(str);
1584 } 1870 }
1585 asUtf8Sink(allowMalformed) { 1871 asUtf8Sink(allowMalformed) {
1586 return new _Utf8StringSinkAdapter(this, this[_stringSink], allowMalformed) ; 1872 return new _Utf8StringSinkAdapter(this, this[_stringSink], allowMalformed) ;
1587 } 1873 }
1588 asStringSink() { 1874 asStringSink() {
1589 return new ClosableStringSink.fromStringSink(this[_stringSink], this.close .bind(this)); 1875 return new ClosableStringSink.fromStringSink(this[_stringSink], this.close .bind(this));
1590 } 1876 }
1591 } 1877 }
1878 dart.setSignature(_StringSinkConversionSink, {
1879 methods: () => ({
1880 close: dart.functionType(dart.void, []),
1881 addSlice: dart.functionType(dart.void, [core.String, core.int, core.int, c ore.bool]),
1882 add: dart.functionType(dart.void, [core.String]),
1883 asUtf8Sink: dart.functionType(ByteConversionSink, [core.bool]),
1884 asStringSink: dart.functionType(ClosableStringSink, [])
1885 })
1886 });
1592 class _StringCallbackSink extends _StringSinkConversionSink { 1887 class _StringCallbackSink extends _StringSinkConversionSink {
1593 _StringCallbackSink(callback) { 1888 _StringCallbackSink(callback) {
1594 this[_callback] = callback; 1889 this[_callback] = callback;
1595 super._StringSinkConversionSink(new core.StringBuffer()); 1890 super._StringSinkConversionSink(new core.StringBuffer());
1596 } 1891 }
1597 close() { 1892 close() {
1598 let buffer = dart.as(this[_stringSink], core.StringBuffer); 1893 let buffer = dart.as(this[_stringSink], core.StringBuffer);
1599 let accumulated = dart.toString(buffer); 1894 let accumulated = dart.toString(buffer);
1600 buffer.clear(); 1895 buffer.clear();
1601 this[_callback](accumulated); 1896 this[_callback](accumulated);
1602 } 1897 }
1603 asUtf8Sink(allowMalformed) { 1898 asUtf8Sink(allowMalformed) {
1604 return new _Utf8StringSinkAdapter(this, this[_stringSink], allowMalformed) ; 1899 return new _Utf8StringSinkAdapter(this, this[_stringSink], allowMalformed) ;
1605 } 1900 }
1606 } 1901 }
1902 dart.setSignature(_StringCallbackSink, {
1903 methods: () => ({
1904 close: dart.functionType(dart.void, []),
1905 asUtf8Sink: dart.functionType(ByteConversionSink, [core.bool])
1906 })
1907 });
1607 class _StringAdapterSink extends StringConversionSinkBase { 1908 class _StringAdapterSink extends StringConversionSinkBase {
1608 _StringAdapterSink(sink) { 1909 _StringAdapterSink(sink) {
1609 this[_sink] = sink; 1910 this[_sink] = sink;
1610 } 1911 }
1611 add(str) { 1912 add(str) {
1612 return this[_sink].add(str); 1913 return this[_sink].add(str);
1613 } 1914 }
1614 addSlice(str, start, end, isLast) { 1915 addSlice(str, start, end, isLast) {
1615 if (start == 0 && end == str.length) { 1916 if (start == 0 && end == str.length) {
1616 this.add(str); 1917 this.add(str);
1617 } else { 1918 } else {
1618 this.add(str.substring(start, end)); 1919 this.add(str.substring(start, end));
1619 } 1920 }
1620 if (isLast) 1921 if (isLast)
1621 this.close(); 1922 this.close();
1622 } 1923 }
1623 close() { 1924 close() {
1624 return this[_sink].close(); 1925 return this[_sink].close();
1625 } 1926 }
1626 } 1927 }
1928 dart.setSignature(_StringAdapterSink, {
1929 methods: () => ({
1930 add: dart.functionType(dart.void, [core.String]),
1931 addSlice: dart.functionType(dart.void, [core.String, core.int, core.int, c ore.bool]),
1932 close: dart.functionType(dart.void, [])
1933 })
1934 });
1627 let _decoder = Symbol('_decoder'); 1935 let _decoder = Symbol('_decoder');
1628 class _Utf8StringSinkAdapter extends ByteConversionSink { 1936 class _Utf8StringSinkAdapter extends ByteConversionSink {
1629 _Utf8StringSinkAdapter(sink, stringSink, allowMalformed) { 1937 _Utf8StringSinkAdapter(sink, stringSink, allowMalformed) {
1630 this[_sink] = sink; 1938 this[_sink] = sink;
1631 this[_decoder] = new _Utf8Decoder(stringSink, allowMalformed); 1939 this[_decoder] = new _Utf8Decoder(stringSink, allowMalformed);
1632 super.ByteConversionSink(); 1940 super.ByteConversionSink();
1633 } 1941 }
1634 close() { 1942 close() {
1635 this[_decoder].close(); 1943 this[_decoder].close();
1636 if (this[_sink] != null) 1944 if (this[_sink] != null)
1637 this[_sink].close(); 1945 this[_sink].close();
1638 } 1946 }
1639 add(chunk) { 1947 add(chunk) {
1640 this.addSlice(chunk, 0, chunk[core.$length], false); 1948 this.addSlice(chunk, 0, chunk[core.$length], false);
1641 } 1949 }
1642 addSlice(codeUnits, startIndex, endIndex, isLast) { 1950 addSlice(codeUnits, startIndex, endIndex, isLast) {
1643 this[_decoder].convert(codeUnits, startIndex, endIndex); 1951 this[_decoder].convert(codeUnits, startIndex, endIndex);
1644 if (isLast) 1952 if (isLast)
1645 this.close(); 1953 this.close();
1646 } 1954 }
1647 } 1955 }
1956 dart.setSignature(_Utf8StringSinkAdapter, {
1957 methods: () => ({
1958 close: dart.functionType(dart.void, []),
1959 add: dart.functionType(dart.void, [core.List$(core.int)]),
1960 addSlice: dart.functionType(dart.void, [core.List$(core.int), core.int, co re.int, core.bool])
1961 })
1962 });
1648 class _Utf8ConversionSink extends ByteConversionSink { 1963 class _Utf8ConversionSink extends ByteConversionSink {
1649 _Utf8ConversionSink(sink, allowMalformed) { 1964 _Utf8ConversionSink(sink, allowMalformed) {
1650 this._(sink, new core.StringBuffer(), allowMalformed); 1965 this._(sink, new core.StringBuffer(), allowMalformed);
1651 } 1966 }
1652 _(chunkedSink, stringBuffer, allowMalformed) { 1967 _(chunkedSink, stringBuffer, allowMalformed) {
1653 this[_chunkedSink] = chunkedSink; 1968 this[_chunkedSink] = chunkedSink;
1654 this[_decoder] = new _Utf8Decoder(stringBuffer, allowMalformed); 1969 this[_decoder] = new _Utf8Decoder(stringBuffer, allowMalformed);
1655 this[_buffer] = stringBuffer; 1970 this[_buffer] = stringBuffer;
1656 super.ByteConversionSink(); 1971 super.ByteConversionSink();
1657 } 1972 }
(...skipping 16 matching lines...) Expand all
1674 let accumulated = dart.toString(this[_buffer]); 1989 let accumulated = dart.toString(this[_buffer]);
1675 this[_chunkedSink].addSlice(accumulated, 0, accumulated.length, isLast); 1990 this[_chunkedSink].addSlice(accumulated, 0, accumulated.length, isLast);
1676 this[_buffer].clear(); 1991 this[_buffer].clear();
1677 return; 1992 return;
1678 } 1993 }
1679 if (isLast) 1994 if (isLast)
1680 this.close(); 1995 this.close();
1681 } 1996 }
1682 } 1997 }
1683 dart.defineNamedConstructor(_Utf8ConversionSink, '_'); 1998 dart.defineNamedConstructor(_Utf8ConversionSink, '_');
1999 dart.setSignature(_Utf8ConversionSink, {
2000 methods: () => ({
2001 close: dart.functionType(dart.void, []),
2002 add: dart.functionType(dart.void, [core.List$(core.int)]),
2003 addSlice: dart.functionType(dart.void, [core.List$(core.int), core.int, co re.int, core.bool])
2004 })
2005 });
1684 let UNICODE_REPLACEMENT_CHARACTER_RUNE = 65533; 2006 let UNICODE_REPLACEMENT_CHARACTER_RUNE = 65533;
1685 let UNICODE_BOM_CHARACTER_RUNE = 65279; 2007 let UNICODE_BOM_CHARACTER_RUNE = 65279;
1686 let _allowMalformed = Symbol('_allowMalformed'); 2008 let _allowMalformed = Symbol('_allowMalformed');
1687 class Utf8Codec extends Encoding { 2009 class Utf8Codec extends Encoding {
1688 Utf8Codec(opts) { 2010 Utf8Codec(opts) {
1689 let allowMalformed = opts && 'allowMalformed' in opts ? opts.allowMalforme d : false; 2011 let allowMalformed = opts && 'allowMalformed' in opts ? opts.allowMalforme d : false;
1690 this[_allowMalformed] = allowMalformed; 2012 this[_allowMalformed] = allowMalformed;
1691 super.Encoding(); 2013 super.Encoding();
1692 } 2014 }
1693 get name() { 2015 get name() {
1694 return "utf-8"; 2016 return "utf-8";
1695 } 2017 }
1696 decode(codeUnits, opts) { 2018 decode(codeUnits, opts) {
1697 let allowMalformed = opts && 'allowMalformed' in opts ? opts.allowMalforme d : null; 2019 let allowMalformed = opts && 'allowMalformed' in opts ? opts.allowMalforme d : null;
1698 if (allowMalformed == null) 2020 if (allowMalformed == null)
1699 allowMalformed = this[_allowMalformed]; 2021 allowMalformed = this[_allowMalformed];
1700 return new Utf8Decoder({allowMalformed: allowMalformed}).convert(codeUnits ); 2022 return new Utf8Decoder({allowMalformed: allowMalformed}).convert(codeUnits );
1701 } 2023 }
1702 get encoder() { 2024 get encoder() {
1703 return new Utf8Encoder(); 2025 return new Utf8Encoder();
1704 } 2026 }
1705 get decoder() { 2027 get decoder() {
1706 return new Utf8Decoder({allowMalformed: this[_allowMalformed]}); 2028 return new Utf8Decoder({allowMalformed: this[_allowMalformed]});
1707 } 2029 }
1708 } 2030 }
2031 dart.setSignature(Utf8Codec, {
2032 methods: () => ({decode: dart.functionType(core.String, [core.List$(core.int )], {llowMalforme: core.bool})})
2033 });
1709 let UTF8 = dart.const(new Utf8Codec()); 2034 let UTF8 = dart.const(new Utf8Codec());
1710 let _fillBuffer = Symbol('_fillBuffer'); 2035 let _fillBuffer = Symbol('_fillBuffer');
1711 let _writeSurrogate = Symbol('_writeSurrogate'); 2036 let _writeSurrogate = Symbol('_writeSurrogate');
1712 class Utf8Encoder extends Converter$(core.String, core.List$(core.int)) { 2037 class Utf8Encoder extends Converter$(core.String, core.List$(core.int)) {
1713 Utf8Encoder() { 2038 Utf8Encoder() {
1714 super.Converter(); 2039 super.Converter();
1715 } 2040 }
1716 convert(string, start, end) { 2041 convert(string, start, end) {
1717 if (start === void 0) 2042 if (start === void 0)
1718 start = 0; 2043 start = 0;
(...skipping 20 matching lines...) Expand all
1739 startChunkedConversion(sink) { 2064 startChunkedConversion(sink) {
1740 if (!dart.is(sink, ByteConversionSink)) { 2065 if (!dart.is(sink, ByteConversionSink)) {
1741 sink = new ByteConversionSink.from(sink); 2066 sink = new ByteConversionSink.from(sink);
1742 } 2067 }
1743 return new _Utf8EncoderSink(dart.as(sink, ByteConversionSink)); 2068 return new _Utf8EncoderSink(dart.as(sink, ByteConversionSink));
1744 } 2069 }
1745 bind(stream) { 2070 bind(stream) {
1746 return super.bind(stream); 2071 return super.bind(stream);
1747 } 2072 }
1748 } 2073 }
2074 dart.setSignature(Utf8Encoder, {
2075 methods: () => ({
2076 convert: dart.functionType(core.List$(core.int), [core.String], [core.int, core.int]),
2077 startChunkedConversion: dart.functionType(StringConversionSink, [core.Sink $(core.List$(core.int))]),
2078 bind: dart.functionType(async.Stream$(core.List$(core.int)), [async.Stream $(core.String)])
2079 })
2080 });
1749 class _Utf8Encoder extends core.Object { 2081 class _Utf8Encoder extends core.Object {
1750 _Utf8Encoder() { 2082 _Utf8Encoder() {
1751 this.withBufferSize(_Utf8Encoder._DEFAULT_BYTE_BUFFER_SIZE); 2083 this.withBufferSize(_Utf8Encoder._DEFAULT_BYTE_BUFFER_SIZE);
1752 } 2084 }
1753 withBufferSize(bufferSize) { 2085 withBufferSize(bufferSize) {
1754 this[_buffer] = _Utf8Encoder._createBuffer(bufferSize); 2086 this[_buffer] = _Utf8Encoder._createBuffer(bufferSize);
1755 this[_carry] = 0; 2087 this[_carry] = 0;
1756 this[_bufferIndex] = 0; 2088 this[_bufferIndex] = 0;
1757 } 2089 }
1758 static _createBuffer(size) { 2090 static _createBuffer(size) {
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
1860 this[_bufferIndex] = dart.notNull(x) + 1; 2192 this[_bufferIndex] = dart.notNull(x) + 1;
1861 return x; 2193 return x;
1862 }).bind(this)(), 128 | dart.notNull(rune) & 63); 2194 }).bind(this)(), 128 | dart.notNull(rune) & 63);
1863 } 2195 }
1864 } 2196 }
1865 } 2197 }
1866 return stringIndex; 2198 return stringIndex;
1867 } 2199 }
1868 } 2200 }
1869 dart.defineNamedConstructor(_Utf8Encoder, 'withBufferSize'); 2201 dart.defineNamedConstructor(_Utf8Encoder, 'withBufferSize');
2202 dart.setSignature(_Utf8Encoder, {
2203 methods: () => ({
2204 [_writeSurrogate]: dart.functionType(core.bool, [core.int, core.int]),
2205 [_fillBuffer]: dart.functionType(core.int, [core.String, core.int, core.in t])
2206 }),
2207 statics: () => ({_createBuffer: dart.functionType(core.List$(core.int), [cor e.int])}),
2208 names: ['_createBuffer']
2209 });
1870 _Utf8Encoder._DEFAULT_BYTE_BUFFER_SIZE = 1024; 2210 _Utf8Encoder._DEFAULT_BYTE_BUFFER_SIZE = 1024;
1871 class _Utf8EncoderSink extends dart.mixin(_Utf8Encoder, StringConversionSinkMi xin) { 2211 class _Utf8EncoderSink extends dart.mixin(_Utf8Encoder, StringConversionSinkMi xin) {
1872 _Utf8EncoderSink(sink) { 2212 _Utf8EncoderSink(sink) {
1873 this[_sink] = sink; 2213 this[_sink] = sink;
1874 super._Utf8Encoder(); 2214 super._Utf8Encoder();
1875 } 2215 }
1876 close() { 2216 close() {
1877 if (this[_carry] != 0) { 2217 if (this[_carry] != 0) {
1878 this.addSlice("", 0, 0, true); 2218 this.addSlice("", 0, 0, true);
1879 return; 2219 return;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1911 } 2251 }
1912 start = dart.notNull(start) + 1; 2252 start = dart.notNull(start) + 1;
1913 } 2253 }
1914 this[_sink].addSlice(this[_buffer], 0, this[_bufferIndex], isLastSlice); 2254 this[_sink].addSlice(this[_buffer], 0, this[_bufferIndex], isLastSlice);
1915 this[_bufferIndex] = 0; 2255 this[_bufferIndex] = 0;
1916 } while (dart.notNull(start) < dart.notNull(end)); 2256 } while (dart.notNull(start) < dart.notNull(end));
1917 if (isLast) 2257 if (isLast)
1918 this.close(); 2258 this.close();
1919 } 2259 }
1920 } 2260 }
2261 dart.setSignature(_Utf8EncoderSink, {
2262 methods: () => ({
2263 close: dart.functionType(dart.void, []),
2264 addSlice: dart.functionType(dart.void, [core.String, core.int, core.int, c ore.bool])
2265 })
2266 });
1921 class Utf8Decoder extends Converter$(core.List$(core.int), core.String) { 2267 class Utf8Decoder extends Converter$(core.List$(core.int), core.String) {
1922 Utf8Decoder(opts) { 2268 Utf8Decoder(opts) {
1923 let allowMalformed = opts && 'allowMalformed' in opts ? opts.allowMalforme d : false; 2269 let allowMalformed = opts && 'allowMalformed' in opts ? opts.allowMalforme d : false;
1924 this[_allowMalformed] = allowMalformed; 2270 this[_allowMalformed] = allowMalformed;
1925 super.Converter(); 2271 super.Converter();
1926 } 2272 }
1927 convert(codeUnits, start, end) { 2273 convert(codeUnits, start, end) {
1928 if (start === void 0) 2274 if (start === void 0)
1929 start = 0; 2275 start = 0;
1930 if (end === void 0) 2276 if (end === void 0)
(...skipping 17 matching lines...) Expand all
1948 } 2294 }
1949 return stringSink.asUtf8Sink(this[_allowMalformed]); 2295 return stringSink.asUtf8Sink(this[_allowMalformed]);
1950 } 2296 }
1951 bind(stream) { 2297 bind(stream) {
1952 return super.bind(stream); 2298 return super.bind(stream);
1953 } 2299 }
1954 fuse(next) { 2300 fuse(next) {
1955 return super.fuse(next); 2301 return super.fuse(next);
1956 } 2302 }
1957 } 2303 }
2304 dart.setSignature(Utf8Decoder, {
2305 methods: () => ({
2306 convert: dart.functionType(core.String, [core.List$(core.int)], [core.int, core.int]),
2307 startChunkedConversion: dart.functionType(ByteConversionSink, [core.Sink$( core.String)]),
2308 bind: dart.functionType(async.Stream$(core.String), [async.Stream$(core.Li st$(core.int))]),
2309 fuse: dart.functionType(Converter$(core.List$(core.int), dart.dynamic), [C onverter$(core.String, dart.dynamic)])
2310 })
2311 });
1958 let _ONE_BYTE_LIMIT = 127; 2312 let _ONE_BYTE_LIMIT = 127;
1959 let _TWO_BYTE_LIMIT = 2047; 2313 let _TWO_BYTE_LIMIT = 2047;
1960 let _THREE_BYTE_LIMIT = 65535; 2314 let _THREE_BYTE_LIMIT = 65535;
1961 let _FOUR_BYTE_LIMIT = 1114111; 2315 let _FOUR_BYTE_LIMIT = 1114111;
1962 let _SURROGATE_MASK = 63488; 2316 let _SURROGATE_MASK = 63488;
1963 let _SURROGATE_TAG_MASK = 64512; 2317 let _SURROGATE_TAG_MASK = 64512;
1964 let _SURROGATE_VALUE_MASK = 1023; 2318 let _SURROGATE_VALUE_MASK = 1023;
1965 let _LEAD_SURROGATE_MIN = 55296; 2319 let _LEAD_SURROGATE_MIN = 55296;
1966 let _TAIL_SURROGATE_MIN = 56320; 2320 let _TAIL_SURROGATE_MIN = 56320;
1967 // Function _isSurrogate: (int) → bool
1968 function _isSurrogate(codeUnit) { 2321 function _isSurrogate(codeUnit) {
1969 return (dart.notNull(codeUnit) & dart.notNull(_SURROGATE_MASK)) == _LEAD_SUR ROGATE_MIN; 2322 return (dart.notNull(codeUnit) & dart.notNull(_SURROGATE_MASK)) == _LEAD_SUR ROGATE_MIN;
1970 } 2323 }
1971 // Function _isLeadSurrogate: (int) → bool 2324 dart.fn(_isSurrogate, core.bool, [core.int]);
1972 function _isLeadSurrogate(codeUnit) { 2325 function _isLeadSurrogate(codeUnit) {
1973 return (dart.notNull(codeUnit) & dart.notNull(_SURROGATE_TAG_MASK)) == _LEAD _SURROGATE_MIN; 2326 return (dart.notNull(codeUnit) & dart.notNull(_SURROGATE_TAG_MASK)) == _LEAD _SURROGATE_MIN;
1974 } 2327 }
1975 // Function _isTailSurrogate: (int) → bool 2328 dart.fn(_isLeadSurrogate, core.bool, [core.int]);
1976 function _isTailSurrogate(codeUnit) { 2329 function _isTailSurrogate(codeUnit) {
1977 return (dart.notNull(codeUnit) & dart.notNull(_SURROGATE_TAG_MASK)) == _TAIL _SURROGATE_MIN; 2330 return (dart.notNull(codeUnit) & dart.notNull(_SURROGATE_TAG_MASK)) == _TAIL _SURROGATE_MIN;
1978 } 2331 }
1979 // Function _combineSurrogatePair: (int, int) → int 2332 dart.fn(_isTailSurrogate, core.bool, [core.int]);
1980 function _combineSurrogatePair(lead, tail) { 2333 function _combineSurrogatePair(lead, tail) {
1981 return 65536 + ((dart.notNull(lead) & dart.notNull(_SURROGATE_VALUE_MASK)) < < 10) | dart.notNull(tail) & dart.notNull(_SURROGATE_VALUE_MASK); 2334 return 65536 + ((dart.notNull(lead) & dart.notNull(_SURROGATE_VALUE_MASK)) < < 10) | dart.notNull(tail) & dart.notNull(_SURROGATE_VALUE_MASK);
1982 } 2335 }
2336 dart.fn(_combineSurrogatePair, core.int, [core.int, core.int]);
1983 let _isFirstCharacter = Symbol('_isFirstCharacter'); 2337 let _isFirstCharacter = Symbol('_isFirstCharacter');
1984 let _value = Symbol('_value'); 2338 let _value = Symbol('_value');
1985 let _expectedUnits = Symbol('_expectedUnits'); 2339 let _expectedUnits = Symbol('_expectedUnits');
1986 let _extraUnits = Symbol('_extraUnits'); 2340 let _extraUnits = Symbol('_extraUnits');
1987 class _Utf8Decoder extends core.Object { 2341 class _Utf8Decoder extends core.Object {
1988 _Utf8Decoder(stringSink, allowMalformed) { 2342 _Utf8Decoder(stringSink, allowMalformed) {
1989 this[_stringSink] = stringSink; 2343 this[_stringSink] = stringSink;
1990 this[_allowMalformed] = allowMalformed; 2344 this[_allowMalformed] = allowMalformed;
1991 this[_isFirstCharacter] = true; 2345 this[_isFirstCharacter] = true;
1992 this[_value] = 0; 2346 this[_value] = 0;
(...skipping 17 matching lines...) Expand all
2010 this[_extraUnits] = 0; 2364 this[_extraUnits] = 0;
2011 } 2365 }
2012 } 2366 }
2013 convert(codeUnits, startIndex, endIndex) { 2367 convert(codeUnits, startIndex, endIndex) {
2014 let value = this[_value]; 2368 let value = this[_value];
2015 let expectedUnits = this[_expectedUnits]; 2369 let expectedUnits = this[_expectedUnits];
2016 let extraUnits = this[_extraUnits]; 2370 let extraUnits = this[_extraUnits];
2017 this[_value] = 0; 2371 this[_value] = 0;
2018 this[_expectedUnits] = 0; 2372 this[_expectedUnits] = 0;
2019 this[_extraUnits] = 0; 2373 this[_extraUnits] = 0;
2020 // Function scanOneByteCharacters: (dynamic, int) → int
2021 let scanOneByteCharacters = (units, from) => { 2374 let scanOneByteCharacters = (units, from) => {
2022 let to = endIndex; 2375 let to = endIndex;
2023 let mask = _ONE_BYTE_LIMIT; 2376 let mask = _ONE_BYTE_LIMIT;
2024 for (let i = from; dart.notNull(i) < dart.notNull(to); i = dart.notNull( i) + 1) { 2377 for (let i = from; dart.notNull(i) < dart.notNull(to); i = dart.notNull( i) + 1) {
2025 let unit = dart.dindex(units, i); 2378 let unit = dart.dindex(units, i);
2026 if (!dart.equals(dart.dsend(unit, '&', mask), unit)) 2379 if (!dart.equals(dart.dsend(unit, '&', mask), unit))
2027 return dart.notNull(i) - dart.notNull(from); 2380 return dart.notNull(i) - dart.notNull(from);
2028 } 2381 }
2029 return dart.notNull(to) - dart.notNull(from); 2382 return dart.notNull(to) - dart.notNull(from);
2030 }; 2383 };
2031 // Function addSingleBytes: (int, int) → void 2384 dart.fn(scanOneByteCharacters, core.int, [dart.dynamic, core.int]);
2032 let addSingleBytes = ((from, to) => { 2385 let addSingleBytes = ((from, to) => {
2033 dart.assert(dart.notNull(from) >= dart.notNull(startIndex) && dart.notNu ll(from) <= dart.notNull(endIndex)); 2386 dart.assert(dart.notNull(from) >= dart.notNull(startIndex) && dart.notNu ll(from) <= dart.notNull(endIndex));
2034 dart.assert(dart.notNull(to) >= dart.notNull(startIndex) && dart.notNull (to) <= dart.notNull(endIndex)); 2387 dart.assert(dart.notNull(to) >= dart.notNull(startIndex) && dart.notNull (to) <= dart.notNull(endIndex));
2035 this[_stringSink].write(new core.String.fromCharCodes(codeUnits, from, t o)); 2388 this[_stringSink].write(new core.String.fromCharCodes(codeUnits, from, t o));
2036 }).bind(this); 2389 }).bind(this);
2390 dart.fn(addSingleBytes, dart.void, [core.int, core.int]);
2037 let i = startIndex; 2391 let i = startIndex;
2038 loop: 2392 loop:
2039 while (true) { 2393 while (true) {
2040 multibyte: 2394 multibyte:
2041 if (dart.notNull(expectedUnits) > 0) { 2395 if (dart.notNull(expectedUnits) > 0) {
2042 do { 2396 do {
2043 if (i == endIndex) { 2397 if (i == endIndex) {
2044 break loop; 2398 break loop;
2045 } 2399 }
2046 let unit = codeUnits[core.$get](i); 2400 let unit = codeUnits[core.$get](i);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
2123 } 2477 }
2124 break loop; 2478 break loop;
2125 } 2479 }
2126 if (dart.notNull(expectedUnits) > 0) { 2480 if (dart.notNull(expectedUnits) > 0) {
2127 this[_value] = value; 2481 this[_value] = value;
2128 this[_expectedUnits] = expectedUnits; 2482 this[_expectedUnits] = expectedUnits;
2129 this[_extraUnits] = extraUnits; 2483 this[_extraUnits] = extraUnits;
2130 } 2484 }
2131 } 2485 }
2132 } 2486 }
2487 dart.setSignature(_Utf8Decoder, {
2488 methods: () => ({
2489 close: dart.functionType(dart.void, []),
2490 flush: dart.functionType(dart.void, []),
2491 convert: dart.functionType(dart.void, [core.List$(core.int), core.int, cor e.int])
2492 })
2493 });
2133 _Utf8Decoder._LIMITS = dart.const(dart.setType([_ONE_BYTE_LIMIT, _TWO_BYTE_LIM IT, _THREE_BYTE_LIMIT, _FOUR_BYTE_LIMIT], core.List$(core.int))); 2494 _Utf8Decoder._LIMITS = dart.const(dart.setType([_ONE_BYTE_LIMIT, _TWO_BYTE_LIM IT, _THREE_BYTE_LIMIT, _FOUR_BYTE_LIMIT], core.List$(core.int)));
2134 let _processed = Symbol('_processed'); 2495 let _processed = Symbol('_processed');
2135 let _computeKeys = Symbol('_computeKeys'); 2496 let _computeKeys = Symbol('_computeKeys');
2136 let _original = Symbol('_original'); 2497 let _original = Symbol('_original');
2137 // Function _convertJsonToDart: (dynamic, (dynamic, dynamic) → dynamic) → dyna mic
2138 function _convertJsonToDart(json, reviver) { 2498 function _convertJsonToDart(json, reviver) {
2139 dart.assert(reviver != null); 2499 dart.assert(reviver != null);
2140 // Function walk: (dynamic) → dynamic
2141 let walk = e => { 2500 let walk = e => {
2142 if (e == null || typeof e != "object") { 2501 if (e == null || typeof e != "object") {
2143 return e; 2502 return e;
2144 } 2503 }
2145 if (Object.getPrototypeOf(e) === Array.prototype) { 2504 if (Object.getPrototypeOf(e) === Array.prototype) {
2146 for (let i = 0; dart.notNull(i) < e.length; i = dart.notNull(i) + 1) { 2505 for (let i = 0; dart.notNull(i) < e.length; i = dart.notNull(i) + 1) {
2147 let item = e[i]; 2506 let item = e[i];
2148 e[i] = dart.dcall(reviver, i, walk(item)); 2507 e[i] = dart.dcall(reviver, i, walk(item));
2149 } 2508 }
2150 return e; 2509 return e;
2151 } 2510 }
2152 let map = new _JsonMap(e); 2511 let map = new _JsonMap(e);
2153 let processed = map[_processed]; 2512 let processed = map[_processed];
2154 let keys = map[_computeKeys](); 2513 let keys = map[_computeKeys]();
2155 for (let i = 0; dart.notNull(i) < dart.notNull(keys[core.$length]); i = da rt.notNull(i) + 1) { 2514 for (let i = 0; dart.notNull(i) < dart.notNull(keys[core.$length]); i = da rt.notNull(i) + 1) {
2156 let key = keys[core.$get](i); 2515 let key = keys[core.$get](i);
2157 let revived = dart.dcall(reviver, key, walk(e[key])); 2516 let revived = dart.dcall(reviver, key, walk(e[key]));
2158 processed[key] = revived; 2517 processed[key] = revived;
2159 } 2518 }
2160 map[_original] = processed; 2519 map[_original] = processed;
2161 return map; 2520 return map;
2162 }; 2521 };
2522 dart.fn(walk);
2163 return dart.dcall(reviver, null, walk(json)); 2523 return dart.dcall(reviver, null, walk(json));
2164 } 2524 }
2165 // Function _convertJsonToDartLazy: (dynamic) → dynamic 2525 dart.fn(_convertJsonToDart, dart.dynamic, [dart.dynamic, dart.functionType(dar t.dynamic, [dart.dynamic, dart.dynamic])]);
2166 function _convertJsonToDartLazy(object) { 2526 function _convertJsonToDartLazy(object) {
2167 if (object == null) 2527 if (object == null)
2168 return null; 2528 return null;
2169 if (typeof object != "object") { 2529 if (typeof object != "object") {
2170 return object; 2530 return object;
2171 } 2531 }
2172 if (Object.getPrototypeOf(object) !== Array.prototype) { 2532 if (Object.getPrototypeOf(object) !== Array.prototype) {
2173 return new _JsonMap(object); 2533 return new _JsonMap(object);
2174 } 2534 }
2175 for (let i = 0; dart.notNull(i) < object.length; i = dart.notNull(i) + 1) { 2535 for (let i = 0; dart.notNull(i) < object.length; i = dart.notNull(i) + 1) {
2176 let item = object[i]; 2536 let item = object[i];
2177 object[i] = _convertJsonToDartLazy(item); 2537 object[i] = _convertJsonToDartLazy(item);
2178 } 2538 }
2179 return object; 2539 return object;
2180 } 2540 }
2541 dart.fn(_convertJsonToDartLazy);
2181 let _data = Symbol('_data'); 2542 let _data = Symbol('_data');
2182 let _isUpgraded = Symbol('_isUpgraded'); 2543 let _isUpgraded = Symbol('_isUpgraded');
2183 let _upgradedMap = Symbol('_upgradedMap'); 2544 let _upgradedMap = Symbol('_upgradedMap');
2184 let _process = Symbol('_process'); 2545 let _process = Symbol('_process');
2185 let _upgrade = Symbol('_upgrade'); 2546 let _upgrade = Symbol('_upgrade');
2186 class _JsonMap extends core.Object { 2547 class _JsonMap extends core.Object {
2187 _JsonMap(original) { 2548 _JsonMap(original) {
2188 this[_processed] = _JsonMap._newJavaScriptObject(); 2549 this[_processed] = _JsonMap._newJavaScriptObject();
2189 this[_original] = original; 2550 this[_original] = original;
2190 this[_data] = null; 2551 this[_data] = null;
(...skipping 20 matching lines...) Expand all
2211 return dart.notNull(this.length) > 0; 2572 return dart.notNull(this.length) > 0;
2212 } 2573 }
2213 get keys() { 2574 get keys() {
2214 if (this[_isUpgraded]) 2575 if (this[_isUpgraded])
2215 return this[_upgradedMap].keys; 2576 return this[_upgradedMap].keys;
2216 return new _JsonMapKeyIterable(this); 2577 return new _JsonMapKeyIterable(this);
2217 } 2578 }
2218 get values() { 2579 get values() {
2219 if (this[_isUpgraded]) 2580 if (this[_isUpgraded])
2220 return this[_upgradedMap].values; 2581 return this[_upgradedMap].values;
2221 return new _internal.MappedIterable(this[_computeKeys](), (each => this.ge t(each)).bind(this)); 2582 return new _internal.MappedIterable(this[_computeKeys](), dart.fn((each => this.get(each)).bind(this)));
2222 } 2583 }
2223 set(key, value) { 2584 set(key, value) {
2224 if (this[_isUpgraded]) { 2585 if (this[_isUpgraded]) {
2225 this[_upgradedMap].set(key, value); 2586 this[_upgradedMap].set(key, value);
2226 } else if (this.containsKey(key)) { 2587 } else if (this.containsKey(key)) {
2227 let processed = this[_processed]; 2588 let processed = this[_processed];
2228 _JsonMap._setProperty(processed, dart.as(key, core.String), value); 2589 _JsonMap._setProperty(processed, dart.as(key, core.String), value);
2229 let original = this[_original]; 2590 let original = this[_original];
2230 if (!dart.notNull(core.identical(original, processed))) { 2591 if (!dart.notNull(core.identical(original, processed))) {
2231 _JsonMap._setProperty(original, dart.as(key, core.String), null); 2592 _JsonMap._setProperty(original, dart.as(key, core.String), null);
2232 } 2593 }
2233 } else { 2594 } else {
2234 this[_upgrade]().set(key, value); 2595 this[_upgrade]().set(key, value);
2235 } 2596 }
2236 } 2597 }
2237 addAll(other) { 2598 addAll(other) {
2238 other.forEach(((key, value) => { 2599 other.forEach(dart.fn(((key, value) => {
2239 this.set(key, value); 2600 this.set(key, value);
2240 }).bind(this)); 2601 }).bind(this)));
2241 } 2602 }
2242 containsValue(value) { 2603 containsValue(value) {
2243 if (this[_isUpgraded]) 2604 if (this[_isUpgraded])
2244 return this[_upgradedMap].containsValue(value); 2605 return this[_upgradedMap].containsValue(value);
2245 let keys = this[_computeKeys](); 2606 let keys = this[_computeKeys]();
2246 for (let i = 0; dart.notNull(i) < dart.notNull(keys[core.$length]); i = da rt.notNull(i) + 1) { 2607 for (let i = 0; dart.notNull(i) < dart.notNull(keys[core.$length]); i = da rt.notNull(i) + 1) {
2247 let key = keys[core.$get](i); 2608 let key = keys[core.$get](i);
2248 if (dart.equals(this.get(key), value)) 2609 if (dart.equals(this.get(key), value))
2249 return true; 2610 return true;
2250 } 2611 }
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
2353 return dart.as(Object.keys(object), core.List); 2714 return dart.as(Object.keys(object), core.List);
2354 } 2715 }
2355 static _isUnprocessed(object) { 2716 static _isUnprocessed(object) {
2356 return typeof object == "undefined"; 2717 return typeof object == "undefined";
2357 } 2718 }
2358 static _newJavaScriptObject() { 2719 static _newJavaScriptObject() {
2359 return Object.create(null); 2720 return Object.create(null);
2360 } 2721 }
2361 } 2722 }
2362 _JsonMap[dart.implements] = () => [collection.LinkedHashMap]; 2723 _JsonMap[dart.implements] = () => [collection.LinkedHashMap];
2724 dart.setSignature(_JsonMap, {
2725 methods: () => ({
2726 get: dart.functionType(dart.dynamic, [core.Object]),
2727 set: dart.functionType(dart.void, [dart.dynamic, dart.dynamic]),
2728 addAll: dart.functionType(dart.void, [core.Map]),
2729 containsValue: dart.functionType(core.bool, [core.Object]),
2730 containsKey: dart.functionType(core.bool, [core.Object]),
2731 putIfAbsent: dart.functionType(dart.dynamic, [dart.dynamic, dart.functionT ype(dart.dynamic, [])]),
2732 remove: dart.functionType(dart.dynamic, [core.Object]),
2733 clear: dart.functionType(dart.void, []),
2734 forEach: dart.functionType(dart.void, [dart.functionType(dart.void, [dart. dynamic, dart.dynamic])]),
2735 toString: dart.functionType(core.String, []),
2736 [_computeKeys]: dart.functionType(core.List$(core.String), []),
2737 [_upgrade]: dart.functionType(core.Map, []),
2738 [_process]: dart.functionType(dart.dynamic, [core.String])
2739 }),
2740 statics: () => ({
2741 _hasProperty: dart.functionType(core.bool, [dart.dynamic, core.String]),
2742 _getProperty: dart.functionType(dart.dynamic, [dart.dynamic, core.String]) ,
2743 _setProperty: dart.functionType(dart.dynamic, [dart.dynamic, core.String, dart.dynamic]),
2744 _getPropertyNames: dart.functionType(core.List, [dart.dynamic]),
2745 _isUnprocessed: dart.functionType(core.bool, [dart.dynamic]),
2746 _newJavaScriptObject: dart.functionType(dart.dynamic, [])
2747 }),
2748 names: ['_hasProperty', '_getProperty', '_setProperty', '_getPropertyNames', '_isUnprocessed', '_newJavaScriptObject']
2749 });
2363 let _parent = Symbol('_parent'); 2750 let _parent = Symbol('_parent');
2364 class _JsonMapKeyIterable extends _internal.ListIterable { 2751 class _JsonMapKeyIterable extends _internal.ListIterable {
2365 _JsonMapKeyIterable(parent) { 2752 _JsonMapKeyIterable(parent) {
2366 this[_parent] = parent; 2753 this[_parent] = parent;
2367 super.ListIterable(); 2754 super.ListIterable();
2368 } 2755 }
2369 get [core.$length]() { 2756 get [core.$length]() {
2370 return this[_parent].length; 2757 return this[_parent].length;
2371 } 2758 }
2372 [core.$elementAt](index) { 2759 [core.$elementAt](index) {
2373 return this[_parent][_isUpgraded] ? dart.as(this[_parent].keys[core.$eleme ntAt](index), core.String) : this[_parent][_computeKeys]()[core.$get](index); 2760 return this[_parent][_isUpgraded] ? dart.as(this[_parent].keys[core.$eleme ntAt](index), core.String) : this[_parent][_computeKeys]()[core.$get](index);
2374 } 2761 }
2375 get [core.$iterator]() { 2762 get [core.$iterator]() {
2376 return this[_parent][_isUpgraded] ? this[_parent].keys[core.$iterator] : t his[_parent][_computeKeys]()[core.$iterator]; 2763 return this[_parent][_isUpgraded] ? this[_parent].keys[core.$iterator] : t his[_parent][_computeKeys]()[core.$iterator];
2377 } 2764 }
2378 [core.$contains](key) { 2765 [core.$contains](key) {
2379 return this[_parent].containsKey(key); 2766 return this[_parent].containsKey(key);
2380 } 2767 }
2381 } 2768 }
2769 dart.setSignature(_JsonMapKeyIterable, {
2770 methods: () => ({
2771 [core.$elementAt]: dart.functionType(core.String, [core.int]),
2772 [core.$contains]: dart.functionType(core.bool, [core.Object])
2773 })
2774 });
2382 class _JsonDecoderSink extends _StringSinkConversionSink { 2775 class _JsonDecoderSink extends _StringSinkConversionSink {
2383 _JsonDecoderSink(reviver, sink) { 2776 _JsonDecoderSink(reviver, sink) {
2384 this[_reviver] = reviver; 2777 this[_reviver] = reviver;
2385 this[_sink] = sink; 2778 this[_sink] = sink;
2386 super._StringSinkConversionSink(new core.StringBuffer()); 2779 super._StringSinkConversionSink(new core.StringBuffer());
2387 } 2780 }
2388 close() { 2781 close() {
2389 super.close(); 2782 super.close();
2390 let buffer = dart.as(this[_stringSink], core.StringBuffer); 2783 let buffer = dart.as(this[_stringSink], core.StringBuffer);
2391 let accumulated = dart.toString(buffer); 2784 let accumulated = dart.toString(buffer);
2392 buffer.clear(); 2785 buffer.clear();
2393 let decoded = _parseJson(accumulated, this[_reviver]); 2786 let decoded = _parseJson(accumulated, this[_reviver]);
2394 this[_sink].add(decoded); 2787 this[_sink].add(decoded);
2395 this[_sink].close(); 2788 this[_sink].close();
2396 } 2789 }
2397 } 2790 }
2791 dart.setSignature(_JsonDecoderSink, {
2792 methods: () => ({close: dart.functionType(dart.void, [])})
2793 });
2398 // Exports: 2794 // Exports:
2399 exports.Codec$ = Codec$; 2795 exports.Codec$ = Codec$;
2400 exports.Codec = Codec; 2796 exports.Codec = Codec;
2401 exports.Encoding = Encoding; 2797 exports.Encoding = Encoding;
2402 exports.AsciiCodec = AsciiCodec; 2798 exports.AsciiCodec = AsciiCodec;
2403 exports.ASCII = ASCII; 2799 exports.ASCII = ASCII;
2404 exports.Converter$ = Converter$; 2800 exports.Converter$ = Converter$;
2405 exports.Converter = Converter; 2801 exports.Converter = Converter;
2406 exports.AsciiEncoder = AsciiEncoder; 2802 exports.AsciiEncoder = AsciiEncoder;
2407 exports.StringConversionSinkMixin = StringConversionSinkMixin; 2803 exports.StringConversionSinkMixin = StringConversionSinkMixin;
(...skipping 20 matching lines...) Expand all
2428 exports.LineSplitter = LineSplitter; 2824 exports.LineSplitter = LineSplitter;
2429 exports.StringConversionSink = StringConversionSink; 2825 exports.StringConversionSink = StringConversionSink;
2430 exports.ClosableStringSink = ClosableStringSink; 2826 exports.ClosableStringSink = ClosableStringSink;
2431 exports.UNICODE_REPLACEMENT_CHARACTER_RUNE = UNICODE_REPLACEMENT_CHARACTER_RUN E; 2827 exports.UNICODE_REPLACEMENT_CHARACTER_RUNE = UNICODE_REPLACEMENT_CHARACTER_RUN E;
2432 exports.UNICODE_BOM_CHARACTER_RUNE = UNICODE_BOM_CHARACTER_RUNE; 2828 exports.UNICODE_BOM_CHARACTER_RUNE = UNICODE_BOM_CHARACTER_RUNE;
2433 exports.Utf8Codec = Utf8Codec; 2829 exports.Utf8Codec = Utf8Codec;
2434 exports.UTF8 = UTF8; 2830 exports.UTF8 = UTF8;
2435 exports.Utf8Encoder = Utf8Encoder; 2831 exports.Utf8Encoder = Utf8Encoder;
2436 exports.Utf8Decoder = Utf8Decoder; 2832 exports.Utf8Decoder = Utf8Decoder;
2437 })(convert, core, async, typed_data, _internal, collection); 2833 })(convert, core, async, typed_data, _internal, collection);
OLDNEW
« no previous file with comments | « lib/runtime/dart/collection.js ('k') | lib/runtime/dart/core.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698