OLD | NEW |
1 var convert = dart.defineLibrary(convert, {}); | 1 var convert = dart.defineLibrary(convert, {}); |
2 var core = dart.import(core); | 2 var core = dart.import(core); |
3 var async = dart.import(async); | 3 var async = dart.import(async); |
4 var typed_data = dart.import(typed_data); | 4 var typed_data = dart.import(typed_data); |
5 var _internal = dart.import(_internal); | 5 var _internal = dart.import(_internal); |
6 var collection = dart.import(collection); | 6 var collection = dart.import(collection); |
7 (function(exports, core, async, typed_data, _internal, collection) { | 7 (function(exports, core, async, typed_data, _internal, collection) { |
8 'use strict'; | 8 'use strict'; |
9 let Codec$ = dart.generic(function(S, T) { | 9 let Codec$ = dart.generic(function(S, T) { |
10 class Codec extends core.Object { | 10 class Codec extends core.Object { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 } | 43 } |
44 decodeStream(byteStream) { | 44 decodeStream(byteStream) { |
45 return dart.as(byteStream.transform(this.decoder).fold(new core.StringBuff
er(), dart.fn((buffer, string) => ((() => { | 45 return dart.as(byteStream.transform(this.decoder).fold(new core.StringBuff
er(), dart.fn((buffer, string) => ((() => { |
46 dart.dsend(buffer, 'write', string); | 46 dart.dsend(buffer, 'write', string); |
47 return buffer; | 47 return buffer; |
48 })()))).then(dart.fn(buffer => dart.toString(buffer), core.String, [core.O
bject])), async.Future$(core.String)); | 48 })()))).then(dart.fn(buffer => dart.toString(buffer), core.String, [core.O
bject])), async.Future$(core.String)); |
49 } | 49 } |
50 static getByName(name) { | 50 static getByName(name) { |
51 if (name == null) | 51 if (name == null) |
52 return null; | 52 return null; |
53 name = name.toLowerCase(); | 53 name = name[dartx.toLowerCase](); |
54 return Encoding._nameToEncoding.get(name); | 54 return Encoding._nameToEncoding.get(name); |
55 } | 55 } |
56 } | 56 } |
57 dart.setSignature(Encoding, { | 57 dart.setSignature(Encoding, { |
58 constructors: () => ({Encoding: [Encoding, []]}), | 58 constructors: () => ({Encoding: [Encoding, []]}), |
59 methods: () => ({decodeStream: [async.Future$(core.String), [async.Stream$(c
ore.List$(core.int))]]}), | 59 methods: () => ({decodeStream: [async.Future$(core.String), [async.Stream$(c
ore.List$(core.int))]]}), |
60 statics: () => ({getByName: [Encoding, [core.String]]}), | 60 statics: () => ({getByName: [Encoding, [core.String]]}), |
61 names: ['getByName'] | 61 names: ['getByName'] |
62 }); | 62 }); |
63 let _allowInvalid = Symbol('_allowInvalid'); | 63 let _allowInvalid = Symbol('_allowInvalid'); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 start = 0; | 133 start = 0; |
134 if (end === void 0) | 134 if (end === void 0) |
135 end = null; | 135 end = null; |
136 let stringLength = string.length; | 136 let stringLength = string.length; |
137 core.RangeError.checkValidRange(start, end, stringLength); | 137 core.RangeError.checkValidRange(start, end, stringLength); |
138 if (end == null) | 138 if (end == null) |
139 end = stringLength; | 139 end = stringLength; |
140 let length = dart.notNull(end) - dart.notNull(start); | 140 let length = dart.notNull(end) - dart.notNull(start); |
141 let result = typed_data.Uint8List.new(length); | 141 let result = typed_data.Uint8List.new(length); |
142 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull(i
) + 1) { | 142 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull(i
) + 1) { |
143 let codeUnit = string.codeUnitAt(dart.notNull(start) + dart.notNull(i)); | 143 let codeUnit = string[dartx.codeUnitAt](dart.notNull(start) + dart.notNu
ll(i)); |
144 if ((dart.notNull(codeUnit) & ~dart.notNull(this[_subsetMask])) != 0) { | 144 if ((dart.notNull(codeUnit) & ~dart.notNull(this[_subsetMask])) != 0) { |
145 throw new core.ArgumentError("String contains invalid characters."); | 145 throw new core.ArgumentError("String contains invalid characters."); |
146 } | 146 } |
147 result[core.$set](i, codeUnit); | 147 result[dartx.set](i, codeUnit); |
148 } | 148 } |
149 return dart.as(result, core.List$(core.int)); | 149 return dart.as(result, core.List$(core.int)); |
150 } | 150 } |
151 startChunkedConversion(sink) { | 151 startChunkedConversion(sink) { |
152 if (!dart.is(sink, ByteConversionSink)) { | 152 if (!dart.is(sink, ByteConversionSink)) { |
153 sink = ByteConversionSink.from(sink); | 153 sink = ByteConversionSink.from(sink); |
154 } | 154 } |
155 return new _UnicodeSubsetEncoderSink(this[_subsetMask], dart.as(sink, Byte
ConversionSink)); | 155 return new _UnicodeSubsetEncoderSink(this[_subsetMask], dart.as(sink, Byte
ConversionSink)); |
156 } | 156 } |
157 bind(stream) { | 157 bind(stream) { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 _UnicodeSubsetEncoderSink(subsetMask, sink) { | 199 _UnicodeSubsetEncoderSink(subsetMask, sink) { |
200 this[_subsetMask] = subsetMask; | 200 this[_subsetMask] = subsetMask; |
201 this[_sink] = sink; | 201 this[_sink] = sink; |
202 } | 202 } |
203 close() { | 203 close() { |
204 this[_sink].close(); | 204 this[_sink].close(); |
205 } | 205 } |
206 addSlice(source, start, end, isLast) { | 206 addSlice(source, start, end, isLast) { |
207 core.RangeError.checkValidRange(start, end, source.length); | 207 core.RangeError.checkValidRange(start, end, source.length); |
208 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { | 208 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { |
209 let codeUnit = source.codeUnitAt(i); | 209 let codeUnit = source[dartx.codeUnitAt](i); |
210 if ((dart.notNull(codeUnit) & ~dart.notNull(this[_subsetMask])) != 0) { | 210 if ((dart.notNull(codeUnit) & ~dart.notNull(this[_subsetMask])) != 0) { |
211 throw new core.ArgumentError(`Source contains invalid character with c
ode point: ${codeUnit}.`); | 211 throw new core.ArgumentError(`Source contains invalid character with c
ode point: ${codeUnit}.`); |
212 } | 212 } |
213 } | 213 } |
214 this[_sink].add(source.codeUnits[core.$sublist](start, end)); | 214 this[_sink].add(source[dartx.codeUnits][dartx.sublist](start, end)); |
215 if (isLast) { | 215 if (isLast) { |
216 this.close(); | 216 this.close(); |
217 } | 217 } |
218 } | 218 } |
219 } | 219 } |
220 dart.setSignature(_UnicodeSubsetEncoderSink, { | 220 dart.setSignature(_UnicodeSubsetEncoderSink, { |
221 constructors: () => ({_UnicodeSubsetEncoderSink: [_UnicodeSubsetEncoderSink,
[core.int, ByteConversionSink]]}), | 221 constructors: () => ({_UnicodeSubsetEncoderSink: [_UnicodeSubsetEncoderSink,
[core.int, ByteConversionSink]]}), |
222 methods: () => ({ | 222 methods: () => ({ |
223 close: [dart.void, []], | 223 close: [dart.void, []], |
224 addSlice: [dart.void, [core.String, core.int, core.int, core.bool]] | 224 addSlice: [dart.void, [core.String, core.int, core.int, core.bool]] |
225 }) | 225 }) |
226 }); | 226 }); |
227 let _convertInvalid = Symbol('_convertInvalid'); | 227 let _convertInvalid = Symbol('_convertInvalid'); |
228 class _UnicodeSubsetDecoder extends Converter$(core.List$(core.int), core.Stri
ng) { | 228 class _UnicodeSubsetDecoder extends Converter$(core.List$(core.int), core.Stri
ng) { |
229 _UnicodeSubsetDecoder(allowInvalid, subsetMask) { | 229 _UnicodeSubsetDecoder(allowInvalid, subsetMask) { |
230 this[_allowInvalid] = allowInvalid; | 230 this[_allowInvalid] = allowInvalid; |
231 this[_subsetMask] = subsetMask; | 231 this[_subsetMask] = subsetMask; |
232 super.Converter(); | 232 super.Converter(); |
233 } | 233 } |
234 convert(bytes, start, end) { | 234 convert(bytes, start, end) { |
235 if (start === void 0) | 235 if (start === void 0) |
236 start = 0; | 236 start = 0; |
237 if (end === void 0) | 237 if (end === void 0) |
238 end = null; | 238 end = null; |
239 let byteCount = bytes[core.$length]; | 239 let byteCount = bytes.length; |
240 core.RangeError.checkValidRange(start, end, byteCount); | 240 core.RangeError.checkValidRange(start, end, byteCount); |
241 if (end == null) | 241 if (end == null) |
242 end = byteCount; | 242 end = byteCount; |
243 let length = dart.notNull(end) - dart.notNull(start); | 243 let length = dart.notNull(end) - dart.notNull(start); |
244 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { | 244 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { |
245 let byte = bytes[core.$get](i); | 245 let byte = bytes[dartx.get](i); |
246 if ((dart.notNull(byte) & ~dart.notNull(this[_subsetMask])) != 0) { | 246 if ((dart.notNull(byte) & ~dart.notNull(this[_subsetMask])) != 0) { |
247 if (!dart.notNull(this[_allowInvalid])) { | 247 if (!dart.notNull(this[_allowInvalid])) { |
248 throw new core.FormatException(`Invalid value in input: ${byte}`); | 248 throw new core.FormatException(`Invalid value in input: ${byte}`); |
249 } | 249 } |
250 return this[_convertInvalid](bytes, start, end); | 250 return this[_convertInvalid](bytes, start, end); |
251 } | 251 } |
252 } | 252 } |
253 return core.String.fromCharCodes(bytes, start, end); | 253 return core.String.fromCharCodes(bytes, start, end); |
254 } | 254 } |
255 [_convertInvalid](bytes, start, end) { | 255 [_convertInvalid](bytes, start, end) { |
256 let buffer = new core.StringBuffer(); | 256 let buffer = new core.StringBuffer(); |
257 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { | 257 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { |
258 let value = bytes[core.$get](i); | 258 let value = bytes[dartx.get](i); |
259 if ((dart.notNull(value) & ~dart.notNull(this[_subsetMask])) != 0) | 259 if ((dart.notNull(value) & ~dart.notNull(this[_subsetMask])) != 0) |
260 value = 65533; | 260 value = 65533; |
261 buffer.writeCharCode(value); | 261 buffer.writeCharCode(value); |
262 } | 262 } |
263 return dart.toString(buffer); | 263 return dart.toString(buffer); |
264 } | 264 } |
265 bind(stream) { | 265 bind(stream) { |
266 return super.bind(stream); | 266 return super.bind(stream); |
267 } | 267 } |
268 } | 268 } |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 ByteConversionSink: [ByteConversionSink, []], | 331 ByteConversionSink: [ByteConversionSink, []], |
332 withCallback: [ByteConversionSink, [dart.functionType(dart.void, [core.Lis
t$(core.int)])]], | 332 withCallback: [ByteConversionSink, [dart.functionType(dart.void, [core.Lis
t$(core.int)])]], |
333 from: [ByteConversionSink, [core.Sink$(core.List$(core.int))]] | 333 from: [ByteConversionSink, [core.Sink$(core.List$(core.int))]] |
334 }) | 334 }) |
335 }); | 335 }); |
336 class ByteConversionSinkBase extends ByteConversionSink { | 336 class ByteConversionSinkBase extends ByteConversionSink { |
337 ByteConversionSinkBase() { | 337 ByteConversionSinkBase() { |
338 super.ByteConversionSink(); | 338 super.ByteConversionSink(); |
339 } | 339 } |
340 addSlice(chunk, start, end, isLast) { | 340 addSlice(chunk, start, end, isLast) { |
341 this.add(chunk[core.$sublist](start, end)); | 341 this.add(chunk[dartx.sublist](start, end)); |
342 if (isLast) | 342 if (isLast) |
343 this.close(); | 343 this.close(); |
344 } | 344 } |
345 } | 345 } |
346 dart.setSignature(ByteConversionSinkBase, { | 346 dart.setSignature(ByteConversionSinkBase, { |
347 methods: () => ({addSlice: [dart.void, [core.List$(core.int), core.int, core
.int, core.bool]]}) | 347 methods: () => ({addSlice: [dart.void, [core.List$(core.int), core.int, core
.int, core.bool]]}) |
348 }); | 348 }); |
349 let _utf8Sink = Symbol('_utf8Sink'); | 349 let _utf8Sink = Symbol('_utf8Sink'); |
350 class _ErrorHandlingAsciiDecoderSink extends ByteConversionSinkBase { | 350 class _ErrorHandlingAsciiDecoderSink extends ByteConversionSinkBase { |
351 _ErrorHandlingAsciiDecoderSink(utf8Sink) { | 351 _ErrorHandlingAsciiDecoderSink(utf8Sink) { |
352 this[_utf8Sink] = utf8Sink; | 352 this[_utf8Sink] = utf8Sink; |
353 } | 353 } |
354 close() { | 354 close() { |
355 this[_utf8Sink].close(); | 355 this[_utf8Sink].close(); |
356 } | 356 } |
357 add(source) { | 357 add(source) { |
358 this.addSlice(source, 0, source[core.$length], false); | 358 this.addSlice(source, 0, source.length, false); |
359 } | 359 } |
360 addSlice(source, start, end, isLast) { | 360 addSlice(source, start, end, isLast) { |
361 core.RangeError.checkValidRange(start, end, source[core.$length]); | 361 core.RangeError.checkValidRange(start, end, source.length); |
362 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { | 362 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { |
363 if ((dart.notNull(source[core.$get](i)) & ~dart.notNull(_ASCII_MASK)) !=
0) { | 363 if ((dart.notNull(source[dartx.get](i)) & ~dart.notNull(_ASCII_MASK)) !=
0) { |
364 if (dart.notNull(i) > dart.notNull(start)) | 364 if (dart.notNull(i) > dart.notNull(start)) |
365 this[_utf8Sink].addSlice(source, start, i, false); | 365 this[_utf8Sink].addSlice(source, start, i, false); |
366 this[_utf8Sink].add(dart.const(dart.setType([239, 191, 189], core.List
$(core.int)))); | 366 this[_utf8Sink].add(dart.const(dart.list([239, 191, 189], core.int))); |
367 start = dart.notNull(i) + 1; | 367 start = dart.notNull(i) + 1; |
368 } | 368 } |
369 } | 369 } |
370 if (dart.notNull(start) < dart.notNull(end)) { | 370 if (dart.notNull(start) < dart.notNull(end)) { |
371 this[_utf8Sink].addSlice(source, start, end, isLast); | 371 this[_utf8Sink].addSlice(source, start, end, isLast); |
372 } else if (isLast) { | 372 } else if (isLast) { |
373 this.close(); | 373 this.close(); |
374 } | 374 } |
375 } | 375 } |
376 } | 376 } |
377 dart.setSignature(_ErrorHandlingAsciiDecoderSink, { | 377 dart.setSignature(_ErrorHandlingAsciiDecoderSink, { |
378 constructors: () => ({_ErrorHandlingAsciiDecoderSink: [_ErrorHandlingAsciiDe
coderSink, [ByteConversionSink]]}), | 378 constructors: () => ({_ErrorHandlingAsciiDecoderSink: [_ErrorHandlingAsciiDe
coderSink, [ByteConversionSink]]}), |
379 methods: () => ({ | 379 methods: () => ({ |
380 close: [dart.void, []], | 380 close: [dart.void, []], |
381 add: [dart.void, [core.List$(core.int)]] | 381 add: [dart.void, [core.List$(core.int)]] |
382 }) | 382 }) |
383 }); | 383 }); |
384 class _SimpleAsciiDecoderSink extends ByteConversionSinkBase { | 384 class _SimpleAsciiDecoderSink extends ByteConversionSinkBase { |
385 _SimpleAsciiDecoderSink(sink) { | 385 _SimpleAsciiDecoderSink(sink) { |
386 this[_sink] = sink; | 386 this[_sink] = sink; |
387 } | 387 } |
388 close() { | 388 close() { |
389 this[_sink].close(); | 389 this[_sink].close(); |
390 } | 390 } |
391 add(source) { | 391 add(source) { |
392 for (let i = 0; dart.notNull(i) < dart.notNull(source[core.$length]); i =
dart.notNull(i) + 1) { | 392 for (let i = 0; dart.notNull(i) < dart.notNull(source.length); i = dart.no
tNull(i) + 1) { |
393 if ((dart.notNull(source[core.$get](i)) & ~dart.notNull(_ASCII_MASK)) !=
0) { | 393 if ((dart.notNull(source[dartx.get](i)) & ~dart.notNull(_ASCII_MASK)) !=
0) { |
394 throw new core.FormatException("Source contains non-ASCII bytes."); | 394 throw new core.FormatException("Source contains non-ASCII bytes."); |
395 } | 395 } |
396 } | 396 } |
397 this[_sink].add(core.String.fromCharCodes(source)); | 397 this[_sink].add(core.String.fromCharCodes(source)); |
398 } | 398 } |
399 addSlice(source, start, end, isLast) { | 399 addSlice(source, start, end, isLast) { |
400 let length = source[core.$length]; | 400 let length = source.length; |
401 core.RangeError.checkValidRange(start, end, length); | 401 core.RangeError.checkValidRange(start, end, length); |
402 if (dart.notNull(start) < dart.notNull(end)) { | 402 if (dart.notNull(start) < dart.notNull(end)) { |
403 if (start != 0 || end != length) { | 403 if (start != 0 || end != length) { |
404 source = source[core.$sublist](start, end); | 404 source = source[dartx.sublist](start, end); |
405 } | 405 } |
406 this.add(source); | 406 this.add(source); |
407 } | 407 } |
408 if (isLast) | 408 if (isLast) |
409 this.close(); | 409 this.close(); |
410 } | 410 } |
411 } | 411 } |
412 dart.setSignature(_SimpleAsciiDecoderSink, { | 412 dart.setSignature(_SimpleAsciiDecoderSink, { |
413 constructors: () => ({_SimpleAsciiDecoderSink: [_SimpleAsciiDecoderSink, [co
re.Sink]]}), | 413 constructors: () => ({_SimpleAsciiDecoderSink: [_SimpleAsciiDecoderSink, [co
re.Sink]]}), |
414 methods: () => ({ | 414 methods: () => ({ |
(...skipping 22 matching lines...) Expand all Loading... |
437 let _buffer = Symbol('_buffer'); | 437 let _buffer = Symbol('_buffer'); |
438 let _callback = Symbol('_callback'); | 438 let _callback = Symbol('_callback'); |
439 let _bufferIndex = Symbol('_bufferIndex'); | 439 let _bufferIndex = Symbol('_bufferIndex'); |
440 class _ByteCallbackSink extends ByteConversionSinkBase { | 440 class _ByteCallbackSink extends ByteConversionSinkBase { |
441 _ByteCallbackSink(callback) { | 441 _ByteCallbackSink(callback) { |
442 this[_buffer] = typed_data.Uint8List.new(_ByteCallbackSink._INITIAL_BUFFER
_SIZE); | 442 this[_buffer] = typed_data.Uint8List.new(_ByteCallbackSink._INITIAL_BUFFER
_SIZE); |
443 this[_callback] = callback; | 443 this[_callback] = callback; |
444 this[_bufferIndex] = 0; | 444 this[_bufferIndex] = 0; |
445 } | 445 } |
446 add(chunk) { | 446 add(chunk) { |
447 let freeCount = dart.notNull(this[_buffer][core.$length]) - dart.notNull(t
his[_bufferIndex]); | 447 let freeCount = dart.notNull(this[_buffer].length) - dart.notNull(this[_bu
fferIndex]); |
448 if (dart.notNull(chunk[core.$length]) > dart.notNull(freeCount)) { | 448 if (dart.notNull(chunk.length) > dart.notNull(freeCount)) { |
449 let oldLength = this[_buffer][core.$length]; | 449 let oldLength = this[_buffer].length; |
450 let newLength = dart.notNull(_ByteCallbackSink._roundToPowerOf2(dart.not
Null(chunk[core.$length]) + dart.notNull(oldLength))) * 2; | 450 let newLength = dart.notNull(_ByteCallbackSink._roundToPowerOf2(dart.not
Null(chunk.length) + dart.notNull(oldLength))) * 2; |
451 let grown = typed_data.Uint8List.new(newLength); | 451 let grown = typed_data.Uint8List.new(newLength); |
452 grown[core.$setRange](0, this[_buffer][core.$length], this[_buffer]); | 452 grown[dartx.setRange](0, this[_buffer].length, this[_buffer]); |
453 this[_buffer] = grown; | 453 this[_buffer] = grown; |
454 } | 454 } |
455 this[_buffer][core.$setRange](this[_bufferIndex], dart.notNull(this[_buffe
rIndex]) + dart.notNull(chunk[core.$length]), chunk); | 455 this[_buffer][dartx.setRange](this[_bufferIndex], dart.notNull(this[_buffe
rIndex]) + dart.notNull(chunk.length), chunk); |
456 this[_bufferIndex] = dart.notNull(this[_bufferIndex]) + dart.notNull(chunk
[core.$length]); | 456 this[_bufferIndex] = dart.notNull(this[_bufferIndex]) + dart.notNull(chunk
.length); |
457 } | 457 } |
458 static _roundToPowerOf2(v) { | 458 static _roundToPowerOf2(v) { |
459 dart.assert(dart.notNull(v) > 0); | 459 dart.assert(dart.notNull(v) > 0); |
460 v = dart.notNull(v) - 1; | 460 v = dart.notNull(v) - 1; |
461 v = dart.notNull(v) | dart.notNull(v) >> 1; | 461 v = dart.notNull(v) | dart.notNull(v) >> 1; |
462 v = dart.notNull(v) | dart.notNull(v) >> 2; | 462 v = dart.notNull(v) | dart.notNull(v) >> 2; |
463 v = dart.notNull(v) | dart.notNull(v) >> 4; | 463 v = dart.notNull(v) | dart.notNull(v) >> 4; |
464 v = dart.notNull(v) | dart.notNull(v) >> 8; | 464 v = dart.notNull(v) | dart.notNull(v) >> 8; |
465 v = dart.notNull(v) | dart.notNull(v) >> 16; | 465 v = dart.notNull(v) | dart.notNull(v) >> 16; |
466 v = dart.notNull(v) + 1; | 466 v = dart.notNull(v) + 1; |
467 return v; | 467 return v; |
468 } | 468 } |
469 close() { | 469 close() { |
470 this[_callback](this[_buffer][core.$sublist](0, this[_bufferIndex])); | 470 this[_callback](this[_buffer][dartx.sublist](0, this[_bufferIndex])); |
471 } | 471 } |
472 } | 472 } |
473 dart.setSignature(_ByteCallbackSink, { | 473 dart.setSignature(_ByteCallbackSink, { |
474 constructors: () => ({_ByteCallbackSink: [_ByteCallbackSink, [dart.functionT
ype(dart.void, [core.List$(core.int)])]]}), | 474 constructors: () => ({_ByteCallbackSink: [_ByteCallbackSink, [dart.functionT
ype(dart.void, [core.List$(core.int)])]]}), |
475 methods: () => ({ | 475 methods: () => ({ |
476 add: [dart.void, [core.Iterable$(core.int)]], | 476 add: [dart.void, [core.Iterable$(core.int)]], |
477 close: [dart.void, []] | 477 close: [dart.void, []] |
478 }), | 478 }), |
479 statics: () => ({_roundToPowerOf2: [core.int, [core.int]]}), | 479 statics: () => ({_roundToPowerOf2: [core.int, [core.int]]}), |
480 names: ['_roundToPowerOf2'] | 480 names: ['_roundToPowerOf2'] |
481 }); | 481 }); |
482 _ByteCallbackSink._INITIAL_BUFFER_SIZE = 1024; | 482 _ByteCallbackSink._INITIAL_BUFFER_SIZE = 1024; |
483 let _ChunkedConversionCallback$ = dart.generic(function(T) { | 483 let _ChunkedConversionCallback$ = dart.generic(function(T) { |
484 let _ChunkedConversionCallback = dart.typedef('_ChunkedConversionCallback',
() => dart.functionType(dart.void, [T])); | 484 let _ChunkedConversionCallback = dart.typedef('_ChunkedConversionCallback',
() => dart.functionType(dart.void, [T])); |
485 return _ChunkedConversionCallback; | 485 return _ChunkedConversionCallback; |
486 }); | 486 }); |
487 let _ChunkedConversionCallback = _ChunkedConversionCallback$(); | 487 let _ChunkedConversionCallback = _ChunkedConversionCallback$(); |
488 let _accumulated = Symbol('_accumulated'); | 488 let _accumulated = Symbol('_accumulated'); |
489 let _SimpleCallbackSink$ = dart.generic(function(T) { | 489 let _SimpleCallbackSink$ = dart.generic(function(T) { |
490 class _SimpleCallbackSink extends ChunkedConversionSink$(T) { | 490 class _SimpleCallbackSink extends ChunkedConversionSink$(T) { |
491 _SimpleCallbackSink(callback) { | 491 _SimpleCallbackSink(callback) { |
492 this[_accumulated] = dart.setType([], core.List$(T)); | 492 this[_accumulated] = dart.list([], T); |
493 this[_callback] = callback; | 493 this[_callback] = callback; |
494 super.ChunkedConversionSink(); | 494 super.ChunkedConversionSink(); |
495 } | 495 } |
496 add(chunk) { | 496 add(chunk) { |
497 dart.as(chunk, T); | 497 dart.as(chunk, T); |
498 this[_accumulated][core.$add](chunk); | 498 this[_accumulated][dartx.add](chunk); |
499 } | 499 } |
500 close() { | 500 close() { |
501 this[_callback](this[_accumulated]); | 501 this[_callback](this[_accumulated]); |
502 } | 502 } |
503 } | 503 } |
504 dart.setSignature(_SimpleCallbackSink, { | 504 dart.setSignature(_SimpleCallbackSink, { |
505 constructors: () => ({_SimpleCallbackSink: [_SimpleCallbackSink$(T), [_Chu
nkedConversionCallback$(core.List$(T))]]}), | 505 constructors: () => ({_SimpleCallbackSink: [_SimpleCallbackSink$(T), [_Chu
nkedConversionCallback$(core.List$(T))]]}), |
506 methods: () => ({ | 506 methods: () => ({ |
507 add: [dart.void, [T]], | 507 add: [dart.void, [T]], |
508 close: [dart.void, []] | 508 close: [dart.void, []] |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 this.mode = mode; | 671 this.mode = mode; |
672 super.Converter(); | 672 super.Converter(); |
673 } | 673 } |
674 convert(text) { | 674 convert(text) { |
675 let val = this[_convert](text, 0, text.length); | 675 let val = this[_convert](text, 0, text.length); |
676 return val == null ? text : val; | 676 return val == null ? text : val; |
677 } | 677 } |
678 [_convert](text, start, end) { | 678 [_convert](text, start, end) { |
679 let result = null; | 679 let result = null; |
680 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { | 680 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { |
681 let ch = text.get(i); | 681 let ch = text[dartx.get](i); |
682 let replace = null; | 682 let replace = null; |
683 switch (ch) { | 683 switch (ch) { |
684 case '&': | 684 case '&': |
685 { | 685 { |
686 replace = '&'; | 686 replace = '&'; |
687 break; | 687 break; |
688 } | 688 } |
689 case 'Â ': | 689 case 'Â ': |
690 { | 690 { |
691 replace = ' '; | 691 replace = ' '; |
(...skipping 25 matching lines...) Expand all Loading... |
717 } | 717 } |
718 case '/': | 718 case '/': |
719 { | 719 { |
720 if (this.mode.escapeSlash) | 720 if (this.mode.escapeSlash) |
721 replace = '/'; | 721 replace = '/'; |
722 break; | 722 break; |
723 } | 723 } |
724 } | 724 } |
725 if (replace != null) { | 725 if (replace != null) { |
726 if (result == null) | 726 if (result == null) |
727 result = new core.StringBuffer(text.substring(start, i)); | 727 result = new core.StringBuffer(text[dartx.substring](start, i)); |
728 result.write(replace); | 728 result.write(replace); |
729 } else if (result != null) { | 729 } else if (result != null) { |
730 result.write(ch); | 730 result.write(ch); |
731 } | 731 } |
732 } | 732 } |
733 return result != null ? dart.toString(result) : null; | 733 return result != null ? dart.toString(result) : null; |
734 } | 734 } |
735 startChunkedConversion(sink) { | 735 startChunkedConversion(sink) { |
736 if (!dart.is(sink, StringConversionSink)) { | 736 if (!dart.is(sink, StringConversionSink)) { |
737 sink = StringConversionSink.from(sink); | 737 sink = StringConversionSink.from(sink); |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
920 if (bufferSize === void 0) | 920 if (bufferSize === void 0) |
921 bufferSize = JsonUtf8Encoder.DEFAULT_BUFFER_SIZE; | 921 bufferSize = JsonUtf8Encoder.DEFAULT_BUFFER_SIZE; |
922 this[_indent] = JsonUtf8Encoder._utf8Encode(indent); | 922 this[_indent] = JsonUtf8Encoder._utf8Encode(indent); |
923 this[_toEncodable$] = toEncodable; | 923 this[_toEncodable$] = toEncodable; |
924 this[_bufferSize] = bufferSize; | 924 this[_bufferSize] = bufferSize; |
925 super.Converter(); | 925 super.Converter(); |
926 } | 926 } |
927 static _utf8Encode(string) { | 927 static _utf8Encode(string) { |
928 if (string == null) | 928 if (string == null) |
929 return null; | 929 return null; |
930 if (string.isEmpty) | 930 if (string[dartx.isEmpty]) |
931 return typed_data.Uint8List.new(0); | 931 return typed_data.Uint8List.new(0); |
932 checkAscii: { | 932 checkAscii: { |
933 for (let i = 0; dart.notNull(i) < dart.notNull(string.length); i = dart.
notNull(i) + 1) { | 933 for (let i = 0; dart.notNull(i) < dart.notNull(string.length); i = dart.
notNull(i) + 1) { |
934 if (dart.notNull(string.codeUnitAt(i)) >= 128) | 934 if (dart.notNull(string[dartx.codeUnitAt](i)) >= 128) |
935 break checkAscii; | 935 break checkAscii; |
936 } | 936 } |
937 return string.codeUnits; | 937 return string[dartx.codeUnits]; |
938 } | 938 } |
939 return UTF8.encode(string); | 939 return UTF8.encode(string); |
940 } | 940 } |
941 convert(object) { | 941 convert(object) { |
942 let bytes = dart.setType([], core.List$(core.List$(core.int))); | 942 let bytes = dart.list([], core.List$(core.int)); |
943 let addChunk = (chunk, start, end) => { | 943 let addChunk = (chunk, start, end) => { |
944 if (dart.notNull(start) > 0 || dart.notNull(end) < dart.notNull(chunk[co
re.$length])) { | 944 if (dart.notNull(start) > 0 || dart.notNull(end) < dart.notNull(chunk.le
ngth)) { |
945 let length = dart.notNull(end) - dart.notNull(start); | 945 let length = dart.notNull(end) - dart.notNull(start); |
946 chunk = typed_data.Uint8List.view(chunk.buffer, dart.notNull(chunk.off
setInBytes) + dart.notNull(start), length); | 946 chunk = typed_data.Uint8List.view(chunk.buffer, dart.notNull(chunk.off
setInBytes) + dart.notNull(start), length); |
947 } | 947 } |
948 bytes[core.$add](chunk); | 948 bytes[dartx.add](chunk); |
949 }; | 949 }; |
950 dart.fn(addChunk, dart.void, [typed_data.Uint8List, core.int, core.int]); | 950 dart.fn(addChunk, dart.void, [typed_data.Uint8List, core.int, core.int]); |
951 _JsonUtf8Stringifier.stringify(object, this[_indent], dart.as(this[_toEnco
dable$], dart.functionType(core.Object, [core.Object])), this[_bufferSize], addC
hunk); | 951 _JsonUtf8Stringifier.stringify(object, this[_indent], dart.as(this[_toEnco
dable$], dart.functionType(core.Object, [core.Object])), this[_bufferSize], addC
hunk); |
952 if (bytes[core.$length] == 1) | 952 if (bytes.length == 1) |
953 return bytes[core.$get](0); | 953 return bytes[dartx.get](0); |
954 let length = 0; | 954 let length = 0; |
955 for (let i = 0; dart.notNull(i) < dart.notNull(bytes[core.$length]); i = d
art.notNull(i) + 1) { | 955 for (let i = 0; dart.notNull(i) < dart.notNull(bytes.length); i = dart.not
Null(i) + 1) { |
956 length = dart.notNull(length) + dart.notNull(bytes[core.$get](i)[core.$l
ength]); | 956 length = dart.notNull(length) + dart.notNull(bytes[dartx.get](i).length)
; |
957 } | 957 } |
958 let result = typed_data.Uint8List.new(length); | 958 let result = typed_data.Uint8List.new(length); |
959 for (let i = 0, offset = 0; dart.notNull(i) < dart.notNull(bytes[core.$len
gth]); i = dart.notNull(i) + 1) { | 959 for (let i = 0, offset = 0; dart.notNull(i) < dart.notNull(bytes.length);
i = dart.notNull(i) + 1) { |
960 let byteList = bytes[core.$get](i); | 960 let byteList = bytes[dartx.get](i); |
961 let end = dart.notNull(offset) + dart.notNull(byteList[core.$length]); | 961 let end = dart.notNull(offset) + dart.notNull(byteList.length); |
962 result[core.$setRange](offset, end, byteList); | 962 result.setRange(offset, end, byteList); |
963 offset = end; | 963 offset = end; |
964 } | 964 } |
965 return result; | 965 return result; |
966 } | 966 } |
967 startChunkedConversion(sink) { | 967 startChunkedConversion(sink) { |
968 let byteSink = null; | 968 let byteSink = null; |
969 if (dart.is(sink, ByteConversionSink)) { | 969 if (dart.is(sink, ByteConversionSink)) { |
970 byteSink = sink; | 970 byteSink = sink; |
971 } else { | 971 } else { |
972 byteSink = ByteConversionSink.from(sink); | 972 byteSink = ByteConversionSink.from(sink); |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1109 this[_seen] = core.List.new(); | 1109 this[_seen] = core.List.new(); |
1110 this[_toEncodable$] = _toEncodable != null ? _toEncodable : _defaultToEnco
dable; | 1110 this[_toEncodable$] = _toEncodable != null ? _toEncodable : _defaultToEnco
dable; |
1111 } | 1111 } |
1112 static hexDigit(x) { | 1112 static hexDigit(x) { |
1113 return dart.notNull(x) < 10 ? 48 + dart.notNull(x) : 87 + dart.notNull(x); | 1113 return dart.notNull(x) < 10 ? 48 + dart.notNull(x) : 87 + dart.notNull(x); |
1114 } | 1114 } |
1115 writeStringContent(s) { | 1115 writeStringContent(s) { |
1116 let offset = 0; | 1116 let offset = 0; |
1117 let length = s.length; | 1117 let length = s.length; |
1118 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull(i
) + 1) { | 1118 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull(i
) + 1) { |
1119 let charCode = s.codeUnitAt(i); | 1119 let charCode = s[dartx.codeUnitAt](i); |
1120 if (dart.notNull(charCode) > dart.notNull(_JsonStringifier.BACKSLASH)) | 1120 if (dart.notNull(charCode) > dart.notNull(_JsonStringifier.BACKSLASH)) |
1121 continue; | 1121 continue; |
1122 if (dart.notNull(charCode) < 32) { | 1122 if (dart.notNull(charCode) < 32) { |
1123 if (dart.notNull(i) > dart.notNull(offset)) | 1123 if (dart.notNull(i) > dart.notNull(offset)) |
1124 this.writeStringSlice(s, offset, i); | 1124 this.writeStringSlice(s, offset, i); |
1125 offset = dart.notNull(i) + 1; | 1125 offset = dart.notNull(i) + 1; |
1126 this.writeCharCode(_JsonStringifier.BACKSLASH); | 1126 this.writeCharCode(_JsonStringifier.BACKSLASH); |
1127 switch (charCode) { | 1127 switch (charCode) { |
1128 case _JsonStringifier.BACKSPACE: | 1128 case _JsonStringifier.BACKSPACE: |
1129 { | 1129 { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1168 this.writeCharCode(charCode); | 1168 this.writeCharCode(charCode); |
1169 } | 1169 } |
1170 } | 1170 } |
1171 if (offset == 0) { | 1171 if (offset == 0) { |
1172 this.writeString(s); | 1172 this.writeString(s); |
1173 } else if (dart.notNull(offset) < dart.notNull(length)) { | 1173 } else if (dart.notNull(offset) < dart.notNull(length)) { |
1174 this.writeStringSlice(s, offset, length); | 1174 this.writeStringSlice(s, offset, length); |
1175 } | 1175 } |
1176 } | 1176 } |
1177 [_checkCycle](object) { | 1177 [_checkCycle](object) { |
1178 for (let i = 0; dart.notNull(i) < dart.notNull(this[_seen][core.$length]);
i = dart.notNull(i) + 1) { | 1178 for (let i = 0; dart.notNull(i) < dart.notNull(this[_seen].length); i = da
rt.notNull(i) + 1) { |
1179 if (core.identical(object, this[_seen][core.$get](i))) { | 1179 if (core.identical(object, this[_seen][dartx.get](i))) { |
1180 throw new JsonCyclicError(object); | 1180 throw new JsonCyclicError(object); |
1181 } | 1181 } |
1182 } | 1182 } |
1183 this[_seen][core.$add](object); | 1183 this[_seen][dartx.add](object); |
1184 } | 1184 } |
1185 [_removeSeen](object) { | 1185 [_removeSeen](object) { |
1186 dart.assert(!dart.notNull(this[_seen][core.$isEmpty])); | 1186 dart.assert(!dart.notNull(this[_seen][dartx.isEmpty])); |
1187 dart.assert(core.identical(this[_seen][core.$last], object)); | 1187 dart.assert(core.identical(this[_seen][dartx.last], object)); |
1188 this[_seen][core.$removeLast](); | 1188 this[_seen][dartx.removeLast](); |
1189 } | 1189 } |
1190 writeObject(object) { | 1190 writeObject(object) { |
1191 if (this.writeJsonValue(object)) | 1191 if (this.writeJsonValue(object)) |
1192 return; | 1192 return; |
1193 this[_checkCycle](object); | 1193 this[_checkCycle](object); |
1194 try { | 1194 try { |
1195 let customJson = dart.dcall(this[_toEncodable$], object); | 1195 let customJson = dart.dcall(this[_toEncodable$], object); |
1196 if (!dart.notNull(this.writeJsonValue(customJson))) { | 1196 if (!dart.notNull(this.writeJsonValue(customJson))) { |
1197 throw new JsonUnsupportedObjectError(object); | 1197 throw new JsonUnsupportedObjectError(object); |
1198 } | 1198 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1231 this[_checkCycle](object); | 1231 this[_checkCycle](object); |
1232 this.writeMap(dart.as(object, core.Map$(core.String, core.Object))); | 1232 this.writeMap(dart.as(object, core.Map$(core.String, core.Object))); |
1233 this[_removeSeen](object); | 1233 this[_removeSeen](object); |
1234 return true; | 1234 return true; |
1235 } else { | 1235 } else { |
1236 return false; | 1236 return false; |
1237 } | 1237 } |
1238 } | 1238 } |
1239 writeList(list) { | 1239 writeList(list) { |
1240 this.writeString('['); | 1240 this.writeString('['); |
1241 if (dart.notNull(list[core.$length]) > 0) { | 1241 if (dart.notNull(list.length) > 0) { |
1242 this.writeObject(list[core.$get](0)); | 1242 this.writeObject(list[dartx.get](0)); |
1243 for (let i = 1; dart.notNull(i) < dart.notNull(list[core.$length]); i =
dart.notNull(i) + 1) { | 1243 for (let i = 1; dart.notNull(i) < dart.notNull(list.length); i = dart.no
tNull(i) + 1) { |
1244 this.writeString(','); | 1244 this.writeString(','); |
1245 this.writeObject(list[core.$get](i)); | 1245 this.writeObject(list[dartx.get](i)); |
1246 } | 1246 } |
1247 } | 1247 } |
1248 this.writeString(']'); | 1248 this.writeString(']'); |
1249 } | 1249 } |
1250 writeMap(map) { | 1250 writeMap(map) { |
1251 this.writeString('{'); | 1251 this.writeString('{'); |
1252 let separator = '"'; | 1252 let separator = '"'; |
1253 map.forEach(dart.fn((key, value) => { | 1253 map.forEach(dart.fn((key, value) => { |
1254 this.writeString(separator); | 1254 this.writeString(separator); |
1255 separator = ',"'; | 1255 separator = ',"'; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1287 _JsonStringifier.CHAR_n = 110; | 1287 _JsonStringifier.CHAR_n = 110; |
1288 _JsonStringifier.CHAR_r = 114; | 1288 _JsonStringifier.CHAR_r = 114; |
1289 _JsonStringifier.CHAR_t = 116; | 1289 _JsonStringifier.CHAR_t = 116; |
1290 _JsonStringifier.CHAR_u = 117; | 1290 _JsonStringifier.CHAR_u = 117; |
1291 let _indentLevel = Symbol('_indentLevel'); | 1291 let _indentLevel = Symbol('_indentLevel'); |
1292 class _JsonPrettyPrintMixin extends core.Object { | 1292 class _JsonPrettyPrintMixin extends core.Object { |
1293 _JsonPrettyPrintMixin() { | 1293 _JsonPrettyPrintMixin() { |
1294 this[_indentLevel] = 0; | 1294 this[_indentLevel] = 0; |
1295 } | 1295 } |
1296 writeList(list) { | 1296 writeList(list) { |
1297 if (list[core.$isEmpty]) { | 1297 if (list[dartx.isEmpty]) { |
1298 this.writeString('[]'); | 1298 this.writeString('[]'); |
1299 } else { | 1299 } else { |
1300 this.writeString('[\n'); | 1300 this.writeString('[\n'); |
1301 this[_indentLevel] = dart.notNull(this[_indentLevel]) + 1; | 1301 this[_indentLevel] = dart.notNull(this[_indentLevel]) + 1; |
1302 this.writeIndentation(this[_indentLevel]); | 1302 this.writeIndentation(this[_indentLevel]); |
1303 this.writeObject(list[core.$get](0)); | 1303 this.writeObject(list[dartx.get](0)); |
1304 for (let i = 1; dart.notNull(i) < dart.notNull(list[core.$length]); i =
dart.notNull(i) + 1) { | 1304 for (let i = 1; dart.notNull(i) < dart.notNull(list.length); i = dart.no
tNull(i) + 1) { |
1305 this.writeString(',\n'); | 1305 this.writeString(',\n'); |
1306 this.writeIndentation(this[_indentLevel]); | 1306 this.writeIndentation(this[_indentLevel]); |
1307 this.writeObject(list[core.$get](i)); | 1307 this.writeObject(list[dartx.get](i)); |
1308 } | 1308 } |
1309 this.writeString('\n'); | 1309 this.writeString('\n'); |
1310 this[_indentLevel] = dart.notNull(this[_indentLevel]) - 1; | 1310 this[_indentLevel] = dart.notNull(this[_indentLevel]) - 1; |
1311 this.writeIndentation(this[_indentLevel]); | 1311 this.writeIndentation(this[_indentLevel]); |
1312 this.writeString(']'); | 1312 this.writeString(']'); |
1313 } | 1313 } |
1314 } | 1314 } |
1315 writeMap(map) { | 1315 writeMap(map) { |
1316 if (map.isEmpty) { | 1316 if (map.isEmpty) { |
1317 this.writeString('{}'); | 1317 this.writeString('{}'); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1357 static printOn(object, output, toEncodable, indent) { | 1357 static printOn(object, output, toEncodable, indent) { |
1358 let stringifier = null; | 1358 let stringifier = null; |
1359 if (indent == null) { | 1359 if (indent == null) { |
1360 stringifier = new _JsonStringStringifier(output, toEncodable); | 1360 stringifier = new _JsonStringStringifier(output, toEncodable); |
1361 } else { | 1361 } else { |
1362 stringifier = new _JsonStringStringifierPretty(output, toEncodable, inde
nt); | 1362 stringifier = new _JsonStringStringifierPretty(output, toEncodable, inde
nt); |
1363 } | 1363 } |
1364 dart.dsend(stringifier, 'writeObject', object); | 1364 dart.dsend(stringifier, 'writeObject', object); |
1365 } | 1365 } |
1366 writeNumber(number) { | 1366 writeNumber(number) { |
1367 this[_sink].write(dart.toString(number)); | 1367 this[_sink].write(dart[dartx.toString](number)); |
1368 } | 1368 } |
1369 writeString(string) { | 1369 writeString(string) { |
1370 this[_sink].write(string); | 1370 this[_sink].write(string); |
1371 } | 1371 } |
1372 writeStringSlice(string, start, end) { | 1372 writeStringSlice(string, start, end) { |
1373 this[_sink].write(string.substring(start, end)); | 1373 this[_sink].write(string[dartx.substring](start, end)); |
1374 } | 1374 } |
1375 writeCharCode(charCode) { | 1375 writeCharCode(charCode) { |
1376 this[_sink].writeCharCode(charCode); | 1376 this[_sink].writeCharCode(charCode); |
1377 } | 1377 } |
1378 } | 1378 } |
1379 dart.setSignature(_JsonStringStringifier, { | 1379 dart.setSignature(_JsonStringStringifier, { |
1380 constructors: () => ({_JsonStringStringifier: [_JsonStringStringifier, [core
.StringSink, core.Object]]}), | 1380 constructors: () => ({_JsonStringStringifier: [_JsonStringStringifier, [core
.StringSink, core.Object]]}), |
1381 methods: () => ({ | 1381 methods: () => ({ |
1382 writeNumber: [dart.void, [core.num]], | 1382 writeNumber: [dart.void, [core.num]], |
1383 writeString: [dart.void, [core.String]], | 1383 writeString: [dart.void, [core.String]], |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1423 stringifier.flush(); | 1423 stringifier.flush(); |
1424 } | 1424 } |
1425 flush() { | 1425 flush() { |
1426 if (dart.notNull(this.index) > 0) { | 1426 if (dart.notNull(this.index) > 0) { |
1427 dart.dcall(this.addChunk, this.buffer, 0, this.index); | 1427 dart.dcall(this.addChunk, this.buffer, 0, this.index); |
1428 } | 1428 } |
1429 this.buffer = null; | 1429 this.buffer = null; |
1430 this.index = 0; | 1430 this.index = 0; |
1431 } | 1431 } |
1432 writeNumber(number) { | 1432 writeNumber(number) { |
1433 this.writeAsciiString(dart.toString(number)); | 1433 this.writeAsciiString(dart[dartx.toString](number)); |
1434 } | 1434 } |
1435 writeAsciiString(string) { | 1435 writeAsciiString(string) { |
1436 for (let i = 0; dart.notNull(i) < dart.notNull(string.length); i = dart.no
tNull(i) + 1) { | 1436 for (let i = 0; dart.notNull(i) < dart.notNull(string.length); i = dart.no
tNull(i) + 1) { |
1437 let char = string.codeUnitAt(i); | 1437 let char = string[dartx.codeUnitAt](i); |
1438 dart.assert(dart.notNull(char) <= 127); | 1438 dart.assert(dart.notNull(char) <= 127); |
1439 this.writeByte(char); | 1439 this.writeByte(char); |
1440 } | 1440 } |
1441 } | 1441 } |
1442 writeString(string) { | 1442 writeString(string) { |
1443 this.writeStringSlice(string, 0, string.length); | 1443 this.writeStringSlice(string, 0, string.length); |
1444 } | 1444 } |
1445 writeStringSlice(string, start, end) { | 1445 writeStringSlice(string, start, end) { |
1446 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { | 1446 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { |
1447 let char = string.codeUnitAt(i); | 1447 let char = string[dartx.codeUnitAt](i); |
1448 if (dart.notNull(char) <= 127) { | 1448 if (dart.notNull(char) <= 127) { |
1449 this.writeByte(char); | 1449 this.writeByte(char); |
1450 } else { | 1450 } else { |
1451 if ((dart.notNull(char) & 64512) == 55296 && dart.notNull(i) + 1 < dar
t.notNull(end)) { | 1451 if ((dart.notNull(char) & 64512) == 55296 && dart.notNull(i) + 1 < dar
t.notNull(end)) { |
1452 let nextChar = string.codeUnitAt(dart.notNull(i) + 1); | 1452 let nextChar = string[dartx.codeUnitAt](dart.notNull(i) + 1); |
1453 if ((dart.notNull(nextChar) & 64512) == 56320) { | 1453 if ((dart.notNull(nextChar) & 64512) == 56320) { |
1454 char = 65536 + ((dart.notNull(char) & 1023) << 10) + (dart.notNull
(nextChar) & 1023); | 1454 char = 65536 + ((dart.notNull(char) & 1023) << 10) + (dart.notNull
(nextChar) & 1023); |
1455 this.writeFourByteCharCode(char); | 1455 this.writeFourByteCharCode(char); |
1456 i = dart.notNull(i) + 1; | 1456 i = dart.notNull(i) + 1; |
1457 continue; | 1457 continue; |
1458 } | 1458 } |
1459 } | 1459 } |
1460 this.writeMultiByteCharCode(char); | 1460 this.writeMultiByteCharCode(char); |
1461 } | 1461 } |
1462 } | 1462 } |
(...skipping 21 matching lines...) Expand all Loading... |
1484 } | 1484 } |
1485 writeFourByteCharCode(charCode) { | 1485 writeFourByteCharCode(charCode) { |
1486 dart.assert(dart.notNull(charCode) <= 1114111); | 1486 dart.assert(dart.notNull(charCode) <= 1114111); |
1487 this.writeByte(240 | dart.notNull(charCode) >> 18); | 1487 this.writeByte(240 | dart.notNull(charCode) >> 18); |
1488 this.writeByte(128 | dart.notNull(charCode) >> 12 & 63); | 1488 this.writeByte(128 | dart.notNull(charCode) >> 12 & 63); |
1489 this.writeByte(128 | dart.notNull(charCode) >> 6 & 63); | 1489 this.writeByte(128 | dart.notNull(charCode) >> 6 & 63); |
1490 this.writeByte(128 | dart.notNull(charCode) & 63); | 1490 this.writeByte(128 | dart.notNull(charCode) & 63); |
1491 } | 1491 } |
1492 writeByte(byte) { | 1492 writeByte(byte) { |
1493 dart.assert(dart.notNull(byte) <= 255); | 1493 dart.assert(dart.notNull(byte) <= 255); |
1494 if (this.index == this.buffer[core.$length]) { | 1494 if (this.index == this.buffer.length) { |
1495 dart.dcall(this.addChunk, this.buffer, 0, this.index); | 1495 dart.dcall(this.addChunk, this.buffer, 0, this.index); |
1496 this.buffer = typed_data.Uint8List.new(this.bufferSize); | 1496 this.buffer = typed_data.Uint8List.new(this.bufferSize); |
1497 this.index = 0; | 1497 this.index = 0; |
1498 } | 1498 } |
1499 this.buffer[core.$set]((() => { | 1499 this.buffer.set((() => { |
1500 let x = this.index; | 1500 let x = this.index; |
1501 this.index = dart.notNull(x) + 1; | 1501 this.index = dart.notNull(x) + 1; |
1502 return x; | 1502 return x; |
1503 })(), byte); | 1503 })(), byte); |
1504 } | 1504 } |
1505 } | 1505 } |
1506 dart.setSignature(_JsonUtf8Stringifier, { | 1506 dart.setSignature(_JsonUtf8Stringifier, { |
1507 constructors: () => ({_JsonUtf8Stringifier: [_JsonUtf8Stringifier, [core.Obj
ect, core.int, core.Function]]}), | 1507 constructors: () => ({_JsonUtf8Stringifier: [_JsonUtf8Stringifier, [core.Obj
ect, core.int, core.Function]]}), |
1508 methods: () => ({ | 1508 methods: () => ({ |
1509 flush: [dart.void, []], | 1509 flush: [dart.void, []], |
1510 writeNumber: [dart.void, [core.num]], | 1510 writeNumber: [dart.void, [core.num]], |
1511 writeAsciiString: [dart.void, [core.String]], | 1511 writeAsciiString: [dart.void, [core.String]], |
1512 writeString: [dart.void, [core.String]], | 1512 writeString: [dart.void, [core.String]], |
1513 writeStringSlice: [dart.void, [core.String, core.int, core.int]], | 1513 writeStringSlice: [dart.void, [core.String, core.int, core.int]], |
1514 writeCharCode: [dart.void, [core.int]], | 1514 writeCharCode: [dart.void, [core.int]], |
1515 writeMultiByteCharCode: [dart.void, [core.int]], | 1515 writeMultiByteCharCode: [dart.void, [core.int]], |
1516 writeFourByteCharCode: [dart.void, [core.int]], | 1516 writeFourByteCharCode: [dart.void, [core.int]], |
1517 writeByte: [dart.void, [core.int]] | 1517 writeByte: [dart.void, [core.int]] |
1518 }), | 1518 }), |
1519 statics: () => ({stringify: [dart.void, [core.Object, core.List$(core.int),
dart.functionType(core.Object, [core.Object]), core.int, dart.functionType(dart.
void, [typed_data.Uint8List, core.int, core.int])]]}), | 1519 statics: () => ({stringify: [dart.void, [core.Object, core.List$(core.int),
dart.functionType(core.Object, [core.Object]), core.int, dart.functionType(dart.
void, [typed_data.Uint8List, core.int, core.int])]]}), |
1520 names: ['stringify'] | 1520 names: ['stringify'] |
1521 }); | 1521 }); |
1522 class _JsonUtf8StringifierPretty extends dart.mixin(_JsonUtf8Stringifier, _Jso
nPrettyPrintMixin) { | 1522 class _JsonUtf8StringifierPretty extends dart.mixin(_JsonUtf8Stringifier, _Jso
nPrettyPrintMixin) { |
1523 _JsonUtf8StringifierPretty(toEncodableFunction, indent, bufferSize, addChunk
) { | 1523 _JsonUtf8StringifierPretty(toEncodableFunction, indent, bufferSize, addChunk
) { |
1524 this.indent = indent; | 1524 this.indent = indent; |
1525 super._JsonUtf8Stringifier(toEncodableFunction, dart.as(bufferSize, core.i
nt), dart.as(addChunk, core.Function)); | 1525 super._JsonUtf8Stringifier(toEncodableFunction, dart.as(bufferSize, core.i
nt), dart.as(addChunk, core.Function)); |
1526 } | 1526 } |
1527 writeIndentation(count) { | 1527 writeIndentation(count) { |
1528 let indent = this.indent; | 1528 let indent = this.indent; |
1529 let indentLength = indent[core.$length]; | 1529 let indentLength = indent.length; |
1530 if (indentLength == 1) { | 1530 if (indentLength == 1) { |
1531 let char = indent[core.$get](0); | 1531 let char = indent[dartx.get](0); |
1532 while (dart.notNull(count) > 0) { | 1532 while (dart.notNull(count) > 0) { |
1533 this.writeByte(char); | 1533 this.writeByte(char); |
1534 count = dart.notNull(count) - 1; | 1534 count = dart.notNull(count) - 1; |
1535 } | 1535 } |
1536 return; | 1536 return; |
1537 } | 1537 } |
1538 while (dart.notNull(count) > 0) { | 1538 while (dart.notNull(count) > 0) { |
1539 count = dart.notNull(count) - 1; | 1539 count = dart.notNull(count) - 1; |
1540 let end = dart.notNull(this.index) + dart.notNull(indentLength); | 1540 let end = dart.notNull(this.index) + dart.notNull(indentLength); |
1541 if (dart.notNull(end) <= dart.notNull(this.buffer[core.$length])) { | 1541 if (dart.notNull(end) <= dart.notNull(this.buffer.length)) { |
1542 this.buffer[core.$setRange](this.index, end, indent); | 1542 this.buffer.setRange(this.index, end, indent); |
1543 this.index = end; | 1543 this.index = end; |
1544 } else { | 1544 } else { |
1545 for (let i = 0; dart.notNull(i) < dart.notNull(indentLength); i = dart
.notNull(i) + 1) { | 1545 for (let i = 0; dart.notNull(i) < dart.notNull(indentLength); i = dart
.notNull(i) + 1) { |
1546 this.writeByte(indent[core.$get](i)); | 1546 this.writeByte(indent[dartx.get](i)); |
1547 } | 1547 } |
1548 } | 1548 } |
1549 } | 1549 } |
1550 } | 1550 } |
1551 } | 1551 } |
1552 dart.setSignature(_JsonUtf8StringifierPretty, { | 1552 dart.setSignature(_JsonUtf8StringifierPretty, { |
1553 constructors: () => ({_JsonUtf8StringifierPretty: [_JsonUtf8StringifierPrett
y, [core.Object, core.List$(core.int), core.Object, core.Object]]}), | 1553 constructors: () => ({_JsonUtf8StringifierPretty: [_JsonUtf8StringifierPrett
y, [core.Object, core.List$(core.int), core.Object, core.Object]]}), |
1554 methods: () => ({writeIndentation: [dart.void, [core.int]]}) | 1554 methods: () => ({writeIndentation: [dart.void, [core.int]]}) |
1555 }); | 1555 }); |
1556 let __CastType0 = dart.typedef('__CastType0', () => dart.functionType(core.Obj
ect, [core.Object])); | 1556 let __CastType0 = dart.typedef('__CastType0', () => dart.functionType(core.Obj
ect, [core.Object])); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1619 }); | 1619 }); |
1620 let _addSliceToSink = Symbol('_addSliceToSink'); | 1620 let _addSliceToSink = Symbol('_addSliceToSink'); |
1621 class _Latin1DecoderSink extends ByteConversionSinkBase { | 1621 class _Latin1DecoderSink extends ByteConversionSinkBase { |
1622 _Latin1DecoderSink(sink) { | 1622 _Latin1DecoderSink(sink) { |
1623 this[_sink] = sink; | 1623 this[_sink] = sink; |
1624 } | 1624 } |
1625 close() { | 1625 close() { |
1626 this[_sink].close(); | 1626 this[_sink].close(); |
1627 } | 1627 } |
1628 add(source) { | 1628 add(source) { |
1629 this.addSlice(source, 0, source[core.$length], false); | 1629 this.addSlice(source, 0, source.length, false); |
1630 } | 1630 } |
1631 [_addSliceToSink](source, start, end, isLast) { | 1631 [_addSliceToSink](source, start, end, isLast) { |
1632 this[_sink].add(core.String.fromCharCodes(source, start, end)); | 1632 this[_sink].add(core.String.fromCharCodes(source, start, end)); |
1633 if (isLast) | 1633 if (isLast) |
1634 this.close(); | 1634 this.close(); |
1635 } | 1635 } |
1636 addSlice(source, start, end, isLast) { | 1636 addSlice(source, start, end, isLast) { |
1637 core.RangeError.checkValidRange(start, end, source[core.$length]); | 1637 core.RangeError.checkValidRange(start, end, source.length); |
1638 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { | 1638 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { |
1639 let char = source[core.$get](i); | 1639 let char = source[dartx.get](i); |
1640 if (dart.notNull(char) > dart.notNull(_LATIN1_MASK) || dart.notNull(char
) < 0) { | 1640 if (dart.notNull(char) > dart.notNull(_LATIN1_MASK) || dart.notNull(char
) < 0) { |
1641 throw new core.FormatException("Source contains non-Latin-1 characters
."); | 1641 throw new core.FormatException("Source contains non-Latin-1 characters
."); |
1642 } | 1642 } |
1643 } | 1643 } |
1644 if (dart.notNull(start) < dart.notNull(end)) { | 1644 if (dart.notNull(start) < dart.notNull(end)) { |
1645 this[_addSliceToSink](source, start, end, isLast); | 1645 this[_addSliceToSink](source, start, end, isLast); |
1646 } | 1646 } |
1647 if (isLast) { | 1647 if (isLast) { |
1648 this.close(); | 1648 this.close(); |
1649 } | 1649 } |
1650 } | 1650 } |
1651 } | 1651 } |
1652 dart.setSignature(_Latin1DecoderSink, { | 1652 dart.setSignature(_Latin1DecoderSink, { |
1653 constructors: () => ({_Latin1DecoderSink: [_Latin1DecoderSink, [StringConver
sionSink]]}), | 1653 constructors: () => ({_Latin1DecoderSink: [_Latin1DecoderSink, [StringConver
sionSink]]}), |
1654 methods: () => ({ | 1654 methods: () => ({ |
1655 close: [dart.void, []], | 1655 close: [dart.void, []], |
1656 add: [dart.void, [core.List$(core.int)]], | 1656 add: [dart.void, [core.List$(core.int)]], |
1657 [_addSliceToSink]: [dart.void, [core.List$(core.int), core.int, core.int,
core.bool]] | 1657 [_addSliceToSink]: [dart.void, [core.List$(core.int), core.int, core.int,
core.bool]] |
1658 }) | 1658 }) |
1659 }); | 1659 }); |
1660 class _Latin1AllowInvalidDecoderSink extends _Latin1DecoderSink { | 1660 class _Latin1AllowInvalidDecoderSink extends _Latin1DecoderSink { |
1661 _Latin1AllowInvalidDecoderSink(sink) { | 1661 _Latin1AllowInvalidDecoderSink(sink) { |
1662 super._Latin1DecoderSink(sink); | 1662 super._Latin1DecoderSink(sink); |
1663 } | 1663 } |
1664 addSlice(source, start, end, isLast) { | 1664 addSlice(source, start, end, isLast) { |
1665 core.RangeError.checkValidRange(start, end, source[core.$length]); | 1665 core.RangeError.checkValidRange(start, end, source.length); |
1666 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { | 1666 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { |
1667 let char = source[core.$get](i); | 1667 let char = source[dartx.get](i); |
1668 if (dart.notNull(char) > dart.notNull(_LATIN1_MASK) || dart.notNull(char
) < 0) { | 1668 if (dart.notNull(char) > dart.notNull(_LATIN1_MASK) || dart.notNull(char
) < 0) { |
1669 if (dart.notNull(i) > dart.notNull(start)) | 1669 if (dart.notNull(i) > dart.notNull(start)) |
1670 this[_addSliceToSink](source, start, i, false); | 1670 this[_addSliceToSink](source, start, i, false); |
1671 this[_addSliceToSink](dart.const(dart.setType([65533], core.List$(core
.int))), 0, 1, false); | 1671 this[_addSliceToSink](dart.const(dart.list([65533], core.int)), 0, 1,
false); |
1672 start = dart.notNull(i) + 1; | 1672 start = dart.notNull(i) + 1; |
1673 } | 1673 } |
1674 } | 1674 } |
1675 if (dart.notNull(start) < dart.notNull(end)) { | 1675 if (dart.notNull(start) < dart.notNull(end)) { |
1676 this[_addSliceToSink](source, start, end, isLast); | 1676 this[_addSliceToSink](source, start, end, isLast); |
1677 } | 1677 } |
1678 if (isLast) { | 1678 if (isLast) { |
1679 this.close(); | 1679 this.close(); |
1680 } | 1680 } |
1681 } | 1681 } |
1682 } | 1682 } |
1683 dart.setSignature(_Latin1AllowInvalidDecoderSink, { | 1683 dart.setSignature(_Latin1AllowInvalidDecoderSink, { |
1684 constructors: () => ({_Latin1AllowInvalidDecoderSink: [_Latin1AllowInvalidDe
coderSink, [StringConversionSink]]}) | 1684 constructors: () => ({_Latin1AllowInvalidDecoderSink: [_Latin1AllowInvalidDe
coderSink, [StringConversionSink]]}) |
1685 }); | 1685 }); |
1686 class LineSplitter extends Converter$(core.String, core.List$(core.String)) { | 1686 class LineSplitter extends Converter$(core.String, core.List$(core.String)) { |
1687 LineSplitter() { | 1687 LineSplitter() { |
1688 super.Converter(); | 1688 super.Converter(); |
1689 } | 1689 } |
1690 convert(data) { | 1690 convert(data) { |
1691 let lines = core.List$(core.String).new(); | 1691 let lines = core.List$(core.String).new(); |
1692 _LineSplitterSink._addSlice(data, 0, data.length, true, dart.bind(lines, c
ore.$add)); | 1692 _LineSplitterSink._addSlice(data, 0, data.length, true, dart.bind(lines, d
artx.add)); |
1693 return lines; | 1693 return lines; |
1694 } | 1694 } |
1695 startChunkedConversion(sink) { | 1695 startChunkedConversion(sink) { |
1696 if (!dart.is(sink, StringConversionSink)) { | 1696 if (!dart.is(sink, StringConversionSink)) { |
1697 sink = StringConversionSink.from(dart.as(sink, core.Sink$(core.String)))
; | 1697 sink = StringConversionSink.from(dart.as(sink, core.Sink$(core.String)))
; |
1698 } | 1698 } |
1699 return new _LineSplitterSink(dart.as(sink, StringConversionSink)); | 1699 return new _LineSplitterSink(dart.as(sink, StringConversionSink)); |
1700 } | 1700 } |
1701 } | 1701 } |
1702 dart.setSignature(LineSplitter, { | 1702 dart.setSignature(LineSplitter, { |
1703 constructors: () => ({LineSplitter: [LineSplitter, []]}), | 1703 constructors: () => ({LineSplitter: [LineSplitter, []]}), |
1704 methods: () => ({ | 1704 methods: () => ({ |
1705 convert: [core.List$(core.String), [core.String]], | 1705 convert: [core.List$(core.String), [core.String]], |
1706 startChunkedConversion: [StringConversionSink, [core.Sink]] | 1706 startChunkedConversion: [StringConversionSink, [core.Sink]] |
1707 }) | 1707 }) |
1708 }); | 1708 }); |
1709 let _carry = Symbol('_carry'); | 1709 let _carry = Symbol('_carry'); |
1710 class _LineSplitterSink extends StringConversionSinkBase { | 1710 class _LineSplitterSink extends StringConversionSinkBase { |
1711 _LineSplitterSink(sink) { | 1711 _LineSplitterSink(sink) { |
1712 this[_sink] = sink; | 1712 this[_sink] = sink; |
1713 this[_carry] = null; | 1713 this[_carry] = null; |
1714 } | 1714 } |
1715 addSlice(chunk, start, end, isLast) { | 1715 addSlice(chunk, start, end, isLast) { |
1716 if (this[_carry] != null) { | 1716 if (this[_carry] != null) { |
1717 chunk = dart.notNull(this[_carry]) + dart.notNull(chunk.substring(start,
end)); | 1717 chunk = dart.notNull(this[_carry]) + dart.notNull(chunk[dartx.substring]
(start, end)); |
1718 start = 0; | 1718 start = 0; |
1719 end = chunk.length; | 1719 end = chunk.length; |
1720 this[_carry] = null; | 1720 this[_carry] = null; |
1721 } | 1721 } |
1722 this[_carry] = _LineSplitterSink._addSlice(chunk, start, end, isLast, dart
.bind(this[_sink], 'add')); | 1722 this[_carry] = _LineSplitterSink._addSlice(chunk, start, end, isLast, dart
.bind(this[_sink], 'add')); |
1723 if (isLast) | 1723 if (isLast) |
1724 this[_sink].close(); | 1724 this[_sink].close(); |
1725 } | 1725 } |
1726 close() { | 1726 close() { |
1727 this.addSlice('', 0, 0, true); | 1727 this.addSlice('', 0, 0, true); |
1728 } | 1728 } |
1729 static _addSlice(chunk, start, end, isLast, adder) { | 1729 static _addSlice(chunk, start, end, isLast, adder) { |
1730 let pos = start; | 1730 let pos = start; |
1731 while (dart.notNull(pos) < dart.notNull(end)) { | 1731 while (dart.notNull(pos) < dart.notNull(end)) { |
1732 let skip = 0; | 1732 let skip = 0; |
1733 let char = chunk.codeUnitAt(pos); | 1733 let char = chunk[dartx.codeUnitAt](pos); |
1734 if (char == _LineSplitterSink._LF) { | 1734 if (char == _LineSplitterSink._LF) { |
1735 skip = 1; | 1735 skip = 1; |
1736 } else if (char == _LineSplitterSink._CR) { | 1736 } else if (char == _LineSplitterSink._CR) { |
1737 skip = 1; | 1737 skip = 1; |
1738 if (dart.notNull(pos) + 1 < dart.notNull(end)) { | 1738 if (dart.notNull(pos) + 1 < dart.notNull(end)) { |
1739 if (chunk.codeUnitAt(dart.notNull(pos) + 1) == _LineSplitterSink._LF
) { | 1739 if (chunk[dartx.codeUnitAt](dart.notNull(pos) + 1) == _LineSplitterS
ink._LF) { |
1740 skip = 2; | 1740 skip = 2; |
1741 } | 1741 } |
1742 } else if (!dart.notNull(isLast)) { | 1742 } else if (!dart.notNull(isLast)) { |
1743 return chunk.substring(start, end); | 1743 return chunk[dartx.substring](start, end); |
1744 } | 1744 } |
1745 } | 1745 } |
1746 if (dart.notNull(skip) > 0) { | 1746 if (dart.notNull(skip) > 0) { |
1747 adder(chunk.substring(start, pos)); | 1747 adder(chunk[dartx.substring](start, pos)); |
1748 start = pos = dart.notNull(pos) + dart.notNull(skip); | 1748 start = pos = dart.notNull(pos) + dart.notNull(skip); |
1749 } else { | 1749 } else { |
1750 pos = dart.notNull(pos) + 1; | 1750 pos = dart.notNull(pos) + 1; |
1751 } | 1751 } |
1752 } | 1752 } |
1753 if (pos != start) { | 1753 if (pos != start) { |
1754 let carry = chunk.substring(start, pos); | 1754 let carry = chunk[dartx.substring](start, pos); |
1755 if (isLast) { | 1755 if (isLast) { |
1756 adder(carry); | 1756 adder(carry); |
1757 } else { | 1757 } else { |
1758 return carry; | 1758 return carry; |
1759 } | 1759 } |
1760 } | 1760 } |
1761 return null; | 1761 return null; |
1762 } | 1762 } |
1763 } | 1763 } |
1764 dart.setSignature(_LineSplitterSink, { | 1764 dart.setSignature(_LineSplitterSink, { |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1866 o = ""; | 1866 o = ""; |
1867 this[_buffer].writeln(o); | 1867 this[_buffer].writeln(o); |
1868 if (dart.notNull(this[_buffer].length) > dart.notNull(_StringConversionSin
kAsStringSinkAdapter._MIN_STRING_SIZE)) | 1868 if (dart.notNull(this[_buffer].length) > dart.notNull(_StringConversionSin
kAsStringSinkAdapter._MIN_STRING_SIZE)) |
1869 this[_flush](); | 1869 this[_flush](); |
1870 } | 1870 } |
1871 writeAll(objects, separator) { | 1871 writeAll(objects, separator) { |
1872 if (separator === void 0) | 1872 if (separator === void 0) |
1873 separator = ""; | 1873 separator = ""; |
1874 if (this[_buffer].isNotEmpty) | 1874 if (this[_buffer].isNotEmpty) |
1875 this[_flush](); | 1875 this[_flush](); |
1876 let iterator = objects[core.$iterator]; | 1876 let iterator = objects[dartx.iterator]; |
1877 if (!dart.notNull(iterator.moveNext())) | 1877 if (!dart.notNull(iterator.moveNext())) |
1878 return; | 1878 return; |
1879 if (separator.isEmpty) { | 1879 if (separator[dartx.isEmpty]) { |
1880 do { | 1880 do { |
1881 this[_chunkedSink].add(dart.toString(iterator.current)); | 1881 this[_chunkedSink].add(dart.toString(iterator.current)); |
1882 } while (iterator.moveNext()); | 1882 } while (iterator.moveNext()); |
1883 } else { | 1883 } else { |
1884 this[_chunkedSink].add(dart.toString(iterator.current)); | 1884 this[_chunkedSink].add(dart.toString(iterator.current)); |
1885 while (iterator.moveNext()) { | 1885 while (iterator.moveNext()) { |
1886 this.write(separator); | 1886 this.write(separator); |
1887 this[_chunkedSink].add(dart.toString(iterator.current)); | 1887 this[_chunkedSink].add(dart.toString(iterator.current)); |
1888 } | 1888 } |
1889 } | 1889 } |
(...skipping 19 matching lines...) Expand all Loading... |
1909 _StringConversionSinkAsStringSinkAdapter._MIN_STRING_SIZE = 16; | 1909 _StringConversionSinkAsStringSinkAdapter._MIN_STRING_SIZE = 16; |
1910 let _stringSink = Symbol('_stringSink'); | 1910 let _stringSink = Symbol('_stringSink'); |
1911 class _StringSinkConversionSink extends StringConversionSinkBase { | 1911 class _StringSinkConversionSink extends StringConversionSinkBase { |
1912 _StringSinkConversionSink(stringSink) { | 1912 _StringSinkConversionSink(stringSink) { |
1913 this[_stringSink] = stringSink; | 1913 this[_stringSink] = stringSink; |
1914 } | 1914 } |
1915 close() {} | 1915 close() {} |
1916 addSlice(str, start, end, isLast) { | 1916 addSlice(str, start, end, isLast) { |
1917 if (start != 0 || end != str.length) { | 1917 if (start != 0 || end != str.length) { |
1918 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNul
l(i) + 1) { | 1918 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNul
l(i) + 1) { |
1919 this[_stringSink].writeCharCode(str.codeUnitAt(i)); | 1919 this[_stringSink].writeCharCode(str[dartx.codeUnitAt](i)); |
1920 } | 1920 } |
1921 } else { | 1921 } else { |
1922 this[_stringSink].write(str); | 1922 this[_stringSink].write(str); |
1923 } | 1923 } |
1924 if (isLast) | 1924 if (isLast) |
1925 this.close(); | 1925 this.close(); |
1926 } | 1926 } |
1927 add(str) { | 1927 add(str) { |
1928 return this[_stringSink].write(str); | 1928 return this[_stringSink].write(str); |
1929 } | 1929 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1963 _StringAdapterSink(sink) { | 1963 _StringAdapterSink(sink) { |
1964 this[_sink] = sink; | 1964 this[_sink] = sink; |
1965 } | 1965 } |
1966 add(str) { | 1966 add(str) { |
1967 return this[_sink].add(str); | 1967 return this[_sink].add(str); |
1968 } | 1968 } |
1969 addSlice(str, start, end, isLast) { | 1969 addSlice(str, start, end, isLast) { |
1970 if (start == 0 && end == str.length) { | 1970 if (start == 0 && end == str.length) { |
1971 this.add(str); | 1971 this.add(str); |
1972 } else { | 1972 } else { |
1973 this.add(str.substring(start, end)); | 1973 this.add(str[dartx.substring](start, end)); |
1974 } | 1974 } |
1975 if (isLast) | 1975 if (isLast) |
1976 this.close(); | 1976 this.close(); |
1977 } | 1977 } |
1978 close() { | 1978 close() { |
1979 return this[_sink].close(); | 1979 return this[_sink].close(); |
1980 } | 1980 } |
1981 } | 1981 } |
1982 dart.setSignature(_StringAdapterSink, { | 1982 dart.setSignature(_StringAdapterSink, { |
1983 constructors: () => ({_StringAdapterSink: [_StringAdapterSink, [core.Sink$(c
ore.String)]]}), | 1983 constructors: () => ({_StringAdapterSink: [_StringAdapterSink, [core.Sink$(c
ore.String)]]}), |
1984 methods: () => ({ | 1984 methods: () => ({ |
1985 addSlice: [dart.void, [core.String, core.int, core.int, core.bool]], | 1985 addSlice: [dart.void, [core.String, core.int, core.int, core.bool]], |
1986 close: [dart.void, []] | 1986 close: [dart.void, []] |
1987 }) | 1987 }) |
1988 }); | 1988 }); |
1989 let _decoder = Symbol('_decoder'); | 1989 let _decoder = Symbol('_decoder'); |
1990 class _Utf8StringSinkAdapter extends ByteConversionSink { | 1990 class _Utf8StringSinkAdapter extends ByteConversionSink { |
1991 _Utf8StringSinkAdapter(sink, stringSink, allowMalformed) { | 1991 _Utf8StringSinkAdapter(sink, stringSink, allowMalformed) { |
1992 this[_sink] = sink; | 1992 this[_sink] = sink; |
1993 this[_decoder] = new _Utf8Decoder(stringSink, allowMalformed); | 1993 this[_decoder] = new _Utf8Decoder(stringSink, allowMalformed); |
1994 super.ByteConversionSink(); | 1994 super.ByteConversionSink(); |
1995 } | 1995 } |
1996 close() { | 1996 close() { |
1997 this[_decoder].close(); | 1997 this[_decoder].close(); |
1998 if (this[_sink] != null) | 1998 if (this[_sink] != null) |
1999 this[_sink].close(); | 1999 this[_sink].close(); |
2000 } | 2000 } |
2001 add(chunk) { | 2001 add(chunk) { |
2002 this.addSlice(chunk, 0, chunk[core.$length], false); | 2002 this.addSlice(chunk, 0, chunk.length, false); |
2003 } | 2003 } |
2004 addSlice(codeUnits, startIndex, endIndex, isLast) { | 2004 addSlice(codeUnits, startIndex, endIndex, isLast) { |
2005 this[_decoder].convert(codeUnits, startIndex, endIndex); | 2005 this[_decoder].convert(codeUnits, startIndex, endIndex); |
2006 if (isLast) | 2006 if (isLast) |
2007 this.close(); | 2007 this.close(); |
2008 } | 2008 } |
2009 } | 2009 } |
2010 dart.setSignature(_Utf8StringSinkAdapter, { | 2010 dart.setSignature(_Utf8StringSinkAdapter, { |
2011 constructors: () => ({_Utf8StringSinkAdapter: [_Utf8StringSinkAdapter, [core
.Sink, core.StringSink, core.bool]]}), | 2011 constructors: () => ({_Utf8StringSinkAdapter: [_Utf8StringSinkAdapter, [core
.Sink, core.StringSink, core.bool]]}), |
2012 methods: () => ({ | 2012 methods: () => ({ |
(...skipping 16 matching lines...) Expand all Loading... |
2029 this[_decoder].close(); | 2029 this[_decoder].close(); |
2030 if (this[_buffer].isNotEmpty) { | 2030 if (this[_buffer].isNotEmpty) { |
2031 let accumulated = dart.toString(this[_buffer]); | 2031 let accumulated = dart.toString(this[_buffer]); |
2032 this[_buffer].clear(); | 2032 this[_buffer].clear(); |
2033 this[_chunkedSink].addSlice(accumulated, 0, accumulated.length, true); | 2033 this[_chunkedSink].addSlice(accumulated, 0, accumulated.length, true); |
2034 } else { | 2034 } else { |
2035 this[_chunkedSink].close(); | 2035 this[_chunkedSink].close(); |
2036 } | 2036 } |
2037 } | 2037 } |
2038 add(chunk) { | 2038 add(chunk) { |
2039 this.addSlice(chunk, 0, chunk[core.$length], false); | 2039 this.addSlice(chunk, 0, chunk.length, false); |
2040 } | 2040 } |
2041 addSlice(chunk, startIndex, endIndex, isLast) { | 2041 addSlice(chunk, startIndex, endIndex, isLast) { |
2042 this[_decoder].convert(chunk, startIndex, endIndex); | 2042 this[_decoder].convert(chunk, startIndex, endIndex); |
2043 if (this[_buffer].isNotEmpty) { | 2043 if (this[_buffer].isNotEmpty) { |
2044 let accumulated = dart.toString(this[_buffer]); | 2044 let accumulated = dart.toString(this[_buffer]); |
2045 this[_chunkedSink].addSlice(accumulated, 0, accumulated.length, isLast); | 2045 this[_chunkedSink].addSlice(accumulated, 0, accumulated.length, isLast); |
2046 this[_buffer].clear(); | 2046 this[_buffer].clear(); |
2047 return; | 2047 return; |
2048 } | 2048 } |
2049 if (isLast) | 2049 if (isLast) |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2107 core.RangeError.checkValidRange(start, end, stringLength); | 2107 core.RangeError.checkValidRange(start, end, stringLength); |
2108 if (end == null) | 2108 if (end == null) |
2109 end = stringLength; | 2109 end = stringLength; |
2110 let length = dart.notNull(end) - dart.notNull(start); | 2110 let length = dart.notNull(end) - dart.notNull(start); |
2111 if (length == 0) | 2111 if (length == 0) |
2112 return typed_data.Uint8List.new(0); | 2112 return typed_data.Uint8List.new(0); |
2113 let encoder = new _Utf8Encoder.withBufferSize(dart.notNull(length) * 3); | 2113 let encoder = new _Utf8Encoder.withBufferSize(dart.notNull(length) * 3); |
2114 let endPosition = encoder[_fillBuffer](string, start, end); | 2114 let endPosition = encoder[_fillBuffer](string, start, end); |
2115 dart.assert(dart.notNull(endPosition) >= dart.notNull(end) - 1); | 2115 dart.assert(dart.notNull(endPosition) >= dart.notNull(end) - 1); |
2116 if (endPosition != end) { | 2116 if (endPosition != end) { |
2117 let lastCodeUnit = string.codeUnitAt(dart.notNull(end) - 1); | 2117 let lastCodeUnit = string[dartx.codeUnitAt](dart.notNull(end) - 1); |
2118 dart.assert(_isLeadSurrogate(lastCodeUnit)); | 2118 dart.assert(_isLeadSurrogate(lastCodeUnit)); |
2119 let wasCombined = encoder[_writeSurrogate](lastCodeUnit, 0); | 2119 let wasCombined = encoder[_writeSurrogate](lastCodeUnit, 0); |
2120 dart.assert(!dart.notNull(wasCombined)); | 2120 dart.assert(!dart.notNull(wasCombined)); |
2121 } | 2121 } |
2122 return encoder[_buffer][core.$sublist](0, encoder[_bufferIndex]); | 2122 return encoder[_buffer][dartx.sublist](0, encoder[_bufferIndex]); |
2123 } | 2123 } |
2124 startChunkedConversion(sink) { | 2124 startChunkedConversion(sink) { |
2125 if (!dart.is(sink, ByteConversionSink)) { | 2125 if (!dart.is(sink, ByteConversionSink)) { |
2126 sink = ByteConversionSink.from(sink); | 2126 sink = ByteConversionSink.from(sink); |
2127 } | 2127 } |
2128 return new _Utf8EncoderSink(dart.as(sink, ByteConversionSink)); | 2128 return new _Utf8EncoderSink(dart.as(sink, ByteConversionSink)); |
2129 } | 2129 } |
2130 bind(stream) { | 2130 bind(stream) { |
2131 return super.bind(stream); | 2131 return super.bind(stream); |
2132 } | 2132 } |
(...skipping 16 matching lines...) Expand all Loading... |
2149 this[_bufferIndex] = 0; | 2149 this[_bufferIndex] = 0; |
2150 } | 2150 } |
2151 static _createBuffer(size) { | 2151 static _createBuffer(size) { |
2152 return typed_data.Uint8List.new(size); | 2152 return typed_data.Uint8List.new(size); |
2153 } | 2153 } |
2154 [_writeSurrogate](leadingSurrogate, nextCodeUnit) { | 2154 [_writeSurrogate](leadingSurrogate, nextCodeUnit) { |
2155 if (_isTailSurrogate(nextCodeUnit)) { | 2155 if (_isTailSurrogate(nextCodeUnit)) { |
2156 let rune = _combineSurrogatePair(leadingSurrogate, nextCodeUnit); | 2156 let rune = _combineSurrogatePair(leadingSurrogate, nextCodeUnit); |
2157 dart.assert(dart.notNull(rune) > dart.notNull(_THREE_BYTE_LIMIT)); | 2157 dart.assert(dart.notNull(rune) > dart.notNull(_THREE_BYTE_LIMIT)); |
2158 dart.assert(dart.notNull(rune) <= dart.notNull(_FOUR_BYTE_LIMIT)); | 2158 dart.assert(dart.notNull(rune) <= dart.notNull(_FOUR_BYTE_LIMIT)); |
2159 this[_buffer][core.$set]((() => { | 2159 this[_buffer][dartx.set]((() => { |
2160 let x = this[_bufferIndex]; | 2160 let x = this[_bufferIndex]; |
2161 this[_bufferIndex] = dart.notNull(x) + 1; | 2161 this[_bufferIndex] = dart.notNull(x) + 1; |
2162 return x; | 2162 return x; |
2163 })(), 240 | dart.notNull(rune) >> 18); | 2163 })(), 240 | dart.notNull(rune) >> 18); |
2164 this[_buffer][core.$set]((() => { | 2164 this[_buffer][dartx.set]((() => { |
2165 let x = this[_bufferIndex]; | 2165 let x = this[_bufferIndex]; |
2166 this[_bufferIndex] = dart.notNull(x) + 1; | 2166 this[_bufferIndex] = dart.notNull(x) + 1; |
2167 return x; | 2167 return x; |
2168 })(), 128 | dart.notNull(rune) >> 12 & 63); | 2168 })(), 128 | dart.notNull(rune) >> 12 & 63); |
2169 this[_buffer][core.$set]((() => { | 2169 this[_buffer][dartx.set]((() => { |
2170 let x = this[_bufferIndex]; | 2170 let x = this[_bufferIndex]; |
2171 this[_bufferIndex] = dart.notNull(x) + 1; | 2171 this[_bufferIndex] = dart.notNull(x) + 1; |
2172 return x; | 2172 return x; |
2173 })(), 128 | dart.notNull(rune) >> 6 & 63); | 2173 })(), 128 | dart.notNull(rune) >> 6 & 63); |
2174 this[_buffer][core.$set]((() => { | 2174 this[_buffer][dartx.set]((() => { |
2175 let x = this[_bufferIndex]; | 2175 let x = this[_bufferIndex]; |
2176 this[_bufferIndex] = dart.notNull(x) + 1; | 2176 this[_bufferIndex] = dart.notNull(x) + 1; |
2177 return x; | 2177 return x; |
2178 })(), 128 | dart.notNull(rune) & 63); | 2178 })(), 128 | dart.notNull(rune) & 63); |
2179 return true; | 2179 return true; |
2180 } else { | 2180 } else { |
2181 this[_buffer][core.$set]((() => { | 2181 this[_buffer][dartx.set]((() => { |
2182 let x = this[_bufferIndex]; | 2182 let x = this[_bufferIndex]; |
2183 this[_bufferIndex] = dart.notNull(x) + 1; | 2183 this[_bufferIndex] = dart.notNull(x) + 1; |
2184 return x; | 2184 return x; |
2185 })(), 224 | dart.notNull(leadingSurrogate) >> 12); | 2185 })(), 224 | dart.notNull(leadingSurrogate) >> 12); |
2186 this[_buffer][core.$set]((() => { | 2186 this[_buffer][dartx.set]((() => { |
2187 let x = this[_bufferIndex]; | 2187 let x = this[_bufferIndex]; |
2188 this[_bufferIndex] = dart.notNull(x) + 1; | 2188 this[_bufferIndex] = dart.notNull(x) + 1; |
2189 return x; | 2189 return x; |
2190 })(), 128 | dart.notNull(leadingSurrogate) >> 6 & 63); | 2190 })(), 128 | dart.notNull(leadingSurrogate) >> 6 & 63); |
2191 this[_buffer][core.$set]((() => { | 2191 this[_buffer][dartx.set]((() => { |
2192 let x = this[_bufferIndex]; | 2192 let x = this[_bufferIndex]; |
2193 this[_bufferIndex] = dart.notNull(x) + 1; | 2193 this[_bufferIndex] = dart.notNull(x) + 1; |
2194 return x; | 2194 return x; |
2195 })(), 128 | dart.notNull(leadingSurrogate) & 63); | 2195 })(), 128 | dart.notNull(leadingSurrogate) & 63); |
2196 return false; | 2196 return false; |
2197 } | 2197 } |
2198 } | 2198 } |
2199 [_fillBuffer](str, start, end) { | 2199 [_fillBuffer](str, start, end) { |
2200 if (start != end && dart.notNull(_isLeadSurrogate(str.codeUnitAt(dart.notN
ull(end) - 1)))) { | 2200 if (start != end && dart.notNull(_isLeadSurrogate(str[dartx.codeUnitAt](da
rt.notNull(end) - 1)))) { |
2201 end = dart.notNull(end) - 1; | 2201 end = dart.notNull(end) - 1; |
2202 } | 2202 } |
2203 let stringIndex = null; | 2203 let stringIndex = null; |
2204 for (stringIndex = start; dart.notNull(stringIndex) < dart.notNull(end); s
tringIndex = dart.notNull(stringIndex) + 1) { | 2204 for (stringIndex = start; dart.notNull(stringIndex) < dart.notNull(end); s
tringIndex = dart.notNull(stringIndex) + 1) { |
2205 let codeUnit = str.codeUnitAt(stringIndex); | 2205 let codeUnit = str[dartx.codeUnitAt](stringIndex); |
2206 if (dart.notNull(codeUnit) <= dart.notNull(_ONE_BYTE_LIMIT)) { | 2206 if (dart.notNull(codeUnit) <= dart.notNull(_ONE_BYTE_LIMIT)) { |
2207 if (dart.notNull(this[_bufferIndex]) >= dart.notNull(this[_buffer][cor
e.$length])) | 2207 if (dart.notNull(this[_bufferIndex]) >= dart.notNull(this[_buffer].len
gth)) |
2208 break; | 2208 break; |
2209 this[_buffer][core.$set]((() => { | 2209 this[_buffer][dartx.set]((() => { |
2210 let x = this[_bufferIndex]; | 2210 let x = this[_bufferIndex]; |
2211 this[_bufferIndex] = dart.notNull(x) + 1; | 2211 this[_bufferIndex] = dart.notNull(x) + 1; |
2212 return x; | 2212 return x; |
2213 })(), codeUnit); | 2213 })(), codeUnit); |
2214 } else if (_isLeadSurrogate(codeUnit)) { | 2214 } else if (_isLeadSurrogate(codeUnit)) { |
2215 if (dart.notNull(this[_bufferIndex]) + 3 >= dart.notNull(this[_buffer]
[core.$length])) | 2215 if (dart.notNull(this[_bufferIndex]) + 3 >= dart.notNull(this[_buffer]
.length)) |
2216 break; | 2216 break; |
2217 let nextCodeUnit = str.codeUnitAt(dart.notNull(stringIndex) + 1); | 2217 let nextCodeUnit = str[dartx.codeUnitAt](dart.notNull(stringIndex) + 1
); |
2218 let wasCombined = this[_writeSurrogate](codeUnit, nextCodeUnit); | 2218 let wasCombined = this[_writeSurrogate](codeUnit, nextCodeUnit); |
2219 if (wasCombined) { | 2219 if (wasCombined) { |
2220 stringIndex = dart.notNull(stringIndex) + 1; | 2220 stringIndex = dart.notNull(stringIndex) + 1; |
2221 } | 2221 } |
2222 } else { | 2222 } else { |
2223 let rune = codeUnit; | 2223 let rune = codeUnit; |
2224 if (dart.notNull(rune) <= dart.notNull(_TWO_BYTE_LIMIT)) { | 2224 if (dart.notNull(rune) <= dart.notNull(_TWO_BYTE_LIMIT)) { |
2225 if (dart.notNull(this[_bufferIndex]) + 1 >= dart.notNull(this[_buffe
r][core.$length])) | 2225 if (dart.notNull(this[_bufferIndex]) + 1 >= dart.notNull(this[_buffe
r].length)) |
2226 break; | 2226 break; |
2227 this[_buffer][core.$set]((() => { | 2227 this[_buffer][dartx.set]((() => { |
2228 let x = this[_bufferIndex]; | 2228 let x = this[_bufferIndex]; |
2229 this[_bufferIndex] = dart.notNull(x) + 1; | 2229 this[_bufferIndex] = dart.notNull(x) + 1; |
2230 return x; | 2230 return x; |
2231 })(), 192 | dart.notNull(rune) >> 6); | 2231 })(), 192 | dart.notNull(rune) >> 6); |
2232 this[_buffer][core.$set]((() => { | 2232 this[_buffer][dartx.set]((() => { |
2233 let x = this[_bufferIndex]; | 2233 let x = this[_bufferIndex]; |
2234 this[_bufferIndex] = dart.notNull(x) + 1; | 2234 this[_bufferIndex] = dart.notNull(x) + 1; |
2235 return x; | 2235 return x; |
2236 })(), 128 | dart.notNull(rune) & 63); | 2236 })(), 128 | dart.notNull(rune) & 63); |
2237 } else { | 2237 } else { |
2238 dart.assert(dart.notNull(rune) <= dart.notNull(_THREE_BYTE_LIMIT)); | 2238 dart.assert(dart.notNull(rune) <= dart.notNull(_THREE_BYTE_LIMIT)); |
2239 if (dart.notNull(this[_bufferIndex]) + 2 >= dart.notNull(this[_buffe
r][core.$length])) | 2239 if (dart.notNull(this[_bufferIndex]) + 2 >= dart.notNull(this[_buffe
r].length)) |
2240 break; | 2240 break; |
2241 this[_buffer][core.$set]((() => { | 2241 this[_buffer][dartx.set]((() => { |
2242 let x = this[_bufferIndex]; | 2242 let x = this[_bufferIndex]; |
2243 this[_bufferIndex] = dart.notNull(x) + 1; | 2243 this[_bufferIndex] = dart.notNull(x) + 1; |
2244 return x; | 2244 return x; |
2245 })(), 224 | dart.notNull(rune) >> 12); | 2245 })(), 224 | dart.notNull(rune) >> 12); |
2246 this[_buffer][core.$set]((() => { | 2246 this[_buffer][dartx.set]((() => { |
2247 let x = this[_bufferIndex]; | 2247 let x = this[_bufferIndex]; |
2248 this[_bufferIndex] = dart.notNull(x) + 1; | 2248 this[_bufferIndex] = dart.notNull(x) + 1; |
2249 return x; | 2249 return x; |
2250 })(), 128 | dart.notNull(rune) >> 6 & 63); | 2250 })(), 128 | dart.notNull(rune) >> 6 & 63); |
2251 this[_buffer][core.$set]((() => { | 2251 this[_buffer][dartx.set]((() => { |
2252 let x = this[_bufferIndex]; | 2252 let x = this[_bufferIndex]; |
2253 this[_bufferIndex] = dart.notNull(x) + 1; | 2253 this[_bufferIndex] = dart.notNull(x) + 1; |
2254 return x; | 2254 return x; |
2255 })(), 128 | dart.notNull(rune) & 63); | 2255 })(), 128 | dart.notNull(rune) & 63); |
2256 } | 2256 } |
2257 } | 2257 } |
2258 } | 2258 } |
2259 return stringIndex; | 2259 return stringIndex; |
2260 } | 2260 } |
2261 } | 2261 } |
(...skipping 24 matching lines...) Expand all Loading... |
2286 this[_sink].close(); | 2286 this[_sink].close(); |
2287 } | 2287 } |
2288 addSlice(str, start, end, isLast) { | 2288 addSlice(str, start, end, isLast) { |
2289 this[_bufferIndex] = 0; | 2289 this[_bufferIndex] = 0; |
2290 if (start == end && !dart.notNull(isLast)) { | 2290 if (start == end && !dart.notNull(isLast)) { |
2291 return; | 2291 return; |
2292 } | 2292 } |
2293 if (this[_carry] != 0) { | 2293 if (this[_carry] != 0) { |
2294 let nextCodeUnit = 0; | 2294 let nextCodeUnit = 0; |
2295 if (start != end) { | 2295 if (start != end) { |
2296 nextCodeUnit = str.codeUnitAt(start); | 2296 nextCodeUnit = str[dartx.codeUnitAt](start); |
2297 } else { | 2297 } else { |
2298 dart.assert(isLast); | 2298 dart.assert(isLast); |
2299 } | 2299 } |
2300 let wasCombined = this[_writeSurrogate](this[_carry], nextCodeUnit); | 2300 let wasCombined = this[_writeSurrogate](this[_carry], nextCodeUnit); |
2301 dart.assert(!dart.notNull(wasCombined) || start != end); | 2301 dart.assert(!dart.notNull(wasCombined) || start != end); |
2302 if (wasCombined) { | 2302 if (wasCombined) { |
2303 start = dart.notNull(start) + 1; | 2303 start = dart.notNull(start) + 1; |
2304 } | 2304 } |
2305 this[_carry] = 0; | 2305 this[_carry] = 0; |
2306 } | 2306 } |
2307 do { | 2307 do { |
2308 start = this[_fillBuffer](str, start, end); | 2308 start = this[_fillBuffer](str, start, end); |
2309 let isLastSlice = dart.notNull(isLast) && start == end; | 2309 let isLastSlice = dart.notNull(isLast) && start == end; |
2310 if (start == dart.notNull(end) - 1 && dart.notNull(_isLeadSurrogate(str.
codeUnitAt(start)))) { | 2310 if (start == dart.notNull(end) - 1 && dart.notNull(_isLeadSurrogate(str[
dartx.codeUnitAt](start)))) { |
2311 if (dart.notNull(isLast) && dart.notNull(this[_bufferIndex]) < dart.no
tNull(this[_buffer][core.$length]) - 3) { | 2311 if (dart.notNull(isLast) && dart.notNull(this[_bufferIndex]) < dart.no
tNull(this[_buffer].length) - 3) { |
2312 let hasBeenCombined = this[_writeSurrogate](str.codeUnitAt(start), 0
); | 2312 let hasBeenCombined = this[_writeSurrogate](str[dartx.codeUnitAt](st
art), 0); |
2313 dart.assert(!dart.notNull(hasBeenCombined)); | 2313 dart.assert(!dart.notNull(hasBeenCombined)); |
2314 } else { | 2314 } else { |
2315 this[_carry] = str.codeUnitAt(start); | 2315 this[_carry] = str[dartx.codeUnitAt](start); |
2316 } | 2316 } |
2317 start = dart.notNull(start) + 1; | 2317 start = dart.notNull(start) + 1; |
2318 } | 2318 } |
2319 this[_sink].addSlice(this[_buffer], 0, this[_bufferIndex], isLastSlice); | 2319 this[_sink].addSlice(this[_buffer], 0, this[_bufferIndex], isLastSlice); |
2320 this[_bufferIndex] = 0; | 2320 this[_bufferIndex] = 0; |
2321 } while (dart.notNull(start) < dart.notNull(end)); | 2321 } while (dart.notNull(start) < dart.notNull(end)); |
2322 if (isLast) | 2322 if (isLast) |
2323 this.close(); | 2323 this.close(); |
2324 } | 2324 } |
2325 } | 2325 } |
2326 dart.setSignature(_Utf8EncoderSink, { | 2326 dart.setSignature(_Utf8EncoderSink, { |
2327 constructors: () => ({_Utf8EncoderSink: [_Utf8EncoderSink, [ByteConversionSi
nk]]}), | 2327 constructors: () => ({_Utf8EncoderSink: [_Utf8EncoderSink, [ByteConversionSi
nk]]}), |
2328 methods: () => ({ | 2328 methods: () => ({ |
2329 close: [dart.void, []], | 2329 close: [dart.void, []], |
2330 addSlice: [dart.void, [core.String, core.int, core.int, core.bool]] | 2330 addSlice: [dart.void, [core.String, core.int, core.int, core.bool]] |
2331 }) | 2331 }) |
2332 }); | 2332 }); |
2333 class Utf8Decoder extends Converter$(core.List$(core.int), core.String) { | 2333 class Utf8Decoder extends Converter$(core.List$(core.int), core.String) { |
2334 Utf8Decoder(opts) { | 2334 Utf8Decoder(opts) { |
2335 let allowMalformed = opts && 'allowMalformed' in opts ? opts.allowMalforme
d : false; | 2335 let allowMalformed = opts && 'allowMalformed' in opts ? opts.allowMalforme
d : false; |
2336 this[_allowMalformed] = allowMalformed; | 2336 this[_allowMalformed] = allowMalformed; |
2337 super.Converter(); | 2337 super.Converter(); |
2338 } | 2338 } |
2339 convert(codeUnits, start, end) { | 2339 convert(codeUnits, start, end) { |
2340 if (start === void 0) | 2340 if (start === void 0) |
2341 start = 0; | 2341 start = 0; |
2342 if (end === void 0) | 2342 if (end === void 0) |
2343 end = null; | 2343 end = null; |
2344 let length = codeUnits[core.$length]; | 2344 let length = codeUnits.length; |
2345 core.RangeError.checkValidRange(start, end, length); | 2345 core.RangeError.checkValidRange(start, end, length); |
2346 if (end == null) | 2346 if (end == null) |
2347 end = length; | 2347 end = length; |
2348 let buffer = new core.StringBuffer(); | 2348 let buffer = new core.StringBuffer(); |
2349 let decoder = new _Utf8Decoder(buffer, this[_allowMalformed]); | 2349 let decoder = new _Utf8Decoder(buffer, this[_allowMalformed]); |
2350 decoder.convert(codeUnits, start, end); | 2350 decoder.convert(codeUnits, start, end); |
2351 decoder.close(); | 2351 decoder.close(); |
2352 return dart.toString(buffer); | 2352 return dart.toString(buffer); |
2353 } | 2353 } |
2354 startChunkedConversion(sink) { | 2354 startChunkedConversion(sink) { |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2457 dart.fn(addSingleBytes, dart.void, [core.int, core.int]); | 2457 dart.fn(addSingleBytes, dart.void, [core.int, core.int]); |
2458 let i = startIndex; | 2458 let i = startIndex; |
2459 loop: | 2459 loop: |
2460 while (true) { | 2460 while (true) { |
2461 multibyte: | 2461 multibyte: |
2462 if (dart.notNull(expectedUnits) > 0) { | 2462 if (dart.notNull(expectedUnits) > 0) { |
2463 do { | 2463 do { |
2464 if (i == endIndex) { | 2464 if (i == endIndex) { |
2465 break loop; | 2465 break loop; |
2466 } | 2466 } |
2467 let unit = codeUnits[core.$get](i); | 2467 let unit = codeUnits[dartx.get](i); |
2468 if ((dart.notNull(unit) & 192) != 128) { | 2468 if ((dart.notNull(unit) & 192) != 128) { |
2469 expectedUnits = 0; | 2469 expectedUnits = 0; |
2470 if (!dart.notNull(this[_allowMalformed])) { | 2470 if (!dart.notNull(this[_allowMalformed])) { |
2471 throw new core.FormatException(`Bad UTF-8 encoding 0x${unit.
toRadixString(16)}`); | 2471 throw new core.FormatException(`Bad UTF-8 encoding 0x${unit[
dartx.toRadixString](16)}`); |
2472 } | 2472 } |
2473 this[_isFirstCharacter] = false; | 2473 this[_isFirstCharacter] = false; |
2474 this[_stringSink].writeCharCode(UNICODE_REPLACEMENT_CHARACTER_
RUNE); | 2474 this[_stringSink].writeCharCode(UNICODE_REPLACEMENT_CHARACTER_
RUNE); |
2475 break multibyte; | 2475 break multibyte; |
2476 } else { | 2476 } else { |
2477 value = dart.notNull(value) << 6 | dart.notNull(unit) & 63; | 2477 value = dart.notNull(value) << 6 | dart.notNull(unit) & 63; |
2478 expectedUnits = dart.notNull(expectedUnits) - 1; | 2478 expectedUnits = dart.notNull(expectedUnits) - 1; |
2479 i = dart.notNull(i) + 1; | 2479 i = dart.notNull(i) + 1; |
2480 } | 2480 } |
2481 } while (dart.notNull(expectedUnits) > 0); | 2481 } while (dart.notNull(expectedUnits) > 0); |
2482 if (dart.notNull(value) <= dart.notNull(_Utf8Decoder._LIMITS[core.
$get](dart.notNull(extraUnits) - 1))) { | 2482 if (dart.notNull(value) <= dart.notNull(_Utf8Decoder._LIMITS[dartx
.get](dart.notNull(extraUnits) - 1))) { |
2483 if (!dart.notNull(this[_allowMalformed])) { | 2483 if (!dart.notNull(this[_allowMalformed])) { |
2484 throw new core.FormatException(`Overlong encoding of 0x${value
.toRadixString(16)}`); | 2484 throw new core.FormatException(`Overlong encoding of 0x${value
[dartx.toRadixString](16)}`); |
2485 } | 2485 } |
2486 expectedUnits = extraUnits = 0; | 2486 expectedUnits = extraUnits = 0; |
2487 value = UNICODE_REPLACEMENT_CHARACTER_RUNE; | 2487 value = UNICODE_REPLACEMENT_CHARACTER_RUNE; |
2488 } | 2488 } |
2489 if (dart.notNull(value) > dart.notNull(_FOUR_BYTE_LIMIT)) { | 2489 if (dart.notNull(value) > dart.notNull(_FOUR_BYTE_LIMIT)) { |
2490 if (!dart.notNull(this[_allowMalformed])) { | 2490 if (!dart.notNull(this[_allowMalformed])) { |
2491 throw new core.FormatException("Character outside valid Unicod
e range: " + `0x${value.toRadixString(16)}`); | 2491 throw new core.FormatException("Character outside valid Unicod
e range: " + `0x${value[dartx.toRadixString](16)}`); |
2492 } | 2492 } |
2493 value = UNICODE_REPLACEMENT_CHARACTER_RUNE; | 2493 value = UNICODE_REPLACEMENT_CHARACTER_RUNE; |
2494 } | 2494 } |
2495 if (!dart.notNull(this[_isFirstCharacter]) || value != UNICODE_BOM
_CHARACTER_RUNE) { | 2495 if (!dart.notNull(this[_isFirstCharacter]) || value != UNICODE_BOM
_CHARACTER_RUNE) { |
2496 this[_stringSink].writeCharCode(value); | 2496 this[_stringSink].writeCharCode(value); |
2497 } | 2497 } |
2498 this[_isFirstCharacter] = false; | 2498 this[_isFirstCharacter] = false; |
2499 } | 2499 } |
2500 while (dart.notNull(i) < dart.notNull(endIndex)) { | 2500 while (dart.notNull(i) < dart.notNull(endIndex)) { |
2501 let oneBytes = scanOneByteCharacters(codeUnits, i); | 2501 let oneBytes = scanOneByteCharacters(codeUnits, i); |
2502 if (dart.notNull(oneBytes) > 0) { | 2502 if (dart.notNull(oneBytes) > 0) { |
2503 this[_isFirstCharacter] = false; | 2503 this[_isFirstCharacter] = false; |
2504 addSingleBytes(i, dart.notNull(i) + dart.notNull(oneBytes)); | 2504 addSingleBytes(i, dart.notNull(i) + dart.notNull(oneBytes)); |
2505 i = dart.notNull(i) + dart.notNull(oneBytes); | 2505 i = dart.notNull(i) + dart.notNull(oneBytes); |
2506 if (i == endIndex) | 2506 if (i == endIndex) |
2507 break; | 2507 break; |
2508 } | 2508 } |
2509 let unit = codeUnits[core.$get]((() => { | 2509 let unit = codeUnits[dartx.get]((() => { |
2510 let x = i; | 2510 let x = i; |
2511 i = dart.notNull(x) + 1; | 2511 i = dart.notNull(x) + 1; |
2512 return x; | 2512 return x; |
2513 })()); | 2513 })()); |
2514 if (dart.notNull(unit) < 0) { | 2514 if (dart.notNull(unit) < 0) { |
2515 if (!dart.notNull(this[_allowMalformed])) { | 2515 if (!dart.notNull(this[_allowMalformed])) { |
2516 throw new core.FormatException(`Negative UTF-8 code unit: -0x${(
-dart.notNull(unit)).toRadixString(16)}`); | 2516 throw new core.FormatException(`Negative UTF-8 code unit: -0x${(
-dart.notNull(unit))[dartx.toRadixString](16)}`); |
2517 } | 2517 } |
2518 this[_stringSink].writeCharCode(UNICODE_REPLACEMENT_CHARACTER_RUNE
); | 2518 this[_stringSink].writeCharCode(UNICODE_REPLACEMENT_CHARACTER_RUNE
); |
2519 } else { | 2519 } else { |
2520 dart.assert(dart.notNull(unit) > dart.notNull(_ONE_BYTE_LIMIT)); | 2520 dart.assert(dart.notNull(unit) > dart.notNull(_ONE_BYTE_LIMIT)); |
2521 if ((dart.notNull(unit) & 224) == 192) { | 2521 if ((dart.notNull(unit) & 224) == 192) { |
2522 value = dart.notNull(unit) & 31; | 2522 value = dart.notNull(unit) & 31; |
2523 expectedUnits = extraUnits = 1; | 2523 expectedUnits = extraUnits = 1; |
2524 continue loop; | 2524 continue loop; |
2525 } | 2525 } |
2526 if ((dart.notNull(unit) & 240) == 224) { | 2526 if ((dart.notNull(unit) & 240) == 224) { |
2527 value = dart.notNull(unit) & 15; | 2527 value = dart.notNull(unit) & 15; |
2528 expectedUnits = extraUnits = 2; | 2528 expectedUnits = extraUnits = 2; |
2529 continue loop; | 2529 continue loop; |
2530 } | 2530 } |
2531 if ((dart.notNull(unit) & 248) == 240 && dart.notNull(unit) < 245)
{ | 2531 if ((dart.notNull(unit) & 248) == 240 && dart.notNull(unit) < 245)
{ |
2532 value = dart.notNull(unit) & 7; | 2532 value = dart.notNull(unit) & 7; |
2533 expectedUnits = extraUnits = 3; | 2533 expectedUnits = extraUnits = 3; |
2534 continue loop; | 2534 continue loop; |
2535 } | 2535 } |
2536 if (!dart.notNull(this[_allowMalformed])) { | 2536 if (!dart.notNull(this[_allowMalformed])) { |
2537 throw new core.FormatException(`Bad UTF-8 encoding 0x${unit.toRa
dixString(16)}`); | 2537 throw new core.FormatException(`Bad UTF-8 encoding 0x${unit[dart
x.toRadixString](16)}`); |
2538 } | 2538 } |
2539 value = UNICODE_REPLACEMENT_CHARACTER_RUNE; | 2539 value = UNICODE_REPLACEMENT_CHARACTER_RUNE; |
2540 expectedUnits = extraUnits = 0; | 2540 expectedUnits = extraUnits = 0; |
2541 this[_isFirstCharacter] = false; | 2541 this[_isFirstCharacter] = false; |
2542 this[_stringSink].writeCharCode(value); | 2542 this[_stringSink].writeCharCode(value); |
2543 } | 2543 } |
2544 } | 2544 } |
2545 break loop; | 2545 break loop; |
2546 } | 2546 } |
2547 if (dart.notNull(expectedUnits) > 0) { | 2547 if (dart.notNull(expectedUnits) > 0) { |
2548 this[_value] = value; | 2548 this[_value] = value; |
2549 this[_expectedUnits] = expectedUnits; | 2549 this[_expectedUnits] = expectedUnits; |
2550 this[_extraUnits] = extraUnits; | 2550 this[_extraUnits] = extraUnits; |
2551 } | 2551 } |
2552 } | 2552 } |
2553 } | 2553 } |
2554 dart.setSignature(_Utf8Decoder, { | 2554 dart.setSignature(_Utf8Decoder, { |
2555 constructors: () => ({_Utf8Decoder: [_Utf8Decoder, [core.StringSink, core.bo
ol]]}), | 2555 constructors: () => ({_Utf8Decoder: [_Utf8Decoder, [core.StringSink, core.bo
ol]]}), |
2556 methods: () => ({ | 2556 methods: () => ({ |
2557 close: [dart.void, []], | 2557 close: [dart.void, []], |
2558 flush: [dart.void, []], | 2558 flush: [dart.void, []], |
2559 convert: [dart.void, [core.List$(core.int), core.int, core.int]] | 2559 convert: [dart.void, [core.List$(core.int), core.int, core.int]] |
2560 }) | 2560 }) |
2561 }); | 2561 }); |
2562 _Utf8Decoder._LIMITS = dart.const(dart.setType([_ONE_BYTE_LIMIT, _TWO_BYTE_LIM
IT, _THREE_BYTE_LIMIT, _FOUR_BYTE_LIMIT], core.List$(core.int))); | 2562 _Utf8Decoder._LIMITS = dart.const(dart.list([_ONE_BYTE_LIMIT, _TWO_BYTE_LIMIT,
_THREE_BYTE_LIMIT, _FOUR_BYTE_LIMIT], core.int)); |
2563 let _processed = Symbol('_processed'); | 2563 let _processed = Symbol('_processed'); |
2564 let _computeKeys = Symbol('_computeKeys'); | 2564 let _computeKeys = Symbol('_computeKeys'); |
2565 let _original = Symbol('_original'); | 2565 let _original = Symbol('_original'); |
2566 function _convertJsonToDart(json, reviver) { | 2566 function _convertJsonToDart(json, reviver) { |
2567 dart.assert(reviver != null); | 2567 dart.assert(reviver != null); |
2568 let walk = e => { | 2568 let walk = e => { |
2569 if (e == null || typeof e != "object") { | 2569 if (e == null || typeof e != "object") { |
2570 return e; | 2570 return e; |
2571 } | 2571 } |
2572 if (Object.getPrototypeOf(e) === Array.prototype) { | 2572 if (Object.getPrototypeOf(e) === Array.prototype) { |
2573 for (let i = 0; dart.notNull(i) < e.length; i = dart.notNull(i) + 1) { | 2573 for (let i = 0; dart.notNull(i) < e.length; i = dart.notNull(i) + 1) { |
2574 let item = e[i]; | 2574 let item = e[i]; |
2575 e[i] = dart.dcall(reviver, i, walk(item)); | 2575 e[i] = dart.dcall(reviver, i, walk(item)); |
2576 } | 2576 } |
2577 return e; | 2577 return e; |
2578 } | 2578 } |
2579 let map = new _JsonMap(e); | 2579 let map = new _JsonMap(e); |
2580 let processed = map[_processed]; | 2580 let processed = map[_processed]; |
2581 let keys = map[_computeKeys](); | 2581 let keys = map[_computeKeys](); |
2582 for (let i = 0; dart.notNull(i) < dart.notNull(keys[core.$length]); i = da
rt.notNull(i) + 1) { | 2582 for (let i = 0; dart.notNull(i) < dart.notNull(keys.length); i = dart.notN
ull(i) + 1) { |
2583 let key = keys[core.$get](i); | 2583 let key = keys[dartx.get](i); |
2584 let revived = dart.dcall(reviver, key, walk(e[key])); | 2584 let revived = dart.dcall(reviver, key, walk(e[key])); |
2585 processed[key] = revived; | 2585 processed[key] = revived; |
2586 } | 2586 } |
2587 map[_original] = processed; | 2587 map[_original] = processed; |
2588 return map; | 2588 return map; |
2589 }; | 2589 }; |
2590 dart.fn(walk); | 2590 dart.fn(walk); |
2591 return dart.dcall(reviver, null, walk(json)); | 2591 return dart.dcall(reviver, null, walk(json)); |
2592 } | 2592 } |
2593 dart.fn(_convertJsonToDart, core.Object, [core.Object, dart.functionType(core.
Object, [dart.bottom, dart.bottom])]); | 2593 dart.fn(_convertJsonToDart, core.Object, [core.Object, dart.functionType(core.
Object, [dart.bottom, dart.bottom])]); |
(...skipping 30 matching lines...) Expand all Loading... |
2624 } else if (!(typeof key == 'string')) { | 2624 } else if (!(typeof key == 'string')) { |
2625 return null; | 2625 return null; |
2626 } else { | 2626 } else { |
2627 let result = _JsonMap._getProperty(this[_processed], dart.as(key, core.S
tring)); | 2627 let result = _JsonMap._getProperty(this[_processed], dart.as(key, core.S
tring)); |
2628 if (_JsonMap._isUnprocessed(result)) | 2628 if (_JsonMap._isUnprocessed(result)) |
2629 result = this[_process](dart.as(key, core.String)); | 2629 result = this[_process](dart.as(key, core.String)); |
2630 return result; | 2630 return result; |
2631 } | 2631 } |
2632 } | 2632 } |
2633 get length() { | 2633 get length() { |
2634 return this[_isUpgraded] ? this[_upgradedMap].length : this[_computeKeys](
)[core.$length]; | 2634 return this[_isUpgraded] ? this[_upgradedMap].length : this[_computeKeys](
).length; |
2635 } | 2635 } |
2636 get isEmpty() { | 2636 get isEmpty() { |
2637 return this.length == 0; | 2637 return this.length == 0; |
2638 } | 2638 } |
2639 get isNotEmpty() { | 2639 get isNotEmpty() { |
2640 return dart.notNull(this.length) > 0; | 2640 return dart.notNull(this.length) > 0; |
2641 } | 2641 } |
2642 get keys() { | 2642 get keys() { |
2643 if (this[_isUpgraded]) | 2643 if (this[_isUpgraded]) |
2644 return this[_upgradedMap].keys; | 2644 return this[_upgradedMap].keys; |
(...skipping 20 matching lines...) Expand all Loading... |
2665 } | 2665 } |
2666 addAll(other) { | 2666 addAll(other) { |
2667 other.forEach(dart.fn((key, value) => { | 2667 other.forEach(dart.fn((key, value) => { |
2668 this.set(key, value); | 2668 this.set(key, value); |
2669 })); | 2669 })); |
2670 } | 2670 } |
2671 containsValue(value) { | 2671 containsValue(value) { |
2672 if (this[_isUpgraded]) | 2672 if (this[_isUpgraded]) |
2673 return this[_upgradedMap].containsValue(value); | 2673 return this[_upgradedMap].containsValue(value); |
2674 let keys = this[_computeKeys](); | 2674 let keys = this[_computeKeys](); |
2675 for (let i = 0; dart.notNull(i) < dart.notNull(keys[core.$length]); i = da
rt.notNull(i) + 1) { | 2675 for (let i = 0; dart.notNull(i) < dart.notNull(keys.length); i = dart.notN
ull(i) + 1) { |
2676 let key = keys[core.$get](i); | 2676 let key = keys[dartx.get](i); |
2677 if (dart.equals(this.get(key), value)) | 2677 if (dart.equals(this.get(key), value)) |
2678 return true; | 2678 return true; |
2679 } | 2679 } |
2680 return false; | 2680 return false; |
2681 } | 2681 } |
2682 containsKey(key) { | 2682 containsKey(key) { |
2683 if (this[_isUpgraded]) | 2683 if (this[_isUpgraded]) |
2684 return this[_upgradedMap].containsKey(key); | 2684 return this[_upgradedMap].containsKey(key); |
2685 if (!(typeof key == 'string')) | 2685 if (!(typeof key == 'string')) |
2686 return false; | 2686 return false; |
(...skipping 19 matching lines...) Expand all Loading... |
2706 dart.dsend(this[_data], 'clear'); | 2706 dart.dsend(this[_data], 'clear'); |
2707 } | 2707 } |
2708 this[_original] = this[_processed] = null; | 2708 this[_original] = this[_processed] = null; |
2709 this[_data] = dart.map(); | 2709 this[_data] = dart.map(); |
2710 } | 2710 } |
2711 } | 2711 } |
2712 forEach(f) { | 2712 forEach(f) { |
2713 if (this[_isUpgraded]) | 2713 if (this[_isUpgraded]) |
2714 return this[_upgradedMap].forEach(f); | 2714 return this[_upgradedMap].forEach(f); |
2715 let keys = this[_computeKeys](); | 2715 let keys = this[_computeKeys](); |
2716 for (let i = 0; dart.notNull(i) < dart.notNull(keys[core.$length]); i = da
rt.notNull(i) + 1) { | 2716 for (let i = 0; dart.notNull(i) < dart.notNull(keys.length); i = dart.notN
ull(i) + 1) { |
2717 let key = keys[core.$get](i); | 2717 let key = keys[dartx.get](i); |
2718 let value = _JsonMap._getProperty(this[_processed], key); | 2718 let value = _JsonMap._getProperty(this[_processed], key); |
2719 if (_JsonMap._isUnprocessed(value)) { | 2719 if (_JsonMap._isUnprocessed(value)) { |
2720 value = _convertJsonToDartLazy(_JsonMap._getProperty(this[_original],
key)); | 2720 value = _convertJsonToDartLazy(_JsonMap._getProperty(this[_original],
key)); |
2721 _JsonMap._setProperty(this[_processed], key, value); | 2721 _JsonMap._setProperty(this[_processed], key, value); |
2722 } | 2722 } |
2723 dart.dcall(f, key, value); | 2723 dart.dcall(f, key, value); |
2724 if (!dart.notNull(core.identical(keys, this[_data]))) { | 2724 if (!dart.notNull(core.identical(keys, this[_data]))) { |
2725 throw new core.ConcurrentModificationError(this); | 2725 throw new core.ConcurrentModificationError(this); |
2726 } | 2726 } |
2727 } | 2727 } |
(...skipping 14 matching lines...) Expand all Loading... |
2742 if (keys == null) { | 2742 if (keys == null) { |
2743 keys = this[_data] = _JsonMap._getPropertyNames(this[_original]); | 2743 keys = this[_data] = _JsonMap._getPropertyNames(this[_original]); |
2744 } | 2744 } |
2745 return dart.as(keys, core.List$(core.String)); | 2745 return dart.as(keys, core.List$(core.String)); |
2746 } | 2746 } |
2747 [_upgrade]() { | 2747 [_upgrade]() { |
2748 if (this[_isUpgraded]) | 2748 if (this[_isUpgraded]) |
2749 return this[_upgradedMap]; | 2749 return this[_upgradedMap]; |
2750 let result = dart.map(); | 2750 let result = dart.map(); |
2751 let keys = this[_computeKeys](); | 2751 let keys = this[_computeKeys](); |
2752 for (let i = 0; dart.notNull(i) < dart.notNull(keys[core.$length]); i = da
rt.notNull(i) + 1) { | 2752 for (let i = 0; dart.notNull(i) < dart.notNull(keys.length); i = dart.notN
ull(i) + 1) { |
2753 let key = keys[core.$get](i); | 2753 let key = keys[dartx.get](i); |
2754 result.set(key, this.get(key)); | 2754 result.set(key, this.get(key)); |
2755 } | 2755 } |
2756 if (keys[core.$isEmpty]) { | 2756 if (keys[dartx.isEmpty]) { |
2757 keys[core.$add](null); | 2757 keys[dartx.add](null); |
2758 } else { | 2758 } else { |
2759 keys[core.$clear](); | 2759 keys[dartx.clear](); |
2760 } | 2760 } |
2761 this[_original] = this[_processed] = null; | 2761 this[_original] = this[_processed] = null; |
2762 this[_data] = result; | 2762 this[_data] = result; |
2763 dart.assert(this[_isUpgraded]); | 2763 dart.assert(this[_isUpgraded]); |
2764 return result; | 2764 return result; |
2765 } | 2765 } |
2766 [_process](key) { | 2766 [_process](key) { |
2767 if (!dart.notNull(_JsonMap._hasProperty(this[_original], key))) | 2767 if (!dart.notNull(_JsonMap._hasProperty(this[_original], key))) |
2768 return null; | 2768 return null; |
2769 let result = _convertJsonToDartLazy(_JsonMap._getProperty(this[_original],
key)); | 2769 let result = _convertJsonToDartLazy(_JsonMap._getProperty(this[_original],
key)); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2814 _newJavaScriptObject: [core.Object, []] | 2814 _newJavaScriptObject: [core.Object, []] |
2815 }), | 2815 }), |
2816 names: ['_hasProperty', '_getProperty', '_setProperty', '_getPropertyNames',
'_isUnprocessed', '_newJavaScriptObject'] | 2816 names: ['_hasProperty', '_getProperty', '_setProperty', '_getPropertyNames',
'_isUnprocessed', '_newJavaScriptObject'] |
2817 }); | 2817 }); |
2818 let _parent = Symbol('_parent'); | 2818 let _parent = Symbol('_parent'); |
2819 class _JsonMapKeyIterable extends _internal.ListIterable { | 2819 class _JsonMapKeyIterable extends _internal.ListIterable { |
2820 _JsonMapKeyIterable(parent) { | 2820 _JsonMapKeyIterable(parent) { |
2821 this[_parent] = parent; | 2821 this[_parent] = parent; |
2822 super.ListIterable(); | 2822 super.ListIterable(); |
2823 } | 2823 } |
2824 get [core.$length]() { | 2824 get length() { |
2825 return this[_parent].length; | 2825 return this[_parent].length; |
2826 } | 2826 } |
2827 [core.$elementAt](index) { | 2827 elementAt(index) { |
2828 return this[_parent][_isUpgraded] ? dart.as(this[_parent].keys[core.$eleme
ntAt](index), core.String) : this[_parent][_computeKeys]()[core.$get](index); | 2828 return this[_parent][_isUpgraded] ? dart.as(this[_parent].keys[dartx.eleme
ntAt](index), core.String) : this[_parent][_computeKeys]()[dartx.get](index); |
2829 } | 2829 } |
2830 get [core.$iterator]() { | 2830 get iterator() { |
2831 return this[_parent][_isUpgraded] ? this[_parent].keys[core.$iterator] : t
his[_parent][_computeKeys]()[core.$iterator]; | 2831 return this[_parent][_isUpgraded] ? this[_parent].keys[dartx.iterator] : t
his[_parent][_computeKeys]()[dartx.iterator]; |
2832 } | 2832 } |
2833 [core.$contains](key) { | 2833 contains(key) { |
2834 return this[_parent].containsKey(key); | 2834 return this[_parent].containsKey(key); |
2835 } | 2835 } |
2836 } | 2836 } |
2837 dart.setSignature(_JsonMapKeyIterable, { | 2837 dart.setSignature(_JsonMapKeyIterable, { |
2838 constructors: () => ({_JsonMapKeyIterable: [_JsonMapKeyIterable, [_JsonMap]]
}), | 2838 constructors: () => ({_JsonMapKeyIterable: [_JsonMapKeyIterable, [_JsonMap]]
}), |
2839 methods: () => ({[core.$elementAt]: [core.String, [core.int]]}) | 2839 methods: () => ({elementAt: [core.String, [core.int]]}) |
2840 }); | 2840 }); |
2841 class _JsonDecoderSink extends _StringSinkConversionSink { | 2841 class _JsonDecoderSink extends _StringSinkConversionSink { |
2842 _JsonDecoderSink(reviver, sink) { | 2842 _JsonDecoderSink(reviver, sink) { |
2843 this[_reviver] = reviver; | 2843 this[_reviver] = reviver; |
2844 this[_sink] = sink; | 2844 this[_sink] = sink; |
2845 super._StringSinkConversionSink(new core.StringBuffer()); | 2845 super._StringSinkConversionSink(new core.StringBuffer()); |
2846 } | 2846 } |
2847 close() { | 2847 close() { |
2848 super.close(); | 2848 super.close(); |
2849 let buffer = dart.as(this[_stringSink], core.StringBuffer); | 2849 let buffer = dart.as(this[_stringSink], core.StringBuffer); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2890 exports.LineSplitter = LineSplitter; | 2890 exports.LineSplitter = LineSplitter; |
2891 exports.StringConversionSink = StringConversionSink; | 2891 exports.StringConversionSink = StringConversionSink; |
2892 exports.ClosableStringSink = ClosableStringSink; | 2892 exports.ClosableStringSink = ClosableStringSink; |
2893 exports.UNICODE_REPLACEMENT_CHARACTER_RUNE = UNICODE_REPLACEMENT_CHARACTER_RUN
E; | 2893 exports.UNICODE_REPLACEMENT_CHARACTER_RUNE = UNICODE_REPLACEMENT_CHARACTER_RUN
E; |
2894 exports.UNICODE_BOM_CHARACTER_RUNE = UNICODE_BOM_CHARACTER_RUNE; | 2894 exports.UNICODE_BOM_CHARACTER_RUNE = UNICODE_BOM_CHARACTER_RUNE; |
2895 exports.Utf8Codec = Utf8Codec; | 2895 exports.Utf8Codec = Utf8Codec; |
2896 exports.UTF8 = UTF8; | 2896 exports.UTF8 = UTF8; |
2897 exports.Utf8Encoder = Utf8Encoder; | 2897 exports.Utf8Encoder = Utf8Encoder; |
2898 exports.Utf8Decoder = Utf8Decoder; | 2898 exports.Utf8Decoder = Utf8Decoder; |
2899 })(convert, core, async, typed_data, _internal, collection); | 2899 })(convert, core, async, typed_data, _internal, collection); |
OLD | NEW |