OLD | NEW |
1 var convert; | 1 var convert; |
2 (function(exports) { | 2 (function(exports) { |
3 'use strict'; | 3 'use strict'; |
4 let ASCII = new AsciiCodec(); | 4 let ASCII = new AsciiCodec(); |
5 let _ASCII_MASK = 127; | 5 let _ASCII_MASK = 127; |
6 let _allowInvalid = Symbol('_allowInvalid'); | 6 let _allowInvalid = Symbol('_allowInvalid'); |
7 let Codec$ = dart.generic(function(S, T) { | 7 let Codec$ = dart.generic(function(S, T) { |
8 class Codec extends core.Object { | 8 class Codec extends core.Object { |
9 Codec() { | 9 Codec() { |
10 } | 10 } |
(...skipping 27 matching lines...) Expand all Loading... |
38 return _nameToEncoding.get(name); | 38 return _nameToEncoding.get(name); |
39 } | 39 } |
40 } | 40 } |
41 dart.defineLazyProperties(Encoding, { | 41 dart.defineLazyProperties(Encoding, { |
42 get _nameToEncoding() { | 42 get _nameToEncoding() { |
43 return dart.map({"iso_8859-1:1987": LATIN1, "iso-ir-100": LATIN1, "iso_885
9-1": LATIN1, "iso-8859-1": LATIN1, latin1: LATIN1, l1: LATIN1, ibm819: LATIN1,
cp819: LATIN1, csisolatin1: LATIN1, "iso-ir-6": ASCII, "ansi_x3.4-1968": ASCII,
"ansi_x3.4-1986": ASCII, "iso_646.irv:1991": ASCII, "iso646-us": ASCII, "us-asci
i": ASCII, us: ASCII, ibm367: ASCII, cp367: ASCII, csascii: ASCII, ascii: ASCII,
csutf8: UTF8, "utf-8": UTF8}); | 43 return dart.map({"iso_8859-1:1987": LATIN1, "iso-ir-100": LATIN1, "iso_885
9-1": LATIN1, "iso-8859-1": LATIN1, latin1: LATIN1, l1: LATIN1, ibm819: LATIN1,
cp819: LATIN1, csisolatin1: LATIN1, "iso-ir-6": ASCII, "ansi_x3.4-1968": ASCII,
"ansi_x3.4-1986": ASCII, "iso_646.irv:1991": ASCII, "iso646-us": ASCII, "us-asci
i": ASCII, us: ASCII, ibm367: ASCII, cp367: ASCII, csascii: ASCII, ascii: ASCII,
csutf8: UTF8, "utf-8": UTF8}); |
44 }, | 44 }, |
45 set _nameToEncoding(_) {} | 45 set _nameToEncoding(_) {} |
46 }); | 46 }); |
47 class AsciiCodec extends Encoding { | 47 class AsciiCodec extends Encoding { |
48 AsciiCodec(opt$) { | 48 AsciiCodec(opts) { |
49 let allowInvalid = opt$ && 'allowInvalid' in opt$ ? opt$.allowInvalid : fa
lse; | 49 let allowInvalid = opts && 'allowInvalid' in opts ? opts.allowInvalid : fa
lse; |
50 this[_allowInvalid] = allowInvalid; | 50 this[_allowInvalid] = allowInvalid; |
51 super.Encoding(); | 51 super.Encoding(); |
52 } | 52 } |
53 get name() { | 53 get name() { |
54 return "us-ascii"; | 54 return "us-ascii"; |
55 } | 55 } |
56 decode(bytes, opt$) { | 56 decode(bytes, opts) { |
57 let allowInvalid = opt$ && 'allowInvalid' in opt$ ? opt$.allowInvalid : nu
ll; | 57 let allowInvalid = opts && 'allowInvalid' in opts ? opts.allowInvalid : nu
ll; |
58 if (allowInvalid === null) | 58 if (allowInvalid === null) |
59 allowInvalid = this[_allowInvalid]; | 59 allowInvalid = this[_allowInvalid]; |
60 if (allowInvalid) { | 60 if (allowInvalid) { |
61 return new AsciiDecoder({allowInvalid: true}).convert(bytes); | 61 return new AsciiDecoder({allowInvalid: true}).convert(bytes); |
62 } else { | 62 } else { |
63 return new AsciiDecoder({allowInvalid: false}).convert(bytes); | 63 return new AsciiDecoder({allowInvalid: false}).convert(bytes); |
64 } | 64 } |
65 } | 65 } |
66 get encoder() { | 66 get encoder() { |
67 return new AsciiEncoder(); | 67 return new AsciiEncoder(); |
(...skipping 14 matching lines...) Expand all Loading... |
82 throw new core.UnsupportedError(`This converter does not support chunked
conversions: ${this}`); | 82 throw new core.UnsupportedError(`This converter does not support chunked
conversions: ${this}`); |
83 } | 83 } |
84 bind(source) { | 84 bind(source) { |
85 return new async.Stream.eventTransformed(source, ((sink) => new _Convert
erStreamEventSink(this, sink)).bind(this)); | 85 return new async.Stream.eventTransformed(source, ((sink) => new _Convert
erStreamEventSink(this, sink)).bind(this)); |
86 } | 86 } |
87 } | 87 } |
88 return Converter; | 88 return Converter; |
89 }); | 89 }); |
90 let Converter = Converter$(dart.dynamic, dart.dynamic); | 90 let Converter = Converter$(dart.dynamic, dart.dynamic); |
91 class _UnicodeSubsetEncoder extends Converter$(core.String, core.List$(core.in
t)) { | 91 class _UnicodeSubsetEncoder extends Converter$(core.String, core.List$(core.in
t)) { |
92 _UnicodeSubsetEncoder($_subsetMask) { | 92 _UnicodeSubsetEncoder(subsetMask) { |
93 this[_subsetMask] = $_subsetMask; | 93 this[_subsetMask] = subsetMask; |
94 super.Converter(); | 94 super.Converter(); |
95 } | 95 } |
96 convert(string, start, end) { | 96 convert(string, start, end) { |
97 if (start === void 0) | 97 if (start === void 0) |
98 start = 0; | 98 start = 0; |
99 if (end === void 0) | 99 if (end === void 0) |
100 end = null; | 100 end = null; |
101 let stringLength = string.length; | 101 let stringLength = string.length; |
102 core.RangeError.checkValidRange(start, end, stringLength); | 102 core.RangeError.checkValidRange(start, end, stringLength); |
103 if (end === null) | 103 if (end === null) |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 asUtf8Sink(allowMalformed) { | 136 asUtf8Sink(allowMalformed) { |
137 return new _Utf8ConversionSink(this, allowMalformed); | 137 return new _Utf8ConversionSink(this, allowMalformed); |
138 } | 138 } |
139 asStringSink() { | 139 asStringSink() { |
140 return new _StringConversionSinkAsStringSinkAdapter(this); | 140 return new _StringConversionSinkAsStringSinkAdapter(this); |
141 } | 141 } |
142 } | 142 } |
143 class StringConversionSinkBase extends StringConversionSinkMixin { | 143 class StringConversionSinkBase extends StringConversionSinkMixin { |
144 } | 144 } |
145 class _UnicodeSubsetEncoderSink extends StringConversionSinkBase { | 145 class _UnicodeSubsetEncoderSink extends StringConversionSinkBase { |
146 _UnicodeSubsetEncoderSink($_subsetMask, $_sink) { | 146 _UnicodeSubsetEncoderSink(subsetMask, sink$) { |
147 this[_subsetMask] = $_subsetMask; | 147 this[_subsetMask] = subsetMask; |
148 this[_sink] = $_sink; | 148 this[_sink] = sink$; |
149 super.StringConversionSinkBase(); | 149 super.StringConversionSinkBase(); |
150 } | 150 } |
151 close() { | 151 close() { |
152 this[_sink].close(); | 152 this[_sink].close(); |
153 } | 153 } |
154 addSlice(source, start, end, isLast) { | 154 addSlice(source, start, end, isLast) { |
155 core.RangeError.checkValidRange(start, end, source.length); | 155 core.RangeError.checkValidRange(start, end, source.length); |
156 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { | 156 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { |
157 let codeUnit = source.codeUnitAt(i); | 157 let codeUnit = source.codeUnitAt(i); |
158 if ((dart.notNull(codeUnit) & ~dart.notNull(this[_subsetMask])) !== 0) { | 158 if ((dart.notNull(codeUnit) & ~dart.notNull(this[_subsetMask])) !== 0) { |
159 throw new core.ArgumentError(`Source contains invalid character with c
ode point: ${codeUnit}.`); | 159 throw new core.ArgumentError(`Source contains invalid character with c
ode point: ${codeUnit}.`); |
160 } | 160 } |
161 } | 161 } |
162 this[_sink].add(source.codeUnits.sublist(start, end)); | 162 this[_sink].add(source.codeUnits.sublist(start, end)); |
163 if (isLast) { | 163 if (isLast) { |
164 this.close(); | 164 this.close(); |
165 } | 165 } |
166 } | 166 } |
167 } | 167 } |
168 let _convertInvalid = Symbol('_convertInvalid'); | 168 let _convertInvalid = Symbol('_convertInvalid'); |
169 class _UnicodeSubsetDecoder extends Converter$(core.List$(core.int), core.Stri
ng) { | 169 class _UnicodeSubsetDecoder extends Converter$(core.List$(core.int), core.Stri
ng) { |
170 _UnicodeSubsetDecoder($_allowInvalid, $_subsetMask) { | 170 _UnicodeSubsetDecoder(allowInvalid$, subsetMask) { |
171 this[_allowInvalid] = $_allowInvalid; | 171 this[_allowInvalid] = allowInvalid$; |
172 this[_subsetMask] = $_subsetMask; | 172 this[_subsetMask] = subsetMask; |
173 super.Converter(); | 173 super.Converter(); |
174 } | 174 } |
175 convert(bytes, start, end) { | 175 convert(bytes, start, end) { |
176 if (start === void 0) | 176 if (start === void 0) |
177 start = 0; | 177 start = 0; |
178 if (end === void 0) | 178 if (end === void 0) |
179 end = null; | 179 end = null; |
180 let byteCount = bytes.length; | 180 let byteCount = bytes.length; |
181 core.RangeError.checkValidRange(start, end, byteCount); | 181 core.RangeError.checkValidRange(start, end, byteCount); |
182 if (end === null) | 182 if (end === null) |
(...skipping 18 matching lines...) Expand all Loading... |
201 value = 65533; | 201 value = 65533; |
202 buffer.writeCharCode(value); | 202 buffer.writeCharCode(value); |
203 } | 203 } |
204 return buffer.toString(); | 204 return buffer.toString(); |
205 } | 205 } |
206 bind(stream) { | 206 bind(stream) { |
207 return dart.as(super.bind(stream), async.Stream$(core.String)); | 207 return dart.as(super.bind(stream), async.Stream$(core.String)); |
208 } | 208 } |
209 } | 209 } |
210 class AsciiDecoder extends _UnicodeSubsetDecoder { | 210 class AsciiDecoder extends _UnicodeSubsetDecoder { |
211 AsciiDecoder(opt$) { | 211 AsciiDecoder(opts) { |
212 let allowInvalid = opt$ && 'allowInvalid' in opt$ ? opt$.allowInvalid : fa
lse; | 212 let allowInvalid = opts && 'allowInvalid' in opts ? opts.allowInvalid : fa
lse; |
213 super._UnicodeSubsetDecoder(allowInvalid, _ASCII_MASK); | 213 super._UnicodeSubsetDecoder(allowInvalid, _ASCII_MASK); |
214 } | 214 } |
215 startChunkedConversion(sink) { | 215 startChunkedConversion(sink) { |
216 let stringSink = null; | 216 let stringSink = null; |
217 if (dart.is(sink, StringConversionSink)) { | 217 if (dart.is(sink, StringConversionSink)) { |
218 stringSink = sink; | 218 stringSink = sink; |
219 } else { | 219 } else { |
220 stringSink = new StringConversionSink.from(sink); | 220 stringSink = new StringConversionSink.from(sink); |
221 } | 221 } |
222 if (this[_allowInvalid]) { | 222 if (this[_allowInvalid]) { |
(...skipping 30 matching lines...) Expand all Loading... |
253 dart.defineNamedConstructor(ByteConversionSink, 'withCallback'); | 253 dart.defineNamedConstructor(ByteConversionSink, 'withCallback'); |
254 dart.defineNamedConstructor(ByteConversionSink, 'from'); | 254 dart.defineNamedConstructor(ByteConversionSink, 'from'); |
255 class ByteConversionSinkBase extends ByteConversionSink { | 255 class ByteConversionSinkBase extends ByteConversionSink { |
256 addSlice(chunk, start, end, isLast) { | 256 addSlice(chunk, start, end, isLast) { |
257 this.add(chunk.sublist(start, end)); | 257 this.add(chunk.sublist(start, end)); |
258 if (isLast) | 258 if (isLast) |
259 this.close(); | 259 this.close(); |
260 } | 260 } |
261 } | 261 } |
262 class _ErrorHandlingAsciiDecoderSink extends ByteConversionSinkBase { | 262 class _ErrorHandlingAsciiDecoderSink extends ByteConversionSinkBase { |
263 _ErrorHandlingAsciiDecoderSink($_utf8Sink) { | 263 _ErrorHandlingAsciiDecoderSink(utf8Sink) { |
264 this[_utf8Sink] = $_utf8Sink; | 264 this[_utf8Sink] = utf8Sink; |
265 super.ByteConversionSinkBase(); | 265 super.ByteConversionSinkBase(); |
266 } | 266 } |
267 close() { | 267 close() { |
268 this[_utf8Sink].close(); | 268 this[_utf8Sink].close(); |
269 } | 269 } |
270 add(source) { | 270 add(source) { |
271 this.addSlice(source, 0, source.length, false); | 271 this.addSlice(source, 0, source.length, false); |
272 } | 272 } |
273 addSlice(source, start, end, isLast) { | 273 addSlice(source, start, end, isLast) { |
274 core.RangeError.checkValidRange(start, end, source.length); | 274 core.RangeError.checkValidRange(start, end, source.length); |
275 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { | 275 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { |
276 if ((dart.notNull(source.get(i)) & ~dart.notNull(_ASCII_MASK)) !== 0) { | 276 if ((dart.notNull(source.get(i)) & ~dart.notNull(_ASCII_MASK)) !== 0) { |
277 if (dart.notNull(i) > dart.notNull(start)) | 277 if (dart.notNull(i) > dart.notNull(start)) |
278 this[_utf8Sink].addSlice(source, start, i, false); | 278 this[_utf8Sink].addSlice(source, start, i, false); |
279 this[_utf8Sink].add(/* Unimplemented const */new List.from([239, 191,
189])); | 279 this[_utf8Sink].add(/* Unimplemented const */new List.from([239, 191,
189])); |
280 start = dart.notNull(i) + 1; | 280 start = dart.notNull(i) + 1; |
281 } | 281 } |
282 } | 282 } |
283 if (dart.notNull(start) < dart.notNull(end)) { | 283 if (dart.notNull(start) < dart.notNull(end)) { |
284 this[_utf8Sink].addSlice(source, start, end, isLast); | 284 this[_utf8Sink].addSlice(source, start, end, isLast); |
285 } else if (isLast) { | 285 } else if (isLast) { |
286 this.close(); | 286 this.close(); |
287 } | 287 } |
288 } | 288 } |
289 } | 289 } |
290 class _SimpleAsciiDecoderSink extends ByteConversionSinkBase { | 290 class _SimpleAsciiDecoderSink extends ByteConversionSinkBase { |
291 _SimpleAsciiDecoderSink($_sink) { | 291 _SimpleAsciiDecoderSink(sink$) { |
292 this[_sink] = $_sink; | 292 this[_sink] = sink$; |
293 super.ByteConversionSinkBase(); | 293 super.ByteConversionSinkBase(); |
294 } | 294 } |
295 close() { | 295 close() { |
296 this[_sink].close(); | 296 this[_sink].close(); |
297 } | 297 } |
298 add(source) { | 298 add(source) { |
299 for (let i = 0; dart.notNull(i) < dart.notNull(source.length); i = dart.no
tNull(i) + 1) { | 299 for (let i = 0; dart.notNull(i) < dart.notNull(source.length); i = dart.no
tNull(i) + 1) { |
300 if ((dart.notNull(source.get(i)) & ~dart.notNull(_ASCII_MASK)) !== 0) { | 300 if ((dart.notNull(source.get(i)) & ~dart.notNull(_ASCII_MASK)) !== 0) { |
301 throw new core.FormatException("Source contains non-ASCII bytes."); | 301 throw new core.FormatException("Source contains non-ASCII bytes."); |
302 } | 302 } |
303 } | 303 } |
304 this[_sink].add(new core.String.fromCharCodes(source)); | 304 this[_sink].add(new core.String.fromCharCodes(source)); |
305 } | 305 } |
306 addSlice(source, start, end, isLast) { | 306 addSlice(source, start, end, isLast) { |
307 let length = source.length; | 307 let length = source.length; |
308 core.RangeError.checkValidRange(start, end, length); | 308 core.RangeError.checkValidRange(start, end, length); |
309 if (dart.notNull(start) < dart.notNull(end)) { | 309 if (dart.notNull(start) < dart.notNull(end)) { |
310 if (start !== 0 || end !== length) { | 310 if (start !== 0 || end !== length) { |
311 source = source.sublist(start, end); | 311 source = source.sublist(start, end); |
312 } | 312 } |
313 this.add(source); | 313 this.add(source); |
314 } | 314 } |
315 if (isLast) | 315 if (isLast) |
316 this.close(); | 316 this.close(); |
317 } | 317 } |
318 } | 318 } |
319 class _ByteAdapterSink extends ByteConversionSinkBase { | 319 class _ByteAdapterSink extends ByteConversionSinkBase { |
320 _ByteAdapterSink($_sink) { | 320 _ByteAdapterSink(sink$) { |
321 this[_sink] = $_sink; | 321 this[_sink] = sink$; |
322 super.ByteConversionSinkBase(); | 322 super.ByteConversionSinkBase(); |
323 } | 323 } |
324 add(chunk) { | 324 add(chunk) { |
325 return this[_sink].add(chunk); | 325 return this[_sink].add(chunk); |
326 } | 326 } |
327 close() { | 327 close() { |
328 return this[_sink].close(); | 328 return this[_sink].close(); |
329 } | 329 } |
330 } | 330 } |
331 let _buffer = Symbol('_buffer'); | 331 let _buffer = Symbol('_buffer'); |
332 let _callback = Symbol('_callback'); | 332 let _callback = Symbol('_callback'); |
333 let _bufferIndex = Symbol('_bufferIndex'); | 333 let _bufferIndex = Symbol('_bufferIndex'); |
334 let _roundToPowerOf2 = Symbol('_roundToPowerOf2'); | 334 let _roundToPowerOf2$ = Symbol('_roundToPowerOf2'); |
335 class _ByteCallbackSink extends ByteConversionSinkBase { | 335 class _ByteCallbackSink extends ByteConversionSinkBase { |
336 _ByteCallbackSink(callback) { | 336 _ByteCallbackSink(callback) { |
337 this[_buffer] = new typed_data.Uint8List(_ByteCallbackSink._INITIAL_BUFFER
_SIZE); | 337 this[_buffer] = new typed_data.Uint8List(_ByteCallbackSink._INITIAL_BUFFER
_SIZE); |
338 this[_callback] = callback; | 338 this[_callback] = callback; |
339 this[_bufferIndex] = 0; | 339 this[_bufferIndex] = 0; |
340 super.ByteConversionSinkBase(); | 340 super.ByteConversionSinkBase(); |
341 } | 341 } |
342 add(chunk) { | 342 add(chunk) { |
343 let freeCount = dart.notNull(this[_buffer].length) - dart.notNull(this[_bu
fferIndex]); | 343 let freeCount = dart.notNull(this[_buffer].length) - dart.notNull(this[_bu
fferIndex]); |
344 if (dart.notNull(chunk.length) > dart.notNull(freeCount)) { | 344 if (dart.notNull(chunk.length) > dart.notNull(freeCount)) { |
345 let oldLength = this[_buffer].length; | 345 let oldLength = this[_buffer].length; |
346 let newLength = dart.notNull(_roundToPowerOf2(dart.notNull(chunk.length)
+ dart.notNull(oldLength))) * 2; | 346 let newLength = dart.notNull(_roundToPowerOf2(dart.notNull(chunk.length)
+ dart.notNull(oldLength))) * 2; |
347 let grown = new typed_data.Uint8List(newLength); | 347 let grown = new typed_data.Uint8List(newLength); |
348 grown.setRange(0, this[_buffer].length, this[_buffer]); | 348 grown.setRange(0, this[_buffer].length, this[_buffer]); |
349 this[_buffer] = grown; | 349 this[_buffer] = grown; |
350 } | 350 } |
351 this[_buffer].setRange(this[_bufferIndex], dart.notNull(this[_bufferIndex]
) + dart.notNull(chunk.length), chunk); | 351 this[_buffer].setRange(this[_bufferIndex], dart.notNull(this[_bufferIndex]
) + dart.notNull(chunk.length), chunk); |
352 this[_bufferIndex] = chunk.length; | 352 this[_bufferIndex] = chunk.length; |
353 } | 353 } |
354 static [_roundToPowerOf2](v) { | 354 static [_roundToPowerOf2$](v) { |
355 dart.assert(dart.notNull(v) > 0); | 355 dart.assert(dart.notNull(v) > 0); |
356 v = dart.notNull(v) - 1; | 356 v = dart.notNull(v) - 1; |
357 v = dart.notNull(v) >> 1; | 357 v = dart.notNull(v) >> 1; |
358 v = dart.notNull(v) >> 2; | 358 v = dart.notNull(v) >> 2; |
359 v = dart.notNull(v) >> 4; | 359 v = dart.notNull(v) >> 4; |
360 v = dart.notNull(v) >> 8; | 360 v = dart.notNull(v) >> 8; |
361 v = dart.notNull(v) >> 16; | 361 v = dart.notNull(v) >> 16; |
362 v = dart.notNull(v) + 1; | 362 v = dart.notNull(v) + 1; |
363 return v; | 363 return v; |
364 } | 364 } |
365 close() { | 365 close() { |
366 this[_callback](this[_buffer].sublist(0, this[_bufferIndex])); | 366 this[_callback](this[_buffer].sublist(0, this[_bufferIndex])); |
367 } | 367 } |
368 } | 368 } |
369 _ByteCallbackSink._INITIAL_BUFFER_SIZE = 1024; | 369 _ByteCallbackSink._INITIAL_BUFFER_SIZE = 1024; |
370 let _accumulated = Symbol('_accumulated'); | 370 let _accumulated = Symbol('_accumulated'); |
371 let _SimpleCallbackSink$ = dart.generic(function(T) { | 371 let _SimpleCallbackSink$ = dart.generic(function(T) { |
372 class _SimpleCallbackSink extends ChunkedConversionSink$(T) { | 372 class _SimpleCallbackSink extends ChunkedConversionSink$(T) { |
373 _SimpleCallbackSink($_callback) { | 373 _SimpleCallbackSink(callback$) { |
374 this[_accumulated] = new List.from([]); | 374 this[_accumulated] = new List.from([]); |
375 this[_callback] = $_callback; | 375 this[_callback] = callback$; |
376 super.ChunkedConversionSink(); | 376 super.ChunkedConversionSink(); |
377 } | 377 } |
378 add(chunk) { | 378 add(chunk) { |
379 this[_accumulated].add(chunk); | 379 this[_accumulated].add(chunk); |
380 } | 380 } |
381 close() { | 381 close() { |
382 this[_callback](this[_accumulated]); | 382 this[_callback](this[_accumulated]); |
383 } | 383 } |
384 } | 384 } |
385 return _SimpleCallbackSink; | 385 return _SimpleCallbackSink; |
386 }); | 386 }); |
387 let _SimpleCallbackSink = _SimpleCallbackSink$(dart.dynamic); | 387 let _SimpleCallbackSink = _SimpleCallbackSink$(dart.dynamic); |
388 let _EventSinkAdapter$ = dart.generic(function(T) { | 388 let _EventSinkAdapter$ = dart.generic(function(T) { |
389 class _EventSinkAdapter extends core.Object { | 389 class _EventSinkAdapter extends core.Object { |
390 _EventSinkAdapter($_sink) { | 390 _EventSinkAdapter(sink$) { |
391 this[_sink] = $_sink; | 391 this[_sink] = sink$; |
392 } | 392 } |
393 add(data) { | 393 add(data) { |
394 return this[_sink].add(data); | 394 return this[_sink].add(data); |
395 } | 395 } |
396 close() { | 396 close() { |
397 return this[_sink].close(); | 397 return this[_sink].close(); |
398 } | 398 } |
399 } | 399 } |
400 return _EventSinkAdapter; | 400 return _EventSinkAdapter; |
401 }); | 401 }); |
(...skipping 24 matching lines...) Expand all Loading... |
426 let _first = Symbol('_first'); | 426 let _first = Symbol('_first'); |
427 let _second = Symbol('_second'); | 427 let _second = Symbol('_second'); |
428 let _FusedCodec$ = dart.generic(function(S, M, T) { | 428 let _FusedCodec$ = dart.generic(function(S, M, T) { |
429 class _FusedCodec extends Codec$(S, T) { | 429 class _FusedCodec extends Codec$(S, T) { |
430 get encoder() { | 430 get encoder() { |
431 return dart.as(this[_first].encoder.fuse(this[_second].encoder), Convert
er$(S, T)); | 431 return dart.as(this[_first].encoder.fuse(this[_second].encoder), Convert
er$(S, T)); |
432 } | 432 } |
433 get decoder() { | 433 get decoder() { |
434 return dart.as(this[_second].decoder.fuse(this[_first].decoder), Convert
er$(T, S)); | 434 return dart.as(this[_second].decoder.fuse(this[_first].decoder), Convert
er$(T, S)); |
435 } | 435 } |
436 _FusedCodec($_first, $_second) { | 436 _FusedCodec(first$, second) { |
437 this[_first] = $_first; | 437 this[_first] = first$; |
438 this[_second] = $_second; | 438 this[_second] = second; |
439 super.Codec(); | 439 super.Codec(); |
440 } | 440 } |
441 } | 441 } |
442 return _FusedCodec; | 442 return _FusedCodec; |
443 }); | 443 }); |
444 let _FusedCodec = _FusedCodec$(dart.dynamic, dart.dynamic, dart.dynamic); | 444 let _FusedCodec = _FusedCodec$(dart.dynamic, dart.dynamic, dart.dynamic); |
445 let _codec = Symbol('_codec'); | 445 let _codec = Symbol('_codec'); |
446 let _InvertedCodec$ = dart.generic(function(T, S) { | 446 let _InvertedCodec$ = dart.generic(function(T, S) { |
447 class _InvertedCodec extends Codec$(T, S) { | 447 class _InvertedCodec extends Codec$(T, S) { |
448 _InvertedCodec(codec) { | 448 _InvertedCodec(codec) { |
449 this[_codec] = codec; | 449 this[_codec] = codec; |
450 super.Codec(); | 450 super.Codec(); |
451 } | 451 } |
452 get encoder() { | 452 get encoder() { |
453 return this[_codec].decoder; | 453 return this[_codec].decoder; |
454 } | 454 } |
455 get decoder() { | 455 get decoder() { |
456 return this[_codec].encoder; | 456 return this[_codec].encoder; |
457 } | 457 } |
458 get inverted() { | 458 get inverted() { |
459 return this[_codec]; | 459 return this[_codec]; |
460 } | 460 } |
461 } | 461 } |
462 return _InvertedCodec; | 462 return _InvertedCodec; |
463 }); | 463 }); |
464 let _InvertedCodec = _InvertedCodec$(dart.dynamic, dart.dynamic); | 464 let _InvertedCodec = _InvertedCodec$(dart.dynamic, dart.dynamic); |
465 let _FusedConverter$ = dart.generic(function(S, M, T) { | 465 let _FusedConverter$ = dart.generic(function(S, M, T) { |
466 class _FusedConverter extends Converter$(S, T) { | 466 class _FusedConverter extends Converter$(S, T) { |
467 _FusedConverter($_first, $_second) { | 467 _FusedConverter(first$, second) { |
468 this[_first] = $_first; | 468 this[_first] = first$; |
469 this[_second] = $_second; | 469 this[_second] = second; |
470 super.Converter(); | 470 super.Converter(); |
471 } | 471 } |
472 convert(input) { | 472 convert(input) { |
473 return dart.as(this[_second].convert(this[_first].convert(input)), T); | 473 return dart.as(this[_second].convert(this[_first].convert(input)), T); |
474 } | 474 } |
475 startChunkedConversion(sink) { | 475 startChunkedConversion(sink) { |
476 return this[_first].startChunkedConversion(this[_second].startChunkedCon
version(sink)); | 476 return this[_first].startChunkedConversion(this[_second].startChunkedCon
version(sink)); |
477 } | 477 } |
478 } | 478 } |
479 return _FusedConverter; | 479 return _FusedConverter; |
480 }); | 480 }); |
481 let _FusedConverter = _FusedConverter$(dart.dynamic, dart.dynamic, dart.dynami
c); | 481 let _FusedConverter = _FusedConverter$(dart.dynamic, dart.dynamic, dart.dynami
c); |
482 let HTML_ESCAPE = new HtmlEscape(); | 482 let HTML_ESCAPE = new HtmlEscape(); |
483 let _name = Symbol('_name'); | 483 let _name = Symbol('_name'); |
484 class HtmlEscapeMode extends core.Object { | 484 class HtmlEscapeMode extends core.Object { |
485 HtmlEscapeMode$_($_name, escapeLtGt, escapeQuot, escapeApos, escapeSlash) { | 485 HtmlEscapeMode$_(name$, escapeLtGt, escapeQuot, escapeApos, escapeSlash) { |
486 this[_name] = $_name; | 486 this[_name] = name$; |
487 this.escapeLtGt = escapeLtGt; | 487 this.escapeLtGt = escapeLtGt; |
488 this.escapeQuot = escapeQuot; | 488 this.escapeQuot = escapeQuot; |
489 this.escapeApos = escapeApos; | 489 this.escapeApos = escapeApos; |
490 this.escapeSlash = escapeSlash; | 490 this.escapeSlash = escapeSlash; |
491 } | 491 } |
492 toString() { | 492 toString() { |
493 return this[_name]; | 493 return this[_name]; |
494 } | 494 } |
495 } | 495 } |
496 dart.defineNamedConstructor(HtmlEscapeMode, '_'); | 496 dart.defineNamedConstructor(HtmlEscapeMode, '_'); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 } | 554 } |
555 startChunkedConversion(sink) { | 555 startChunkedConversion(sink) { |
556 if (!dart.is(sink, StringConversionSink)) { | 556 if (!dart.is(sink, StringConversionSink)) { |
557 sink = new StringConversionSink.from(sink); | 557 sink = new StringConversionSink.from(sink); |
558 } | 558 } |
559 return new _HtmlEscapeSink(this, dart.as(sink, StringConversionSink)); | 559 return new _HtmlEscapeSink(this, dart.as(sink, StringConversionSink)); |
560 } | 560 } |
561 } | 561 } |
562 let _escape = Symbol('_escape'); | 562 let _escape = Symbol('_escape'); |
563 class _HtmlEscapeSink extends StringConversionSinkBase { | 563 class _HtmlEscapeSink extends StringConversionSinkBase { |
564 _HtmlEscapeSink($_escape, $_sink) { | 564 _HtmlEscapeSink(escape, sink$) { |
565 this[_escape] = $_escape; | 565 this[_escape] = escape; |
566 this[_sink] = $_sink; | 566 this[_sink] = sink$; |
567 super.StringConversionSinkBase(); | 567 super.StringConversionSinkBase(); |
568 } | 568 } |
569 addSlice(chunk, start, end, isLast) { | 569 addSlice(chunk, start, end, isLast) { |
570 let val = this[_escape]._convert(chunk, start, end); | 570 let val = this[_escape]._convert(chunk, start, end); |
571 if (val === null) { | 571 if (val === null) { |
572 this[_sink].addSlice(chunk, start, end, isLast); | 572 this[_sink].addSlice(chunk, start, end, isLast); |
573 } else { | 573 } else { |
574 this[_sink].add(val); | 574 this[_sink].add(val); |
575 if (isLast) | 575 if (isLast) |
576 this[_sink].close(); | 576 this[_sink].close(); |
577 } | 577 } |
578 } | 578 } |
579 close() { | 579 close() { |
580 return this[_sink].close(); | 580 return this[_sink].close(); |
581 } | 581 } |
582 } | 582 } |
583 class JsonUnsupportedObjectError extends core.Error { | 583 class JsonUnsupportedObjectError extends core.Error { |
584 JsonUnsupportedObjectError(unsupportedObject, opt$) { | 584 JsonUnsupportedObjectError(unsupportedObject, opts) { |
585 let cause = opt$ && 'cause' in opt$ ? opt$.cause : null; | 585 let cause = opts && 'cause' in opts ? opts.cause : null; |
586 this.unsupportedObject = unsupportedObject; | 586 this.unsupportedObject = unsupportedObject; |
587 this.cause = cause; | 587 this.cause = cause; |
588 super.Error(); | 588 super.Error(); |
589 } | 589 } |
590 toString() { | 590 toString() { |
591 if (this.cause !== null) { | 591 if (this.cause !== null) { |
592 return "Converting object to an encodable object failed."; | 592 return "Converting object to an encodable object failed."; |
593 } else { | 593 } else { |
594 return "Converting object did not return an encodable object."; | 594 return "Converting object did not return an encodable object."; |
595 } | 595 } |
596 } | 596 } |
597 } | 597 } |
598 class JsonCyclicError extends JsonUnsupportedObjectError { | 598 class JsonCyclicError extends JsonUnsupportedObjectError { |
599 JsonCyclicError(object) { | 599 JsonCyclicError(object) { |
600 super.JsonUnsupportedObjectError(object); | 600 super.JsonUnsupportedObjectError(object); |
601 } | 601 } |
602 toString() { | 602 toString() { |
603 return "Cyclic error in JSON stringify"; | 603 return "Cyclic error in JSON stringify"; |
604 } | 604 } |
605 } | 605 } |
606 let JSON = new JsonCodec(); | 606 let JSON = new JsonCodec(); |
607 let _reviver = Symbol('_reviver'); | 607 let _reviver = Symbol('_reviver'); |
608 let _toEncodable = Symbol('_toEncodable'); | 608 let _toEncodable$ = Symbol('_toEncodable'); |
609 class JsonCodec extends Codec$(core.Object, core.String) { | 609 class JsonCodec extends Codec$(core.Object, core.String) { |
610 JsonCodec(opt$) { | 610 JsonCodec(opts) { |
611 let reviver = opt$ && 'reviver' in opt$ ? opt$.reviver : null; | 611 let reviver = opts && 'reviver' in opts ? opts.reviver : null; |
612 let toEncodable = opt$ && 'toEncodable' in opt$ ? opt$.toEncodable : null; | 612 let toEncodable = opts && 'toEncodable' in opts ? opts.toEncodable : null; |
613 this[_reviver] = reviver; | 613 this[_reviver] = reviver; |
614 this[_toEncodable] = toEncodable; | 614 this[_toEncodable$] = toEncodable; |
615 super.Codec(); | 615 super.Codec(); |
616 } | 616 } |
617 JsonCodec$withReviver(reviver) { | 617 JsonCodec$withReviver(reviver) { |
618 this.JsonCodec({reviver: reviver}); | 618 this.JsonCodec({reviver: reviver}); |
619 } | 619 } |
620 decode(source, opt$) { | 620 decode(source, opts) { |
621 let reviver = opt$ && 'reviver' in opt$ ? opt$.reviver : null; | 621 let reviver = opts && 'reviver' in opts ? opts.reviver : null; |
622 if (reviver === null) | 622 if (reviver === null) |
623 reviver = this[_reviver]; | 623 reviver = this[_reviver]; |
624 if (reviver === null) | 624 if (reviver === null) |
625 return this.decoder.convert(source); | 625 return this.decoder.convert(source); |
626 return new JsonDecoder(reviver).convert(source); | 626 return new JsonDecoder(reviver).convert(source); |
627 } | 627 } |
628 encode(value, opt$) { | 628 encode(value, opts) { |
629 let toEncodable = opt$ && 'toEncodable' in opt$ ? opt$.toEncodable : null; | 629 let toEncodable = opts && 'toEncodable' in opts ? opts.toEncodable : null; |
630 if (toEncodable === null) | 630 if (toEncodable === null) |
631 toEncodable = this[_toEncodable]; | 631 toEncodable = this[_toEncodable$]; |
632 if (toEncodable === null) | 632 if (toEncodable === null) |
633 return this.encoder.convert(value); | 633 return this.encoder.convert(value); |
634 return new JsonEncoder(dart.closureWrap(toEncodable, "(Object) → Object"))
.convert(value); | 634 return new JsonEncoder(dart.closureWrap(toEncodable, "(Object) → Object"))
.convert(value); |
635 } | 635 } |
636 get encoder() { | 636 get encoder() { |
637 if (this[_toEncodable] === null) | 637 if (this[_toEncodable$] === null) |
638 return new JsonEncoder(); | 638 return new JsonEncoder(); |
639 return new JsonEncoder(dart.closureWrap(this[_toEncodable], "(Object) → Ob
ject")); | 639 return new JsonEncoder(dart.closureWrap(this[_toEncodable$], "(Object) → O
bject")); |
640 } | 640 } |
641 get decoder() { | 641 get decoder() { |
642 if (this[_reviver] === null) | 642 if (this[_reviver] === null) |
643 return new JsonDecoder(); | 643 return new JsonDecoder(); |
644 return new JsonDecoder(this[_reviver]); | 644 return new JsonDecoder(this[_reviver]); |
645 } | 645 } |
646 } | 646 } |
647 dart.defineNamedConstructor(JsonCodec, 'withReviver'); | 647 dart.defineNamedConstructor(JsonCodec, 'withReviver'); |
648 class JsonEncoder extends Converter$(core.Object, core.String) { | 648 class JsonEncoder extends Converter$(core.Object, core.String) { |
649 JsonEncoder(toEncodable) { | 649 JsonEncoder(toEncodable) { |
650 if (toEncodable === void 0) | 650 if (toEncodable === void 0) |
651 toEncodable = null; | 651 toEncodable = null; |
652 this.indent = null; | 652 this.indent = null; |
653 this[_toEncodable] = toEncodable; | 653 this[_toEncodable$] = toEncodable; |
654 super.Converter(); | 654 super.Converter(); |
655 } | 655 } |
656 JsonEncoder$withIndent(indent, toEncodable) { | 656 JsonEncoder$withIndent(indent, toEncodable) { |
657 if (toEncodable === void 0) | 657 if (toEncodable === void 0) |
658 toEncodable = null; | 658 toEncodable = null; |
659 this.indent = indent; | 659 this.indent = indent; |
660 this[_toEncodable] = toEncodable; | 660 this[_toEncodable$] = toEncodable; |
661 super.Converter(); | 661 super.Converter(); |
662 } | 662 } |
663 convert(object) { | 663 convert(object) { |
664 return _JsonStringStringifier.stringify(object, dart.as(this[_toEncodable]
, dart.throw_("Unimplemented type (dynamic) → dynamic")), this.indent); | 664 return _JsonStringStringifier.stringify(object, dart.as(this[_toEncodable$
], dart.throw_("Unimplemented type (dynamic) → dynamic")), this.indent); |
665 } | 665 } |
666 startChunkedConversion(sink) { | 666 startChunkedConversion(sink) { |
667 if (!dart.is(sink, StringConversionSink)) { | 667 if (!dart.is(sink, StringConversionSink)) { |
668 sink = new StringConversionSink.from(sink); | 668 sink = new StringConversionSink.from(sink); |
669 } else if (dart.is(sink, _Utf8EncoderSink)) { | 669 } else if (dart.is(sink, _Utf8EncoderSink)) { |
670 return new _JsonUtf8EncoderSink(sink[_sink], this[_toEncodable], JsonUtf
8Encoder._utf8Encode(this.indent), JsonUtf8Encoder.DEFAULT_BUFFER_SIZE); | 670 return new _JsonUtf8EncoderSink(sink[_sink], this[_toEncodable$], JsonUt
f8Encoder._utf8Encode(this.indent), JsonUtf8Encoder.DEFAULT_BUFFER_SIZE); |
671 } | 671 } |
672 return new _JsonEncoderSink(dart.as(sink, StringConversionSink), this[_toE
ncodable], this.indent); | 672 return new _JsonEncoderSink(dart.as(sink, StringConversionSink), this[_toE
ncodable$], this.indent); |
673 } | 673 } |
674 bind(stream) { | 674 bind(stream) { |
675 return dart.as(super.bind(stream), async.Stream$(core.String)); | 675 return dart.as(super.bind(stream), async.Stream$(core.String)); |
676 } | 676 } |
677 fuse(other) { | 677 fuse(other) { |
678 if (dart.is(other, Utf8Encoder)) { | 678 if (dart.is(other, Utf8Encoder)) { |
679 return new JsonUtf8Encoder(this.indent, dart.as(this[_toEncodable], dart
.throw_("Unimplemented type (Object) → dynamic"))); | 679 return new JsonUtf8Encoder(this.indent, dart.as(this[_toEncodable$], dar
t.throw_("Unimplemented type (Object) → dynamic"))); |
680 } | 680 } |
681 return super.fuse(other); | 681 return super.fuse(other); |
682 } | 682 } |
683 } | 683 } |
684 dart.defineNamedConstructor(JsonEncoder, 'withIndent'); | 684 dart.defineNamedConstructor(JsonEncoder, 'withIndent'); |
685 let _indent = Symbol('_indent'); | 685 let _indent = Symbol('_indent'); |
686 let _bufferSize = Symbol('_bufferSize'); | 686 let _bufferSize = Symbol('_bufferSize'); |
687 let _utf8Encode = Symbol('_utf8Encode'); | 687 let _utf8Encode$ = Symbol('_utf8Encode'); |
688 class JsonUtf8Encoder extends Converter$(core.Object, core.List$(core.int)) { | 688 class JsonUtf8Encoder extends Converter$(core.Object, core.List$(core.int)) { |
689 JsonUtf8Encoder(indent, toEncodable, bufferSize) { | 689 JsonUtf8Encoder(indent, toEncodable, bufferSize) { |
690 if (indent === void 0) | 690 if (indent === void 0) |
691 indent = null; | 691 indent = null; |
692 if (toEncodable === void 0) | 692 if (toEncodable === void 0) |
693 toEncodable = null; | 693 toEncodable = null; |
694 if (bufferSize === void 0) | 694 if (bufferSize === void 0) |
695 bufferSize = JsonUtf8Encoder.DEFAULT_BUFFER_SIZE; | 695 bufferSize = JsonUtf8Encoder.DEFAULT_BUFFER_SIZE; |
696 this[_indent] = _utf8Encode(indent); | 696 this[_indent] = _utf8Encode(indent); |
697 this[_toEncodable] = toEncodable; | 697 this[_toEncodable$] = toEncodable; |
698 this[_bufferSize] = bufferSize; | 698 this[_bufferSize] = bufferSize; |
699 super.Converter(); | 699 super.Converter(); |
700 } | 700 } |
701 static [_utf8Encode](string) { | 701 static [_utf8Encode$](string) { |
702 if (string === null) | 702 if (string === null) |
703 return null; | 703 return null; |
704 if (string.isEmpty) | 704 if (string.isEmpty) |
705 return new typed_data.Uint8List(0); | 705 return new typed_data.Uint8List(0); |
706 checkAscii: { | 706 checkAscii: { |
707 for (let i = 0; dart.notNull(i) < dart.notNull(string.length); i = dart.
notNull(i) + 1) { | 707 for (let i = 0; dart.notNull(i) < dart.notNull(string.length); i = dart.
notNull(i) + 1) { |
708 if (dart.notNull(string.codeUnitAt(i)) >= 128) | 708 if (dart.notNull(string.codeUnitAt(i)) >= 128) |
709 break checkAscii; | 709 break checkAscii; |
710 } | 710 } |
711 return string.codeUnits; | 711 return string.codeUnits; |
712 } | 712 } |
713 return UTF8.encode(string); | 713 return UTF8.encode(string); |
714 } | 714 } |
715 convert(object) { | 715 convert(object) { |
716 let bytes = dart.as(new List.from([]), core.List$(core.List$(core.int))); | 716 let bytes = dart.as(new List.from([]), core.List$(core.List$(core.int))); |
717 // Function addChunk: (Uint8List, int, int) → void | 717 // Function addChunk: (Uint8List, int, int) → void |
718 function addChunk(chunk, start, end) { | 718 function addChunk(chunk, start, end) { |
719 if (dart.notNull(start) > 0 || dart.notNull(end) < dart.notNull(chunk.le
ngth)) { | 719 if (dart.notNull(start) > 0 || dart.notNull(end) < dart.notNull(chunk.le
ngth)) { |
720 let length = dart.notNull(end) - dart.notNull(start); | 720 let length = dart.notNull(end) - dart.notNull(start); |
721 chunk = new typed_data.Uint8List.view(chunk.buffer, dart.notNull(chunk
.offsetInBytes) + dart.notNull(start), length); | 721 chunk = new typed_data.Uint8List.view(chunk.buffer, dart.notNull(chunk
.offsetInBytes) + dart.notNull(start), length); |
722 } | 722 } |
723 bytes.add(chunk); | 723 bytes.add(chunk); |
724 } | 724 } |
725 _JsonUtf8Stringifier.stringify(object, this[_indent], dart.as(this[_toEnco
dable], dart.throw_("Unimplemented type (Object) → dynamic")), this[_bufferSize]
, addChunk); | 725 _JsonUtf8Stringifier.stringify(object, this[_indent], dart.as(this[_toEnco
dable$], dart.throw_("Unimplemented type (Object) → dynamic")), this[_bufferSize
], addChunk); |
726 if (bytes.length === 1) | 726 if (bytes.length === 1) |
727 return bytes.get(0); | 727 return bytes.get(0); |
728 let length = 0; | 728 let length = 0; |
729 for (let i = 0; dart.notNull(i) < dart.notNull(bytes.length); i = dart.not
Null(i) + 1) { | 729 for (let i = 0; dart.notNull(i) < dart.notNull(bytes.length); i = dart.not
Null(i) + 1) { |
730 length = bytes.get(i).length; | 730 length = bytes.get(i).length; |
731 } | 731 } |
732 let result = new typed_data.Uint8List(length); | 732 let result = new typed_data.Uint8List(length); |
733 for (let i = 0, offset = 0; dart.notNull(i) < dart.notNull(bytes.length);
i = dart.notNull(i) + 1) { | 733 for (let i = 0, offset = 0; dart.notNull(i) < dart.notNull(bytes.length);
i = dart.notNull(i) + 1) { |
734 let byteList = bytes.get(i); | 734 let byteList = bytes.get(i); |
735 let end = dart.notNull(offset) + dart.notNull(byteList.length); | 735 let end = dart.notNull(offset) + dart.notNull(byteList.length); |
736 result.setRange(offset, end, byteList); | 736 result.setRange(offset, end, byteList); |
737 offset = end; | 737 offset = end; |
738 } | 738 } |
739 return result; | 739 return result; |
740 } | 740 } |
741 startChunkedConversion(sink) { | 741 startChunkedConversion(sink) { |
742 let byteSink = null; | 742 let byteSink = null; |
743 if (dart.is(sink, ByteConversionSink)) { | 743 if (dart.is(sink, ByteConversionSink)) { |
744 byteSink = sink; | 744 byteSink = sink; |
745 } else { | 745 } else { |
746 byteSink = new ByteConversionSink.from(sink); | 746 byteSink = new ByteConversionSink.from(sink); |
747 } | 747 } |
748 return new _JsonUtf8EncoderSink(byteSink, this[_toEncodable], this[_indent
], this[_bufferSize]); | 748 return new _JsonUtf8EncoderSink(byteSink, this[_toEncodable$], this[_inden
t], this[_bufferSize]); |
749 } | 749 } |
750 bind(stream) { | 750 bind(stream) { |
751 return dart.as(super.bind(stream), async.Stream$(core.List$(core.int))); | 751 return dart.as(super.bind(stream), async.Stream$(core.List$(core.int))); |
752 } | 752 } |
753 fuse(other) { | 753 fuse(other) { |
754 return super.fuse(other); | 754 return super.fuse(other); |
755 } | 755 } |
756 } | 756 } |
757 JsonUtf8Encoder.DEFAULT_BUFFER_SIZE = 256; | 757 JsonUtf8Encoder.DEFAULT_BUFFER_SIZE = 256; |
758 let _isDone = Symbol('_isDone'); | 758 let _isDone = Symbol('_isDone'); |
759 class _JsonEncoderSink extends ChunkedConversionSink$(core.Object) { | 759 class _JsonEncoderSink extends ChunkedConversionSink$(core.Object) { |
760 _JsonEncoderSink($_sink, $_toEncodable, $_indent) { | 760 _JsonEncoderSink(sink$, toEncodable$, indent$) { |
761 this[_sink] = $_sink; | 761 this[_sink] = sink$; |
762 this[_toEncodable] = $_toEncodable; | 762 this[_toEncodable$] = toEncodable$; |
763 this[_indent] = $_indent; | 763 this[_indent] = indent$; |
764 this[_isDone] = false; | 764 this[_isDone] = false; |
765 super.ChunkedConversionSink(); | 765 super.ChunkedConversionSink(); |
766 } | 766 } |
767 add(o) { | 767 add(o) { |
768 if (this[_isDone]) { | 768 if (this[_isDone]) { |
769 throw new core.StateError("Only one call to add allowed"); | 769 throw new core.StateError("Only one call to add allowed"); |
770 } | 770 } |
771 this[_isDone] = true; | 771 this[_isDone] = true; |
772 let stringSink = this[_sink].asStringSink(); | 772 let stringSink = this[_sink].asStringSink(); |
773 _JsonStringStringifier.printOn(o, stringSink, dart.as(this[_toEncodable],
dart.throw_("Unimplemented type (dynamic) → dynamic")), this[_indent]); | 773 _JsonStringStringifier.printOn(o, stringSink, dart.as(this[_toEncodable$],
dart.throw_("Unimplemented type (dynamic) → dynamic")), this[_indent]); |
774 stringSink.close(); | 774 stringSink.close(); |
775 } | 775 } |
776 close() {} | 776 close() {} |
777 } | 777 } |
778 let _addChunk = Symbol('_addChunk'); | 778 let _addChunk = Symbol('_addChunk'); |
779 class _JsonUtf8EncoderSink extends ChunkedConversionSink$(core.Object) { | 779 class _JsonUtf8EncoderSink extends ChunkedConversionSink$(core.Object) { |
780 _JsonUtf8EncoderSink($_sink, $_toEncodable, $_indent, $_bufferSize) { | 780 _JsonUtf8EncoderSink(sink$, toEncodable$, indent$, bufferSize$) { |
781 this[_sink] = $_sink; | 781 this[_sink] = sink$; |
782 this[_toEncodable] = $_toEncodable; | 782 this[_toEncodable$] = toEncodable$; |
783 this[_indent] = $_indent; | 783 this[_indent] = indent$; |
784 this[_bufferSize] = $_bufferSize; | 784 this[_bufferSize] = bufferSize$; |
785 this[_isDone] = false; | 785 this[_isDone] = false; |
786 super.ChunkedConversionSink(); | 786 super.ChunkedConversionSink(); |
787 } | 787 } |
788 [_addChunk](chunk, start, end) { | 788 [_addChunk](chunk, start, end) { |
789 this[_sink].addSlice(chunk, start, end, false); | 789 this[_sink].addSlice(chunk, start, end, false); |
790 } | 790 } |
791 add(object) { | 791 add(object) { |
792 if (this[_isDone]) { | 792 if (this[_isDone]) { |
793 throw new core.StateError("Only one call to add allowed"); | 793 throw new core.StateError("Only one call to add allowed"); |
794 } | 794 } |
795 this[_isDone] = true; | 795 this[_isDone] = true; |
796 _JsonUtf8Stringifier.stringify(object, this[_indent], dart.as(this[_toEnco
dable], dart.throw_("Unimplemented type (Object) → dynamic")), this[_bufferSize]
, this[_addChunk]); | 796 _JsonUtf8Stringifier.stringify(object, this[_indent], dart.as(this[_toEnco
dable$], dart.throw_("Unimplemented type (Object) → dynamic")), this[_bufferSize
], this[_addChunk]); |
797 this[_sink].close(); | 797 this[_sink].close(); |
798 } | 798 } |
799 close() { | 799 close() { |
800 if (!dart.notNull(this[_isDone])) { | 800 if (!dart.notNull(this[_isDone])) { |
801 this[_isDone] = true; | 801 this[_isDone] = true; |
802 this[_sink].close(); | 802 this[_sink].close(); |
803 } | 803 } |
804 } | 804 } |
805 } | 805 } |
806 class JsonDecoder extends Converter$(core.String, core.Object) { | 806 class JsonDecoder extends Converter$(core.String, core.Object) { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
840 // Function _defaultToEncodable: (dynamic) → Object | 840 // Function _defaultToEncodable: (dynamic) → Object |
841 function _defaultToEncodable(object) { | 841 function _defaultToEncodable(object) { |
842 return dart.dinvoke(object, 'toJson'); | 842 return dart.dinvoke(object, 'toJson'); |
843 } | 843 } |
844 let _seen = Symbol('_seen'); | 844 let _seen = Symbol('_seen'); |
845 let _checkCycle = Symbol('_checkCycle'); | 845 let _checkCycle = Symbol('_checkCycle'); |
846 let _removeSeen = Symbol('_removeSeen'); | 846 let _removeSeen = Symbol('_removeSeen'); |
847 class _JsonStringifier extends core.Object { | 847 class _JsonStringifier extends core.Object { |
848 _JsonStringifier(_toEncodable) { | 848 _JsonStringifier(_toEncodable) { |
849 this[_seen] = new core.List(); | 849 this[_seen] = new core.List(); |
850 this[_toEncodable] = dart.as(_toEncodable !== null ? _toEncodable : _defau
ltToEncodable, core.Function); | 850 this[_toEncodable$] = dart.as(_toEncodable !== null ? _toEncodable : _defa
ultToEncodable, core.Function); |
851 } | 851 } |
852 static hexDigit(x) { | 852 static hexDigit(x) { |
853 return dart.notNull(x) < 10 ? 48 + dart.notNull(x) : 87 + dart.notNull(x); | 853 return dart.notNull(x) < 10 ? 48 + dart.notNull(x) : 87 + dart.notNull(x); |
854 } | 854 } |
855 writeStringContent(s) { | 855 writeStringContent(s) { |
856 let offset = 0; | 856 let offset = 0; |
857 let length = s.length; | 857 let length = s.length; |
858 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull(i
) + 1) { | 858 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull(i
) + 1) { |
859 let charCode = s.codeUnitAt(i); | 859 let charCode = s.codeUnitAt(i); |
860 if (dart.notNull(charCode) > dart.notNull(_JsonStringifier.BACKSLASH)) | 860 if (dart.notNull(charCode) > dart.notNull(_JsonStringifier.BACKSLASH)) |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
913 [_removeSeen](object) { | 913 [_removeSeen](object) { |
914 dart.assert(!dart.notNull(this[_seen].isEmpty)); | 914 dart.assert(!dart.notNull(this[_seen].isEmpty)); |
915 dart.assert(core.identical(this[_seen].last, object)); | 915 dart.assert(core.identical(this[_seen].last, object)); |
916 this[_seen].removeLast(); | 916 this[_seen].removeLast(); |
917 } | 917 } |
918 writeObject(object) { | 918 writeObject(object) { |
919 if (this.writeJsonValue(object)) | 919 if (this.writeJsonValue(object)) |
920 return; | 920 return; |
921 this[_checkCycle](object); | 921 this[_checkCycle](object); |
922 try { | 922 try { |
923 let customJson = dart.dinvokef(this[_toEncodable], object); | 923 let customJson = dart.dinvokef(this[_toEncodable$], object); |
924 if (!dart.notNull(this.writeJsonValue(customJson))) { | 924 if (!dart.notNull(this.writeJsonValue(customJson))) { |
925 throw new JsonUnsupportedObjectError(object); | 925 throw new JsonUnsupportedObjectError(object); |
926 } | 926 } |
927 this[_removeSeen](object); | 927 this[_removeSeen](object); |
928 } catch (e) { | 928 } catch (e) { |
929 throw new JsonUnsupportedObjectError(object, {cause: e}); | 929 throw new JsonUnsupportedObjectError(object, {cause: e}); |
930 } | 930 } |
931 | 931 |
932 } | 932 } |
933 writeJsonValue(object) { | 933 writeJsonValue(object) { |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1045 first = false; | 1045 first = false; |
1046 }).bind(this)); | 1046 }).bind(this)); |
1047 this.writeString('\n'); | 1047 this.writeString('\n'); |
1048 this[_indentLevel] = dart.notNull(this[_indentLevel]) - 1; | 1048 this[_indentLevel] = dart.notNull(this[_indentLevel]) - 1; |
1049 this.writeIndentation(this[_indentLevel]); | 1049 this.writeIndentation(this[_indentLevel]); |
1050 this.writeString('}'); | 1050 this.writeString('}'); |
1051 } | 1051 } |
1052 } | 1052 } |
1053 } | 1053 } |
1054 class _JsonStringStringifier extends _JsonStringifier { | 1054 class _JsonStringStringifier extends _JsonStringifier { |
1055 _JsonStringStringifier($_sink, _toEncodable) { | 1055 _JsonStringStringifier(sink$, _toEncodable) { |
1056 this[_sink] = $_sink; | 1056 this[_sink] = sink$; |
1057 super._JsonStringifier(dart.as(_toEncodable, dart.throw_("Unimplemented ty
pe (Object) → Object"))); | 1057 super._JsonStringifier(dart.as(_toEncodable, dart.throw_("Unimplemented ty
pe (Object) → Object"))); |
1058 } | 1058 } |
1059 static stringify(object, toEncodable, indent) { | 1059 static stringify(object, toEncodable, indent) { |
1060 let output = new core.StringBuffer(); | 1060 let output = new core.StringBuffer(); |
1061 printOn(object, output, toEncodable, indent); | 1061 printOn(object, output, toEncodable, indent); |
1062 return output.toString(); | 1062 return output.toString(); |
1063 } | 1063 } |
1064 static printOn(object, output, toEncodable, indent) { | 1064 static printOn(object, output, toEncodable, indent) { |
1065 let stringifier = null; | 1065 let stringifier = null; |
1066 if (indent === null) { | 1066 if (indent === null) { |
(...skipping 10 matching lines...) Expand all Loading... |
1077 this[_sink].write(string); | 1077 this[_sink].write(string); |
1078 } | 1078 } |
1079 writeStringSlice(string, start, end) { | 1079 writeStringSlice(string, start, end) { |
1080 this[_sink].write(string.substring(start, end)); | 1080 this[_sink].write(string.substring(start, end)); |
1081 } | 1081 } |
1082 writeCharCode(charCode) { | 1082 writeCharCode(charCode) { |
1083 this[_sink].writeCharCode(charCode); | 1083 this[_sink].writeCharCode(charCode); |
1084 } | 1084 } |
1085 } | 1085 } |
1086 class _JsonStringStringifierPretty extends dart.mixin(_JsonStringStringifier,
_JsonPrettyPrintMixin) { | 1086 class _JsonStringStringifierPretty extends dart.mixin(_JsonStringStringifier,
_JsonPrettyPrintMixin) { |
1087 _JsonStringStringifierPretty(sink, toEncodable, $_indent) { | 1087 _JsonStringStringifierPretty(sink, toEncodable, indent$) { |
1088 this[_indent] = $_indent; | 1088 this[_indent] = indent$; |
1089 super._JsonStringStringifier(sink, toEncodable); | 1089 super._JsonStringStringifier(sink, toEncodable); |
1090 } | 1090 } |
1091 writeIndentation(count) { | 1091 writeIndentation(count) { |
1092 for (let i = 0; dart.notNull(i) < dart.notNull(count); i = dart.notNull(i)
+ 1) | 1092 for (let i = 0; dart.notNull(i) < dart.notNull(count); i = dart.notNull(i)
+ 1) |
1093 this.writeString(this[_indent]); | 1093 this.writeString(this[_indent]); |
1094 } | 1094 } |
1095 } | 1095 } |
1096 class _JsonUtf8Stringifier extends _JsonStringifier { | 1096 class _JsonUtf8Stringifier extends _JsonStringifier { |
1097 _JsonUtf8Stringifier(toEncodable, bufferSize, addChunk) { | 1097 _JsonUtf8Stringifier(toEncodable, bufferSize, addChunk) { |
1098 this.addChunk = addChunk; | 1098 this.addChunk = addChunk; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1178 this.writeByte(128 | dart.notNull(charCode) >> 6 & 63); | 1178 this.writeByte(128 | dart.notNull(charCode) >> 6 & 63); |
1179 this.writeByte(128 | dart.notNull(charCode) & 63); | 1179 this.writeByte(128 | dart.notNull(charCode) & 63); |
1180 } | 1180 } |
1181 writeByte(byte) { | 1181 writeByte(byte) { |
1182 dart.assert(dart.notNull(byte) <= 255); | 1182 dart.assert(dart.notNull(byte) <= 255); |
1183 if (this.index === this.buffer.length) { | 1183 if (this.index === this.buffer.length) { |
1184 dart.dinvokef(this.addChunk, this.buffer, 0, this.index); | 1184 dart.dinvokef(this.addChunk, this.buffer, 0, this.index); |
1185 this.buffer = new typed_data.Uint8List(this.bufferSize); | 1185 this.buffer = new typed_data.Uint8List(this.bufferSize); |
1186 this.index = 0; | 1186 this.index = 0; |
1187 } | 1187 } |
1188 this.buffer.set((($tmp) => this.index = dart.notNull($tmp) + 1, $tmp).bind
(this)(this.index), byte); | 1188 this.buffer.set(((x) => this.index = dart.notNull(x$) + 1, x$).bind(this)(
this.index), byte); |
1189 } | 1189 } |
1190 } | 1190 } |
1191 class _JsonUtf8StringifierPretty extends dart.mixin(_JsonUtf8Stringifier, _Jso
nPrettyPrintMixin) { | 1191 class _JsonUtf8StringifierPretty extends dart.mixin(_JsonUtf8Stringifier, _Jso
nPrettyPrintMixin) { |
1192 _JsonUtf8StringifierPretty(toEncodableFunction, indent, bufferSize, addChunk
) { | 1192 _JsonUtf8StringifierPretty(toEncodableFunction, indent, bufferSize, addChunk
) { |
1193 this.indent = indent; | 1193 this.indent = indent; |
1194 super._JsonUtf8Stringifier(toEncodableFunction, dart.as(bufferSize, core.i
nt), dart.as(addChunk, core.Function)); | 1194 super._JsonUtf8Stringifier(toEncodableFunction, dart.as(bufferSize, core.i
nt), dart.as(addChunk, core.Function)); |
1195 } | 1195 } |
1196 writeIndentation(count) { | 1196 writeIndentation(count) { |
1197 let indent = this.indent; | 1197 let indent = this.indent; |
1198 let indentLength = indent.length; | 1198 let indentLength = indent.length; |
(...skipping 15 matching lines...) Expand all Loading... |
1214 for (let i = 0; dart.notNull(i) < dart.notNull(indentLength); i = dart
.notNull(i) + 1) { | 1214 for (let i = 0; dart.notNull(i) < dart.notNull(indentLength); i = dart
.notNull(i) + 1) { |
1215 this.writeByte(indent.get(i)); | 1215 this.writeByte(indent.get(i)); |
1216 } | 1216 } |
1217 } | 1217 } |
1218 } | 1218 } |
1219 } | 1219 } |
1220 } | 1220 } |
1221 let LATIN1 = new Latin1Codec(); | 1221 let LATIN1 = new Latin1Codec(); |
1222 let _LATIN1_MASK = 255; | 1222 let _LATIN1_MASK = 255; |
1223 class Latin1Codec extends Encoding { | 1223 class Latin1Codec extends Encoding { |
1224 Latin1Codec(opt$) { | 1224 Latin1Codec(opts) { |
1225 let allowInvalid = opt$ && 'allowInvalid' in opt$ ? opt$.allowInvalid : fa
lse; | 1225 let allowInvalid = opts && 'allowInvalid' in opts ? opts.allowInvalid : fa
lse; |
1226 this[_allowInvalid] = allowInvalid; | 1226 this[_allowInvalid] = allowInvalid; |
1227 super.Encoding(); | 1227 super.Encoding(); |
1228 } | 1228 } |
1229 get name() { | 1229 get name() { |
1230 return "iso-8859-1"; | 1230 return "iso-8859-1"; |
1231 } | 1231 } |
1232 decode(bytes, opt$) { | 1232 decode(bytes, opts) { |
1233 let allowInvalid = opt$ && 'allowInvalid' in opt$ ? opt$.allowInvalid : nu
ll; | 1233 let allowInvalid = opts && 'allowInvalid' in opts ? opts.allowInvalid : nu
ll; |
1234 if (allowInvalid === null) | 1234 if (allowInvalid === null) |
1235 allowInvalid = this[_allowInvalid]; | 1235 allowInvalid = this[_allowInvalid]; |
1236 if (allowInvalid) { | 1236 if (allowInvalid) { |
1237 return new Latin1Decoder({allowInvalid: true}).convert(bytes); | 1237 return new Latin1Decoder({allowInvalid: true}).convert(bytes); |
1238 } else { | 1238 } else { |
1239 return new Latin1Decoder({allowInvalid: false}).convert(bytes); | 1239 return new Latin1Decoder({allowInvalid: false}).convert(bytes); |
1240 } | 1240 } |
1241 } | 1241 } |
1242 get encoder() { | 1242 get encoder() { |
1243 return new Latin1Encoder(); | 1243 return new Latin1Encoder(); |
1244 } | 1244 } |
1245 get decoder() { | 1245 get decoder() { |
1246 return this[_allowInvalid] ? new Latin1Decoder({allowInvalid: true}) : new
Latin1Decoder({allowInvalid: false}); | 1246 return this[_allowInvalid] ? new Latin1Decoder({allowInvalid: true}) : new
Latin1Decoder({allowInvalid: false}); |
1247 } | 1247 } |
1248 } | 1248 } |
1249 class Latin1Encoder extends _UnicodeSubsetEncoder { | 1249 class Latin1Encoder extends _UnicodeSubsetEncoder { |
1250 Latin1Encoder() { | 1250 Latin1Encoder() { |
1251 super._UnicodeSubsetEncoder(_LATIN1_MASK); | 1251 super._UnicodeSubsetEncoder(_LATIN1_MASK); |
1252 } | 1252 } |
1253 } | 1253 } |
1254 class Latin1Decoder extends _UnicodeSubsetDecoder { | 1254 class Latin1Decoder extends _UnicodeSubsetDecoder { |
1255 Latin1Decoder(opt$) { | 1255 Latin1Decoder(opts) { |
1256 let allowInvalid = opt$ && 'allowInvalid' in opt$ ? opt$.allowInvalid : fa
lse; | 1256 let allowInvalid = opts && 'allowInvalid' in opts ? opts.allowInvalid : fa
lse; |
1257 super._UnicodeSubsetDecoder(allowInvalid, _LATIN1_MASK); | 1257 super._UnicodeSubsetDecoder(allowInvalid, _LATIN1_MASK); |
1258 } | 1258 } |
1259 startChunkedConversion(sink) { | 1259 startChunkedConversion(sink) { |
1260 let stringSink = null; | 1260 let stringSink = null; |
1261 if (dart.is(sink, StringConversionSink)) { | 1261 if (dart.is(sink, StringConversionSink)) { |
1262 stringSink = sink; | 1262 stringSink = sink; |
1263 } else { | 1263 } else { |
1264 stringSink = new StringConversionSink.from(sink); | 1264 stringSink = new StringConversionSink.from(sink); |
1265 } | 1265 } |
1266 if (!dart.notNull(this[_allowInvalid])) | 1266 if (!dart.notNull(this[_allowInvalid])) |
1267 return new _Latin1DecoderSink(stringSink); | 1267 return new _Latin1DecoderSink(stringSink); |
1268 return new _Latin1AllowInvalidDecoderSink(stringSink); | 1268 return new _Latin1AllowInvalidDecoderSink(stringSink); |
1269 } | 1269 } |
1270 } | 1270 } |
1271 let _addSliceToSink = Symbol('_addSliceToSink'); | 1271 let _addSliceToSink = Symbol('_addSliceToSink'); |
1272 class _Latin1DecoderSink extends ByteConversionSinkBase { | 1272 class _Latin1DecoderSink extends ByteConversionSinkBase { |
1273 _Latin1DecoderSink($_sink) { | 1273 _Latin1DecoderSink(sink$) { |
1274 this[_sink] = $_sink; | 1274 this[_sink] = sink$; |
1275 super.ByteConversionSinkBase(); | 1275 super.ByteConversionSinkBase(); |
1276 } | 1276 } |
1277 close() { | 1277 close() { |
1278 this[_sink].close(); | 1278 this[_sink].close(); |
1279 } | 1279 } |
1280 add(source) { | 1280 add(source) { |
1281 this.addSlice(source, 0, source.length, false); | 1281 this.addSlice(source, 0, source.length, false); |
1282 } | 1282 } |
1283 [_addSliceToSink](source, start, end, isLast) { | 1283 [_addSliceToSink](source, start, end, isLast) { |
1284 this[_sink].add(new core.String.fromCharCodes(source, start, end)); | 1284 this[_sink].add(new core.String.fromCharCodes(source, start, end)); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1334 return lines; | 1334 return lines; |
1335 } | 1335 } |
1336 startChunkedConversion(sink) { | 1336 startChunkedConversion(sink) { |
1337 if (!dart.is(sink, StringConversionSink)) { | 1337 if (!dart.is(sink, StringConversionSink)) { |
1338 sink = new StringConversionSink.from(sink); | 1338 sink = new StringConversionSink.from(sink); |
1339 } | 1339 } |
1340 return new _LineSplitterSink(dart.as(sink, StringConversionSink)); | 1340 return new _LineSplitterSink(dart.as(sink, StringConversionSink)); |
1341 } | 1341 } |
1342 } | 1342 } |
1343 let _carry = Symbol('_carry'); | 1343 let _carry = Symbol('_carry'); |
1344 let _addSlice = Symbol('_addSlice'); | 1344 let _addSlice$ = Symbol('_addSlice'); |
1345 class _LineSplitterSink extends StringConversionSinkBase { | 1345 class _LineSplitterSink extends StringConversionSinkBase { |
1346 _LineSplitterSink($_sink) { | 1346 _LineSplitterSink(sink$) { |
1347 this[_sink] = $_sink; | 1347 this[_sink] = sink$; |
1348 this[_carry] = null; | 1348 this[_carry] = null; |
1349 super.StringConversionSinkBase(); | 1349 super.StringConversionSinkBase(); |
1350 } | 1350 } |
1351 addSlice(chunk, start, end, isLast) { | 1351 addSlice(chunk, start, end, isLast) { |
1352 if (this[_carry] !== null) { | 1352 if (this[_carry] !== null) { |
1353 chunk = core.String['+'](this[_carry], chunk.substring(start, end)); | 1353 chunk = core.String['+'](this[_carry], chunk.substring(start, end)); |
1354 start = 0; | 1354 start = 0; |
1355 end = chunk.length; | 1355 end = chunk.length; |
1356 this[_carry] = null; | 1356 this[_carry] = null; |
1357 } | 1357 } |
1358 this[_carry] = _addSlice(chunk, start, end, isLast, this[_sink].add); | 1358 this[_carry] = _addSlice(chunk, start, end, isLast, this[_sink].add); |
1359 if (isLast) | 1359 if (isLast) |
1360 this[_sink].close(); | 1360 this[_sink].close(); |
1361 } | 1361 } |
1362 close() { | 1362 close() { |
1363 this.addSlice('', 0, 0, true); | 1363 this.addSlice('', 0, 0, true); |
1364 } | 1364 } |
1365 static [_addSlice](chunk, start, end, isLast, adder) { | 1365 static [_addSlice$](chunk, start, end, isLast, adder) { |
1366 let pos = start; | 1366 let pos = start; |
1367 while (dart.notNull(pos) < dart.notNull(end)) { | 1367 while (dart.notNull(pos) < dart.notNull(end)) { |
1368 let skip = 0; | 1368 let skip = 0; |
1369 let char = chunk.codeUnitAt(pos); | 1369 let char = chunk.codeUnitAt(pos); |
1370 if (char === _LineSplitterSink._LF) { | 1370 if (char === _LineSplitterSink._LF) { |
1371 skip = 1; | 1371 skip = 1; |
1372 } else if (char === _LineSplitterSink._CR) { | 1372 } else if (char === _LineSplitterSink._CR) { |
1373 skip = 1; | 1373 skip = 1; |
1374 if (dart.notNull(pos) + 1 < dart.notNull(end)) { | 1374 if (dart.notNull(pos) + 1 < dart.notNull(end)) { |
1375 if (chunk.codeUnitAt(dart.notNull(pos) + 1) === _LineSplitterSink._L
F) { | 1375 if (chunk.codeUnitAt(dart.notNull(pos) + 1) === _LineSplitterSink._L
F) { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1416 dart.defineNamedConstructor(StringConversionSink, 'withCallback'); | 1416 dart.defineNamedConstructor(StringConversionSink, 'withCallback'); |
1417 dart.defineNamedConstructor(StringConversionSink, 'from'); | 1417 dart.defineNamedConstructor(StringConversionSink, 'from'); |
1418 dart.defineNamedConstructor(StringConversionSink, 'fromStringSink'); | 1418 dart.defineNamedConstructor(StringConversionSink, 'fromStringSink'); |
1419 class ClosableStringSink extends core.StringSink { | 1419 class ClosableStringSink extends core.StringSink { |
1420 ClosableStringSink$fromStringSink(sink, onClose) { | 1420 ClosableStringSink$fromStringSink(sink, onClose) { |
1421 return new _ClosableStringSink(sink, onClose); | 1421 return new _ClosableStringSink(sink, onClose); |
1422 } | 1422 } |
1423 } | 1423 } |
1424 dart.defineNamedConstructor(ClosableStringSink, 'fromStringSink'); | 1424 dart.defineNamedConstructor(ClosableStringSink, 'fromStringSink'); |
1425 class _ClosableStringSink extends core.Object { | 1425 class _ClosableStringSink extends core.Object { |
1426 _ClosableStringSink($_sink, $_callback) { | 1426 _ClosableStringSink(sink$, callback$) { |
1427 this[_sink] = $_sink; | 1427 this[_sink] = sink$; |
1428 this[_callback] = $_callback; | 1428 this[_callback] = callback$; |
1429 } | 1429 } |
1430 close() { | 1430 close() { |
1431 return this[_callback](); | 1431 return this[_callback](); |
1432 } | 1432 } |
1433 writeCharCode(charCode) { | 1433 writeCharCode(charCode) { |
1434 return this[_sink].writeCharCode(charCode); | 1434 return this[_sink].writeCharCode(charCode); |
1435 } | 1435 } |
1436 write(o) { | 1436 write(o) { |
1437 return this[_sink].write(o); | 1437 return this[_sink].write(o); |
1438 } | 1438 } |
1439 writeln(o) { | 1439 writeln(o) { |
1440 if (o === void 0) | 1440 if (o === void 0) |
1441 o = ""; | 1441 o = ""; |
1442 return this[_sink].writeln(o); | 1442 return this[_sink].writeln(o); |
1443 } | 1443 } |
1444 writeAll(objects, separator) { | 1444 writeAll(objects, separator) { |
1445 if (separator === void 0) | 1445 if (separator === void 0) |
1446 separator = ""; | 1446 separator = ""; |
1447 return this[_sink].writeAll(objects, separator); | 1447 return this[_sink].writeAll(objects, separator); |
1448 } | 1448 } |
1449 } | 1449 } |
1450 let _flush = Symbol('_flush'); | 1450 let _flush = Symbol('_flush'); |
1451 class _StringConversionSinkAsStringSinkAdapter extends core.Object { | 1451 class _StringConversionSinkAsStringSinkAdapter extends core.Object { |
1452 _StringConversionSinkAsStringSinkAdapter($_chunkedSink) { | 1452 _StringConversionSinkAsStringSinkAdapter(chunkedSink) { |
1453 this[_chunkedSink] = $_chunkedSink; | 1453 this[_chunkedSink] = chunkedSink; |
1454 this[_buffer] = new core.StringBuffer(); | 1454 this[_buffer] = new core.StringBuffer(); |
1455 } | 1455 } |
1456 close() { | 1456 close() { |
1457 if (this[_buffer].isNotEmpty) | 1457 if (this[_buffer].isNotEmpty) |
1458 this[_flush](); | 1458 this[_flush](); |
1459 this[_chunkedSink].close(); | 1459 this[_chunkedSink].close(); |
1460 } | 1460 } |
1461 writeCharCode(charCode) { | 1461 writeCharCode(charCode) { |
1462 this[_buffer].writeCharCode(charCode); | 1462 this[_buffer].writeCharCode(charCode); |
1463 if (dart.notNull(this[_buffer].length) > dart.notNull(_StringConversionSin
kAsStringSinkAdapter._MIN_STRING_SIZE)) | 1463 if (dart.notNull(this[_buffer].length) > dart.notNull(_StringConversionSin
kAsStringSinkAdapter._MIN_STRING_SIZE)) |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1498 } | 1498 } |
1499 [_flush]() { | 1499 [_flush]() { |
1500 let accumulated = this[_buffer].toString(); | 1500 let accumulated = this[_buffer].toString(); |
1501 this[_buffer].clear(); | 1501 this[_buffer].clear(); |
1502 this[_chunkedSink].add(accumulated); | 1502 this[_chunkedSink].add(accumulated); |
1503 } | 1503 } |
1504 } | 1504 } |
1505 _StringConversionSinkAsStringSinkAdapter._MIN_STRING_SIZE = 16; | 1505 _StringConversionSinkAsStringSinkAdapter._MIN_STRING_SIZE = 16; |
1506 let _stringSink = Symbol('_stringSink'); | 1506 let _stringSink = Symbol('_stringSink'); |
1507 class _StringSinkConversionSink extends StringConversionSinkBase { | 1507 class _StringSinkConversionSink extends StringConversionSinkBase { |
1508 _StringSinkConversionSink($_stringSink) { | 1508 _StringSinkConversionSink(stringSink$) { |
1509 this[_stringSink] = $_stringSink; | 1509 this[_stringSink] = stringSink$; |
1510 super.StringConversionSinkBase(); | 1510 super.StringConversionSinkBase(); |
1511 } | 1511 } |
1512 close() {} | 1512 close() {} |
1513 addSlice(str, start, end, isLast) { | 1513 addSlice(str, start, end, isLast) { |
1514 if (start !== 0 || end !== str.length) { | 1514 if (start !== 0 || end !== str.length) { |
1515 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNul
l(i) + 1) { | 1515 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNul
l(i) + 1) { |
1516 this[_stringSink].writeCharCode(str.codeUnitAt(i)); | 1516 this[_stringSink].writeCharCode(str.codeUnitAt(i)); |
1517 } | 1517 } |
1518 } else { | 1518 } else { |
1519 this[_stringSink].write(str); | 1519 this[_stringSink].write(str); |
1520 } | 1520 } |
1521 if (isLast) | 1521 if (isLast) |
1522 this.close(); | 1522 this.close(); |
1523 } | 1523 } |
1524 add(str) { | 1524 add(str) { |
1525 return this[_stringSink].write(str); | 1525 return this[_stringSink].write(str); |
1526 } | 1526 } |
1527 asUtf8Sink(allowMalformed) { | 1527 asUtf8Sink(allowMalformed) { |
1528 return new _Utf8StringSinkAdapter(this, this[_stringSink], allowMalformed)
; | 1528 return new _Utf8StringSinkAdapter(this, this[_stringSink], allowMalformed)
; |
1529 } | 1529 } |
1530 asStringSink() { | 1530 asStringSink() { |
1531 return new ClosableStringSink.fromStringSink(this[_stringSink], this.close
); | 1531 return new ClosableStringSink.fromStringSink(this[_stringSink], this.close
); |
1532 } | 1532 } |
1533 } | 1533 } |
1534 class _StringCallbackSink extends _StringSinkConversionSink { | 1534 class _StringCallbackSink extends _StringSinkConversionSink { |
1535 _StringCallbackSink($_callback) { | 1535 _StringCallbackSink(callback$) { |
1536 this[_callback] = $_callback; | 1536 this[_callback] = callback$; |
1537 super._StringSinkConversionSink(new core.StringBuffer()); | 1537 super._StringSinkConversionSink(new core.StringBuffer()); |
1538 } | 1538 } |
1539 close() { | 1539 close() { |
1540 let buffer = dart.as(this[_stringSink], core.StringBuffer); | 1540 let buffer = dart.as(this[_stringSink], core.StringBuffer); |
1541 let accumulated = buffer.toString(); | 1541 let accumulated = buffer.toString(); |
1542 buffer.clear(); | 1542 buffer.clear(); |
1543 this[_callback](accumulated); | 1543 this[_callback](accumulated); |
1544 } | 1544 } |
1545 asUtf8Sink(allowMalformed) { | 1545 asUtf8Sink(allowMalformed) { |
1546 return new _Utf8StringSinkAdapter(this, this[_stringSink], allowMalformed)
; | 1546 return new _Utf8StringSinkAdapter(this, this[_stringSink], allowMalformed)
; |
1547 } | 1547 } |
1548 } | 1548 } |
1549 class _StringAdapterSink extends StringConversionSinkBase { | 1549 class _StringAdapterSink extends StringConversionSinkBase { |
1550 _StringAdapterSink($_sink) { | 1550 _StringAdapterSink(sink$) { |
1551 this[_sink] = $_sink; | 1551 this[_sink] = sink$; |
1552 super.StringConversionSinkBase(); | 1552 super.StringConversionSinkBase(); |
1553 } | 1553 } |
1554 add(str) { | 1554 add(str) { |
1555 return this[_sink].add(str); | 1555 return this[_sink].add(str); |
1556 } | 1556 } |
1557 addSlice(str, start, end, isLast) { | 1557 addSlice(str, start, end, isLast) { |
1558 if (start === 0 && end === str.length) { | 1558 if (start === 0 && end === str.length) { |
1559 this.add(str); | 1559 this.add(str); |
1560 } else { | 1560 } else { |
1561 this.add(str.substring(start, end)); | 1561 this.add(str.substring(start, end)); |
1562 } | 1562 } |
1563 if (isLast) | 1563 if (isLast) |
1564 this.close(); | 1564 this.close(); |
1565 } | 1565 } |
1566 close() { | 1566 close() { |
1567 return this[_sink].close(); | 1567 return this[_sink].close(); |
1568 } | 1568 } |
1569 } | 1569 } |
1570 let _decoder = Symbol('_decoder'); | 1570 let _decoder = Symbol('_decoder'); |
1571 class _Utf8StringSinkAdapter extends ByteConversionSink { | 1571 class _Utf8StringSinkAdapter extends ByteConversionSink { |
1572 _Utf8StringSinkAdapter($_sink, stringSink, allowMalformed) { | 1572 _Utf8StringSinkAdapter(sink$, stringSink, allowMalformed) { |
1573 this[_sink] = $_sink; | 1573 this[_sink] = sink$; |
1574 this[_decoder] = new _Utf8Decoder(stringSink, allowMalformed); | 1574 this[_decoder] = new _Utf8Decoder(stringSink, allowMalformed); |
1575 super.ByteConversionSink(); | 1575 super.ByteConversionSink(); |
1576 } | 1576 } |
1577 close() { | 1577 close() { |
1578 this[_decoder].close(); | 1578 this[_decoder].close(); |
1579 if (this[_sink] !== null) | 1579 if (this[_sink] !== null) |
1580 this[_sink].close(); | 1580 this[_sink].close(); |
1581 } | 1581 } |
1582 add(chunk) { | 1582 add(chunk) { |
1583 this.addSlice(chunk, 0, chunk.length, false); | 1583 this.addSlice(chunk, 0, chunk.length, false); |
1584 } | 1584 } |
1585 addSlice(codeUnits, startIndex, endIndex, isLast) { | 1585 addSlice(codeUnits, startIndex, endIndex, isLast) { |
1586 this[_decoder].convert(codeUnits, startIndex, endIndex); | 1586 this[_decoder].convert(codeUnits, startIndex, endIndex); |
1587 if (isLast) | 1587 if (isLast) |
1588 this.close(); | 1588 this.close(); |
1589 } | 1589 } |
1590 } | 1590 } |
1591 let _Utf8ConversionSink$_ = Symbol('_Utf8ConversionSink$_'); | 1591 let _Utf8ConversionSink$_ = Symbol('_Utf8ConversionSink$_'); |
1592 class _Utf8ConversionSink extends ByteConversionSink { | 1592 class _Utf8ConversionSink extends ByteConversionSink { |
1593 _Utf8ConversionSink(sink, allowMalformed) { | 1593 _Utf8ConversionSink(sink, allowMalformed) { |
1594 this[_Utf8ConversionSink$_](sink, new core.StringBuffer(), allowMalformed)
; | 1594 this[_Utf8ConversionSink$_](sink, new core.StringBuffer(), allowMalformed)
; |
1595 } | 1595 } |
1596 _Utf8ConversionSink$_($_chunkedSink, stringBuffer, allowMalformed) { | 1596 _Utf8ConversionSink$_(chunkedSink, stringBuffer, allowMalformed) { |
1597 this[_chunkedSink] = $_chunkedSink; | 1597 this[_chunkedSink] = chunkedSink; |
1598 this[_decoder] = new _Utf8Decoder(stringBuffer, allowMalformed); | 1598 this[_decoder] = new _Utf8Decoder(stringBuffer, allowMalformed); |
1599 this[_buffer] = stringBuffer; | 1599 this[_buffer] = stringBuffer; |
1600 super.ByteConversionSink(); | 1600 super.ByteConversionSink(); |
1601 } | 1601 } |
1602 close() { | 1602 close() { |
1603 this[_decoder].close(); | 1603 this[_decoder].close(); |
1604 if (this[_buffer].isNotEmpty) { | 1604 if (this[_buffer].isNotEmpty) { |
1605 let accumulated = this[_buffer].toString(); | 1605 let accumulated = this[_buffer].toString(); |
1606 this[_buffer].clear(); | 1606 this[_buffer].clear(); |
1607 this[_chunkedSink].addSlice(accumulated, 0, accumulated.length, true); | 1607 this[_chunkedSink].addSlice(accumulated, 0, accumulated.length, true); |
(...skipping 15 matching lines...) Expand all Loading... |
1623 if (isLast) | 1623 if (isLast) |
1624 this.close(); | 1624 this.close(); |
1625 } | 1625 } |
1626 } | 1626 } |
1627 dart.defineNamedConstructor(_Utf8ConversionSink, '_'); | 1627 dart.defineNamedConstructor(_Utf8ConversionSink, '_'); |
1628 let UNICODE_REPLACEMENT_CHARACTER_RUNE = 65533; | 1628 let UNICODE_REPLACEMENT_CHARACTER_RUNE = 65533; |
1629 let UNICODE_BOM_CHARACTER_RUNE = 65279; | 1629 let UNICODE_BOM_CHARACTER_RUNE = 65279; |
1630 let UTF8 = new Utf8Codec(); | 1630 let UTF8 = new Utf8Codec(); |
1631 let _allowMalformed = Symbol('_allowMalformed'); | 1631 let _allowMalformed = Symbol('_allowMalformed'); |
1632 class Utf8Codec extends Encoding { | 1632 class Utf8Codec extends Encoding { |
1633 Utf8Codec(opt$) { | 1633 Utf8Codec(opts) { |
1634 let allowMalformed = opt$ && 'allowMalformed' in opt$ ? opt$.allowMalforme
d : false; | 1634 let allowMalformed = opts && 'allowMalformed' in opts ? opts.allowMalforme
d : false; |
1635 this[_allowMalformed] = allowMalformed; | 1635 this[_allowMalformed] = allowMalformed; |
1636 super.Encoding(); | 1636 super.Encoding(); |
1637 } | 1637 } |
1638 get name() { | 1638 get name() { |
1639 return "utf-8"; | 1639 return "utf-8"; |
1640 } | 1640 } |
1641 decode(codeUnits, opt$) { | 1641 decode(codeUnits, opts) { |
1642 let allowMalformed = opt$ && 'allowMalformed' in opt$ ? opt$.allowMalforme
d : null; | 1642 let allowMalformed = opts && 'allowMalformed' in opts ? opts.allowMalforme
d : null; |
1643 if (allowMalformed === null) | 1643 if (allowMalformed === null) |
1644 allowMalformed = this[_allowMalformed]; | 1644 allowMalformed = this[_allowMalformed]; |
1645 return new Utf8Decoder({allowMalformed: allowMalformed}).convert(codeUnits
); | 1645 return new Utf8Decoder({allowMalformed: allowMalformed}).convert(codeUnits
); |
1646 } | 1646 } |
1647 get encoder() { | 1647 get encoder() { |
1648 return new Utf8Encoder(); | 1648 return new Utf8Encoder(); |
1649 } | 1649 } |
1650 get decoder() { | 1650 get decoder() { |
1651 return new Utf8Decoder({allowMalformed: this[_allowMalformed]}); | 1651 return new Utf8Decoder({allowMalformed: this[_allowMalformed]}); |
1652 } | 1652 } |
(...skipping 29 matching lines...) Expand all Loading... |
1682 if (!dart.is(sink, ByteConversionSink)) { | 1682 if (!dart.is(sink, ByteConversionSink)) { |
1683 sink = new ByteConversionSink.from(sink); | 1683 sink = new ByteConversionSink.from(sink); |
1684 } | 1684 } |
1685 return new _Utf8EncoderSink(dart.as(sink, ByteConversionSink)); | 1685 return new _Utf8EncoderSink(dart.as(sink, ByteConversionSink)); |
1686 } | 1686 } |
1687 bind(stream) { | 1687 bind(stream) { |
1688 return dart.as(super.bind(stream), async.Stream$(core.List$(core.int))); | 1688 return dart.as(super.bind(stream), async.Stream$(core.List$(core.int))); |
1689 } | 1689 } |
1690 } | 1690 } |
1691 let _Utf8Encoder$withBufferSize = Symbol('_Utf8Encoder$withBufferSize'); | 1691 let _Utf8Encoder$withBufferSize = Symbol('_Utf8Encoder$withBufferSize'); |
1692 let _createBuffer = Symbol('_createBuffer'); | 1692 let _createBuffer$ = Symbol('_createBuffer'); |
1693 let _writeSurrogate = Symbol('_writeSurrogate'); | 1693 let _writeSurrogate = Symbol('_writeSurrogate'); |
1694 let _fillBuffer = Symbol('_fillBuffer'); | 1694 let _fillBuffer = Symbol('_fillBuffer'); |
1695 class _Utf8Encoder extends core.Object { | 1695 class _Utf8Encoder extends core.Object { |
1696 _Utf8Encoder() { | 1696 _Utf8Encoder() { |
1697 this[_Utf8Encoder$withBufferSize](_Utf8Encoder._DEFAULT_BYTE_BUFFER_SIZE); | 1697 this[_Utf8Encoder$withBufferSize](_Utf8Encoder._DEFAULT_BYTE_BUFFER_SIZE); |
1698 } | 1698 } |
1699 _Utf8Encoder$withBufferSize(bufferSize) { | 1699 _Utf8Encoder$withBufferSize(bufferSize) { |
1700 this[_buffer] = _createBuffer(bufferSize); | 1700 this[_buffer] = _createBuffer(bufferSize); |
1701 this[_carry] = 0; | 1701 this[_carry] = 0; |
1702 this[_bufferIndex] = 0; | 1702 this[_bufferIndex] = 0; |
1703 } | 1703 } |
1704 static [_createBuffer](size) { | 1704 static [_createBuffer$](size) { |
1705 return new typed_data.Uint8List(size); | 1705 return new typed_data.Uint8List(size); |
1706 } | 1706 } |
1707 [_writeSurrogate](leadingSurrogate, nextCodeUnit) { | 1707 [_writeSurrogate](leadingSurrogate, nextCodeUnit) { |
1708 if (_isTailSurrogate(nextCodeUnit)) { | 1708 if (_isTailSurrogate(nextCodeUnit)) { |
1709 let rune = _combineSurrogatePair(leadingSurrogate, nextCodeUnit); | 1709 let rune = _combineSurrogatePair(leadingSurrogate, nextCodeUnit); |
1710 dart.assert(dart.notNull(rune) > dart.notNull(_THREE_BYTE_LIMIT)); | 1710 dart.assert(dart.notNull(rune) > dart.notNull(_THREE_BYTE_LIMIT)); |
1711 dart.assert(dart.notNull(rune) <= dart.notNull(_FOUR_BYTE_LIMIT)); | 1711 dart.assert(dart.notNull(rune) <= dart.notNull(_FOUR_BYTE_LIMIT)); |
1712 this[_buffer].set((($tmp) => this[_bufferIndex] = dart.notNull($tmp) + 1
, $tmp).bind(this)(this[_bufferIndex]), 240 | dart.notNull(rune) >> 18); | 1712 this[_buffer].set(((x) => this[_bufferIndex] = dart.notNull(x$) + 1, x$)
.bind(this)(this[_bufferIndex]), 240 | dart.notNull(rune) >> 18); |
1713 this[_buffer].set((($tmp) => this[_bufferIndex] = dart.notNull($tmp) + 1
, $tmp).bind(this)(this[_bufferIndex]), 128 | dart.notNull(rune) >> 12 & 63); | 1713 this[_buffer].set(((x) => this[_bufferIndex] = dart.notNull(x$) + 1, x$)
.bind(this)(this[_bufferIndex]), 128 | dart.notNull(rune) >> 12 & 63); |
1714 this[_buffer].set((($tmp) => this[_bufferIndex] = dart.notNull($tmp) + 1
, $tmp).bind(this)(this[_bufferIndex]), 128 | dart.notNull(rune) >> 6 & 63); | 1714 this[_buffer].set(((x) => this[_bufferIndex] = dart.notNull(x$) + 1, x$)
.bind(this)(this[_bufferIndex]), 128 | dart.notNull(rune) >> 6 & 63); |
1715 this[_buffer].set((($tmp) => this[_bufferIndex] = dart.notNull($tmp) + 1
, $tmp).bind(this)(this[_bufferIndex]), 128 | dart.notNull(rune) & 63); | 1715 this[_buffer].set(((x) => this[_bufferIndex] = dart.notNull(x$) + 1, x$)
.bind(this)(this[_bufferIndex]), 128 | dart.notNull(rune) & 63); |
1716 return true; | 1716 return true; |
1717 } else { | 1717 } else { |
1718 this[_buffer].set((($tmp) => this[_bufferIndex] = dart.notNull($tmp) + 1
, $tmp).bind(this)(this[_bufferIndex]), 224 | dart.notNull(leadingSurrogate) >>
12); | 1718 this[_buffer].set(((x) => this[_bufferIndex] = dart.notNull(x$) + 1, x$)
.bind(this)(this[_bufferIndex]), 224 | dart.notNull(leadingSurrogate) >> 12); |
1719 this[_buffer].set((($tmp) => this[_bufferIndex] = dart.notNull($tmp) + 1
, $tmp).bind(this)(this[_bufferIndex]), 128 | dart.notNull(leadingSurrogate) >>
6 & 63); | 1719 this[_buffer].set(((x) => this[_bufferIndex] = dart.notNull(x$) + 1, x$)
.bind(this)(this[_bufferIndex]), 128 | dart.notNull(leadingSurrogate) >> 6 & 63)
; |
1720 this[_buffer].set((($tmp) => this[_bufferIndex] = dart.notNull($tmp) + 1
, $tmp).bind(this)(this[_bufferIndex]), 128 | dart.notNull(leadingSurrogate) & 6
3); | 1720 this[_buffer].set(((x) => this[_bufferIndex] = dart.notNull(x$) + 1, x$)
.bind(this)(this[_bufferIndex]), 128 | dart.notNull(leadingSurrogate) & 63); |
1721 return false; | 1721 return false; |
1722 } | 1722 } |
1723 } | 1723 } |
1724 [_fillBuffer](str, start, end) { | 1724 [_fillBuffer](str, start, end) { |
1725 if (start !== end && dart.notNull(_isLeadSurrogate(str.codeUnitAt(dart.not
Null(end) - 1)))) { | 1725 if (start !== end && dart.notNull(_isLeadSurrogate(str.codeUnitAt(dart.not
Null(end) - 1)))) { |
1726 end = dart.notNull(end) - 1; | 1726 end = dart.notNull(end) - 1; |
1727 } | 1727 } |
1728 let stringIndex = null; | 1728 let stringIndex = null; |
1729 for (stringIndex = start; dart.notNull(stringIndex) < dart.notNull(end); s
tringIndex = dart.notNull(stringIndex) + 1) { | 1729 for (stringIndex = start; dart.notNull(stringIndex) < dart.notNull(end); s
tringIndex = dart.notNull(stringIndex) + 1) { |
1730 let codeUnit = str.codeUnitAt(stringIndex); | 1730 let codeUnit = str.codeUnitAt(stringIndex); |
1731 if (dart.notNull(codeUnit) <= dart.notNull(_ONE_BYTE_LIMIT)) { | 1731 if (dart.notNull(codeUnit) <= dart.notNull(_ONE_BYTE_LIMIT)) { |
1732 if (dart.notNull(this[_bufferIndex]) >= dart.notNull(this[_buffer].len
gth)) | 1732 if (dart.notNull(this[_bufferIndex]) >= dart.notNull(this[_buffer].len
gth)) |
1733 break; | 1733 break; |
1734 this[_buffer].set((($tmp) => this[_bufferIndex] = dart.notNull($tmp) +
1, $tmp).bind(this)(this[_bufferIndex]), codeUnit); | 1734 this[_buffer].set(((x) => this[_bufferIndex] = dart.notNull(x$) + 1, x
$).bind(this)(this[_bufferIndex]), codeUnit); |
1735 } else if (_isLeadSurrogate(codeUnit)) { | 1735 } else if (_isLeadSurrogate(codeUnit)) { |
1736 if (dart.notNull(this[_bufferIndex]) + 3 >= dart.notNull(this[_buffer]
.length)) | 1736 if (dart.notNull(this[_bufferIndex]) + 3 >= dart.notNull(this[_buffer]
.length)) |
1737 break; | 1737 break; |
1738 let nextCodeUnit = str.codeUnitAt(dart.notNull(stringIndex) + 1); | 1738 let nextCodeUnit = str.codeUnitAt(dart.notNull(stringIndex) + 1); |
1739 let wasCombined = this[_writeSurrogate](codeUnit, nextCodeUnit); | 1739 let wasCombined = this[_writeSurrogate](codeUnit, nextCodeUnit); |
1740 if (wasCombined) | 1740 if (wasCombined) |
1741 stringIndex = dart.notNull(stringIndex) + 1; | 1741 stringIndex = dart.notNull(stringIndex) + 1; |
1742 } else { | 1742 } else { |
1743 let rune = codeUnit; | 1743 let rune = codeUnit; |
1744 if (dart.notNull(rune) <= dart.notNull(_TWO_BYTE_LIMIT)) { | 1744 if (dart.notNull(rune) <= dart.notNull(_TWO_BYTE_LIMIT)) { |
1745 if (dart.notNull(this[_bufferIndex]) + 1 >= dart.notNull(this[_buffe
r].length)) | 1745 if (dart.notNull(this[_bufferIndex]) + 1 >= dart.notNull(this[_buffe
r].length)) |
1746 break; | 1746 break; |
1747 this[_buffer].set((($tmp) => this[_bufferIndex] = dart.notNull($tmp)
+ 1, $tmp).bind(this)(this[_bufferIndex]), 192 | dart.notNull(rune) >> 6); | 1747 this[_buffer].set(((x) => this[_bufferIndex] = dart.notNull(x$) + 1,
x$).bind(this)(this[_bufferIndex]), 192 | dart.notNull(rune) >> 6); |
1748 this[_buffer].set((($tmp) => this[_bufferIndex] = dart.notNull($tmp)
+ 1, $tmp).bind(this)(this[_bufferIndex]), 128 | dart.notNull(rune) & 63); | 1748 this[_buffer].set(((x) => this[_bufferIndex] = dart.notNull(x$) + 1,
x$).bind(this)(this[_bufferIndex]), 128 | dart.notNull(rune) & 63); |
1749 } else { | 1749 } else { |
1750 dart.assert(dart.notNull(rune) <= dart.notNull(_THREE_BYTE_LIMIT)); | 1750 dart.assert(dart.notNull(rune) <= dart.notNull(_THREE_BYTE_LIMIT)); |
1751 if (dart.notNull(this[_bufferIndex]) + 2 >= dart.notNull(this[_buffe
r].length)) | 1751 if (dart.notNull(this[_bufferIndex]) + 2 >= dart.notNull(this[_buffe
r].length)) |
1752 break; | 1752 break; |
1753 this[_buffer].set((($tmp) => this[_bufferIndex] = dart.notNull($tmp)
+ 1, $tmp).bind(this)(this[_bufferIndex]), 224 | dart.notNull(rune) >> 12); | 1753 this[_buffer].set(((x) => this[_bufferIndex] = dart.notNull(x$) + 1,
x$).bind(this)(this[_bufferIndex]), 224 | dart.notNull(rune) >> 12); |
1754 this[_buffer].set((($tmp) => this[_bufferIndex] = dart.notNull($tmp)
+ 1, $tmp).bind(this)(this[_bufferIndex]), 128 | dart.notNull(rune) >> 6 & 63); | 1754 this[_buffer].set(((x) => this[_bufferIndex] = dart.notNull(x$) + 1,
x$).bind(this)(this[_bufferIndex]), 128 | dart.notNull(rune) >> 6 & 63); |
1755 this[_buffer].set((($tmp) => this[_bufferIndex] = dart.notNull($tmp)
+ 1, $tmp).bind(this)(this[_bufferIndex]), 128 | dart.notNull(rune) & 63); | 1755 this[_buffer].set(((x) => this[_bufferIndex] = dart.notNull(x$) + 1,
x$).bind(this)(this[_bufferIndex]), 128 | dart.notNull(rune) & 63); |
1756 } | 1756 } |
1757 } | 1757 } |
1758 } | 1758 } |
1759 return stringIndex; | 1759 return stringIndex; |
1760 } | 1760 } |
1761 } | 1761 } |
1762 dart.defineNamedConstructor(_Utf8Encoder, 'withBufferSize'); | 1762 dart.defineNamedConstructor(_Utf8Encoder, 'withBufferSize'); |
1763 _Utf8Encoder._DEFAULT_BYTE_BUFFER_SIZE = 1024; | 1763 _Utf8Encoder._DEFAULT_BYTE_BUFFER_SIZE = 1024; |
1764 class _Utf8EncoderSink extends dart.mixin(_Utf8Encoder, StringConversionSinkMi
xin) { | 1764 class _Utf8EncoderSink extends dart.mixin(_Utf8Encoder, StringConversionSinkMi
xin) { |
1765 _Utf8EncoderSink($_sink) { | 1765 _Utf8EncoderSink(sink$) { |
1766 this[_sink] = $_sink; | 1766 this[_sink] = sink$; |
1767 super._Utf8Encoder(); | 1767 super._Utf8Encoder(); |
1768 } | 1768 } |
1769 close() { | 1769 close() { |
1770 if (this[_carry] !== 0) { | 1770 if (this[_carry] !== 0) { |
1771 this.addSlice("", 0, 0, true); | 1771 this.addSlice("", 0, 0, true); |
1772 return; | 1772 return; |
1773 } | 1773 } |
1774 this[_sink].close(); | 1774 this[_sink].close(); |
1775 } | 1775 } |
1776 addSlice(str, start, end, isLast) { | 1776 addSlice(str, start, end, isLast) { |
(...skipping 27 matching lines...) Expand all Loading... |
1804 start = dart.notNull(start) + 1; | 1804 start = dart.notNull(start) + 1; |
1805 } | 1805 } |
1806 this[_sink].addSlice(this[_buffer], 0, this[_bufferIndex], isLastSlice); | 1806 this[_sink].addSlice(this[_buffer], 0, this[_bufferIndex], isLastSlice); |
1807 this[_bufferIndex] = 0; | 1807 this[_bufferIndex] = 0; |
1808 } while (dart.notNull(start) < dart.notNull(end)); | 1808 } while (dart.notNull(start) < dart.notNull(end)); |
1809 if (isLast) | 1809 if (isLast) |
1810 this.close(); | 1810 this.close(); |
1811 } | 1811 } |
1812 } | 1812 } |
1813 class Utf8Decoder extends Converter$(core.List$(core.int), core.String) { | 1813 class Utf8Decoder extends Converter$(core.List$(core.int), core.String) { |
1814 Utf8Decoder(opt$) { | 1814 Utf8Decoder(opts) { |
1815 let allowMalformed = opt$ && 'allowMalformed' in opt$ ? opt$.allowMalforme
d : false; | 1815 let allowMalformed = opts && 'allowMalformed' in opts ? opts.allowMalforme
d : false; |
1816 this[_allowMalformed] = allowMalformed; | 1816 this[_allowMalformed] = allowMalformed; |
1817 super.Converter(); | 1817 super.Converter(); |
1818 } | 1818 } |
1819 convert(codeUnits, start, end) { | 1819 convert(codeUnits, start, end) { |
1820 if (start === void 0) | 1820 if (start === void 0) |
1821 start = 0; | 1821 start = 0; |
1822 if (end === void 0) | 1822 if (end === void 0) |
1823 end = null; | 1823 end = null; |
1824 let length = codeUnits.length; | 1824 let length = codeUnits.length; |
1825 core.RangeError.checkValidRange(start, end, length); | 1825 core.RangeError.checkValidRange(start, end, length); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1870 } | 1870 } |
1871 // Function _combineSurrogatePair: (int, int) → int | 1871 // Function _combineSurrogatePair: (int, int) → int |
1872 function _combineSurrogatePair(lead, tail) { | 1872 function _combineSurrogatePair(lead, tail) { |
1873 return 65536 + ((dart.notNull(lead) & dart.notNull(_SURROGATE_VALUE_MASK)) <
< 10) | dart.notNull(tail) & dart.notNull(_SURROGATE_VALUE_MASK); | 1873 return 65536 + ((dart.notNull(lead) & dart.notNull(_SURROGATE_VALUE_MASK)) <
< 10) | dart.notNull(tail) & dart.notNull(_SURROGATE_VALUE_MASK); |
1874 } | 1874 } |
1875 let _isFirstCharacter = Symbol('_isFirstCharacter'); | 1875 let _isFirstCharacter = Symbol('_isFirstCharacter'); |
1876 let _value = Symbol('_value'); | 1876 let _value = Symbol('_value'); |
1877 let _expectedUnits = Symbol('_expectedUnits'); | 1877 let _expectedUnits = Symbol('_expectedUnits'); |
1878 let _extraUnits = Symbol('_extraUnits'); | 1878 let _extraUnits = Symbol('_extraUnits'); |
1879 class _Utf8Decoder extends core.Object { | 1879 class _Utf8Decoder extends core.Object { |
1880 _Utf8Decoder($_stringSink, $_allowMalformed) { | 1880 _Utf8Decoder(stringSink$, allowMalformed$) { |
1881 this[_stringSink] = $_stringSink; | 1881 this[_stringSink] = stringSink$; |
1882 this[_allowMalformed] = $_allowMalformed; | 1882 this[_allowMalformed] = allowMalformed$; |
1883 this[_isFirstCharacter] = true; | 1883 this[_isFirstCharacter] = true; |
1884 this[_value] = 0; | 1884 this[_value] = 0; |
1885 this[_expectedUnits] = 0; | 1885 this[_expectedUnits] = 0; |
1886 this[_extraUnits] = 0; | 1886 this[_extraUnits] = 0; |
1887 } | 1887 } |
1888 get hasPartialInput() { | 1888 get hasPartialInput() { |
1889 return dart.notNull(this[_expectedUnits]) > 0; | 1889 return dart.notNull(this[_expectedUnits]) > 0; |
1890 } | 1890 } |
1891 close() { | 1891 close() { |
1892 this.flush(); | 1892 this.flush(); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1970 } | 1970 } |
1971 while (dart.notNull(i) < dart.notNull(endIndex)) { | 1971 while (dart.notNull(i) < dart.notNull(endIndex)) { |
1972 let oneBytes = scanOneByteCharacters(codeUnits, i); | 1972 let oneBytes = scanOneByteCharacters(codeUnits, i); |
1973 if (dart.notNull(oneBytes) > 0) { | 1973 if (dart.notNull(oneBytes) > 0) { |
1974 this[_isFirstCharacter] = false; | 1974 this[_isFirstCharacter] = false; |
1975 addSingleBytes(i, dart.notNull(i) + dart.notNull(oneBytes)); | 1975 addSingleBytes(i, dart.notNull(i) + dart.notNull(oneBytes)); |
1976 i = oneBytes; | 1976 i = oneBytes; |
1977 if (i === endIndex) | 1977 if (i === endIndex) |
1978 break; | 1978 break; |
1979 } | 1979 } |
1980 let unit = codeUnits.get((($tmp) => i = dart.notNull($tmp) + 1, $tmp
)(i)); | 1980 let unit = codeUnits.get(((x) => i = dart.notNull(x$) + 1, x$)(i)); |
1981 if (dart.notNull(unit) < 0) { | 1981 if (dart.notNull(unit) < 0) { |
1982 if (!dart.notNull(this[_allowMalformed])) { | 1982 if (!dart.notNull(this[_allowMalformed])) { |
1983 throw new core.FormatException(`Negative UTF-8 code unit: -0x${(
-dart.notNull(unit)).toRadixString(16)}`); | 1983 throw new core.FormatException(`Negative UTF-8 code unit: -0x${(
-dart.notNull(unit)).toRadixString(16)}`); |
1984 } | 1984 } |
1985 this[_stringSink].writeCharCode(UNICODE_REPLACEMENT_CHARACTER_RUNE
); | 1985 this[_stringSink].writeCharCode(UNICODE_REPLACEMENT_CHARACTER_RUNE
); |
1986 } else { | 1986 } else { |
1987 dart.assert(dart.notNull(unit) > dart.notNull(_ONE_BYTE_LIMIT)); | 1987 dart.assert(dart.notNull(unit) > dart.notNull(_ONE_BYTE_LIMIT)); |
1988 if ((dart.notNull(unit) & 224) === 192) { | 1988 if ((dart.notNull(unit) & 224) === 192) { |
1989 value = dart.notNull(unit) & 31; | 1989 value = dart.notNull(unit) & 31; |
1990 expectedUnits = extraUnits = 1; | 1990 expectedUnits = extraUnits = 1; |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2064 object[i] = _convertJsonToDartLazy(item); | 2064 object[i] = _convertJsonToDartLazy(item); |
2065 } | 2065 } |
2066 return object; | 2066 return object; |
2067 } | 2067 } |
2068 let _data = Symbol('_data'); | 2068 let _data = Symbol('_data'); |
2069 let _isUpgraded = Symbol('_isUpgraded'); | 2069 let _isUpgraded = Symbol('_isUpgraded'); |
2070 let _upgradedMap = Symbol('_upgradedMap'); | 2070 let _upgradedMap = Symbol('_upgradedMap'); |
2071 let _process = Symbol('_process'); | 2071 let _process = Symbol('_process'); |
2072 let _computeKeys = Symbol('_computeKeys'); | 2072 let _computeKeys = Symbol('_computeKeys'); |
2073 let _upgrade = Symbol('_upgrade'); | 2073 let _upgrade = Symbol('_upgrade'); |
2074 let _hasProperty = Symbol('_hasProperty'); | 2074 let _hasProperty$ = Symbol('_hasProperty'); |
2075 let _getProperty = Symbol('_getProperty'); | 2075 let _getProperty$ = Symbol('_getProperty'); |
2076 let _setProperty = Symbol('_setProperty'); | 2076 let _setProperty$ = Symbol('_setProperty'); |
2077 let _getPropertyNames = Symbol('_getPropertyNames'); | 2077 let _getPropertyNames$ = Symbol('_getPropertyNames'); |
2078 let _isUnprocessed = Symbol('_isUnprocessed'); | 2078 let _isUnprocessed$ = Symbol('_isUnprocessed'); |
2079 let _newJavaScriptObject = Symbol('_newJavaScriptObject'); | 2079 let _newJavaScriptObject$ = Symbol('_newJavaScriptObject'); |
2080 class _JsonMap extends core.Object { | 2080 class _JsonMap extends core.Object { |
2081 _JsonMap($_original) { | 2081 _JsonMap(original$) { |
2082 this[_processed] = _newJavaScriptObject(); | 2082 this[_processed] = _newJavaScriptObject(); |
2083 this[_original] = $_original; | 2083 this[_original] = original$; |
2084 this[_data] = null; | 2084 this[_data] = null; |
2085 } | 2085 } |
2086 get(key) { | 2086 get(key) { |
2087 if (this[_isUpgraded]) { | 2087 if (this[_isUpgraded]) { |
2088 return this[_upgradedMap].get(key); | 2088 return this[_upgradedMap].get(key); |
2089 } else if (!(typeof key == string)) { | 2089 } else if (!(typeof key == string)) { |
2090 return null; | 2090 return null; |
2091 } else { | 2091 } else { |
2092 let result = _getProperty(this[_processed], dart.as(key, core.String)); | 2092 let result = _getProperty(this[_processed], dart.as(key, core.String)); |
2093 if (_isUnprocessed(result)) | 2093 if (_isUnprocessed(result)) |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2227 this[_data] = result; | 2227 this[_data] = result; |
2228 dart.assert(this[_isUpgraded]); | 2228 dart.assert(this[_isUpgraded]); |
2229 return result; | 2229 return result; |
2230 } | 2230 } |
2231 [_process](key) { | 2231 [_process](key) { |
2232 if (!dart.notNull(_hasProperty(this[_original], key))) | 2232 if (!dart.notNull(_hasProperty(this[_original], key))) |
2233 return null; | 2233 return null; |
2234 let result = _convertJsonToDartLazy(_getProperty(this[_original], key)); | 2234 let result = _convertJsonToDartLazy(_getProperty(this[_original], key)); |
2235 return _setProperty(this[_processed], key, result); | 2235 return _setProperty(this[_processed], key, result); |
2236 } | 2236 } |
2237 static [_hasProperty](object, key) { | 2237 static [_hasProperty$](object, key) { |
2238 return Object.prototype.hasOwnProperty.call(object, key); | 2238 return Object.prototype.hasOwnProperty.call(object, key); |
2239 } | 2239 } |
2240 static [_getProperty](object, key) { | 2240 static [_getProperty$](object, key) { |
2241 return object[key]; | 2241 return object[key]; |
2242 } | 2242 } |
2243 static [_setProperty](object, key, value) { | 2243 static [_setProperty$](object, key, value) { |
2244 return object[key] = value; | 2244 return object[key] = value; |
2245 } | 2245 } |
2246 static [_getPropertyNames](object) { | 2246 static [_getPropertyNames$](object) { |
2247 return dart.as(Object.keys(object), core.List); | 2247 return dart.as(Object.keys(object), core.List); |
2248 } | 2248 } |
2249 static [_isUnprocessed](object) { | 2249 static [_isUnprocessed$](object) { |
2250 return typeof object == "undefined"; | 2250 return typeof object == "undefined"; |
2251 } | 2251 } |
2252 static [_newJavaScriptObject]() { | 2252 static [_newJavaScriptObject$]() { |
2253 return Object.create(null); | 2253 return Object.create(null); |
2254 } | 2254 } |
2255 } | 2255 } |
2256 let _parent = Symbol('_parent'); | 2256 let _parent = Symbol('_parent'); |
2257 class _JsonMapKeyIterable extends _internal.ListIterable { | 2257 class _JsonMapKeyIterable extends _internal.ListIterable { |
2258 _JsonMapKeyIterable($_parent) { | 2258 _JsonMapKeyIterable(parent) { |
2259 this[_parent] = $_parent; | 2259 this[_parent] = parent; |
2260 super.ListIterable(); | 2260 super.ListIterable(); |
2261 } | 2261 } |
2262 get length() { | 2262 get length() { |
2263 return this[_parent].length; | 2263 return this[_parent].length; |
2264 } | 2264 } |
2265 elementAt(index) { | 2265 elementAt(index) { |
2266 return dart.as(this[_parent][_isUpgraded] ? this[_parent].keys.elementAt(i
ndex) : this[_parent]._computeKeys().get(index), core.String); | 2266 return dart.as(this[_parent][_isUpgraded] ? this[_parent].keys.elementAt(i
ndex) : this[_parent]._computeKeys().get(index), core.String); |
2267 } | 2267 } |
2268 get iterator() { | 2268 get iterator() { |
2269 return dart.as(this[_parent][_isUpgraded] ? this[_parent].keys.iterator :
this[_parent]._computeKeys().iterator, core.Iterator); | 2269 return dart.as(this[_parent][_isUpgraded] ? this[_parent].keys.iterator :
this[_parent]._computeKeys().iterator, core.Iterator); |
2270 } | 2270 } |
2271 contains(key) { | 2271 contains(key) { |
2272 return this[_parent].containsKey(key); | 2272 return this[_parent].containsKey(key); |
2273 } | 2273 } |
2274 } | 2274 } |
2275 class _JsonDecoderSink extends _StringSinkConversionSink { | 2275 class _JsonDecoderSink extends _StringSinkConversionSink { |
2276 _JsonDecoderSink($_reviver, $_sink) { | 2276 _JsonDecoderSink(reviver$, sink$) { |
2277 this[_reviver] = $_reviver; | 2277 this[_reviver] = reviver$; |
2278 this[_sink] = $_sink; | 2278 this[_sink] = sink$; |
2279 super._StringSinkConversionSink(new core.StringBuffer()); | 2279 super._StringSinkConversionSink(new core.StringBuffer()); |
2280 } | 2280 } |
2281 close() { | 2281 close() { |
2282 super.close(); | 2282 super.close(); |
2283 let buffer = dart.as(this[_stringSink], core.StringBuffer); | 2283 let buffer = dart.as(this[_stringSink], core.StringBuffer); |
2284 let accumulated = buffer.toString(); | 2284 let accumulated = buffer.toString(); |
2285 buffer.clear(); | 2285 buffer.clear(); |
2286 let decoded = _parseJson(accumulated, this[_reviver]); | 2286 let decoded = _parseJson(accumulated, this[_reviver]); |
2287 this[_sink].add(decoded); | 2287 this[_sink].add(decoded); |
2288 this[_sink].close(); | 2288 this[_sink].close(); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2321 exports.LineSplitter = LineSplitter; | 2321 exports.LineSplitter = LineSplitter; |
2322 exports.StringConversionSink = StringConversionSink; | 2322 exports.StringConversionSink = StringConversionSink; |
2323 exports.ClosableStringSink = ClosableStringSink; | 2323 exports.ClosableStringSink = ClosableStringSink; |
2324 exports.UNICODE_REPLACEMENT_CHARACTER_RUNE = UNICODE_REPLACEMENT_CHARACTER_RUN
E; | 2324 exports.UNICODE_REPLACEMENT_CHARACTER_RUNE = UNICODE_REPLACEMENT_CHARACTER_RUN
E; |
2325 exports.UNICODE_BOM_CHARACTER_RUNE = UNICODE_BOM_CHARACTER_RUNE; | 2325 exports.UNICODE_BOM_CHARACTER_RUNE = UNICODE_BOM_CHARACTER_RUNE; |
2326 exports.UTF8 = UTF8; | 2326 exports.UTF8 = UTF8; |
2327 exports.Utf8Codec = Utf8Codec; | 2327 exports.Utf8Codec = Utf8Codec; |
2328 exports.Utf8Encoder = Utf8Encoder; | 2328 exports.Utf8Encoder = Utf8Encoder; |
2329 exports.Utf8Decoder = Utf8Decoder; | 2329 exports.Utf8Decoder = Utf8Decoder; |
2330 })(convert || (convert = {})); | 2330 })(convert || (convert = {})); |
OLD | NEW |