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

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

Issue 1069493002: implement opassign, fix bugs in pre/postfix, introduce a let* helper (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/runtime/dart/collection.js ('k') | lib/runtime/dart/core.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 var convert; 1 var convert;
2 (function(exports) { 2 (function(exports) {
3 'use strict'; 3 'use strict';
4 let ASCII = new AsciiCodec(); 4 let ASCII = new AsciiCodec();
5 let _ASCII_MASK = 127; 5 let _ASCII_MASK = 127;
6 let _allowInvalid = Symbol('_allowInvalid'); 6 let _allowInvalid = Symbol('_allowInvalid');
7 let _nameToEncoding = Symbol('_nameToEncoding'); 7 let _nameToEncoding = Symbol('_nameToEncoding');
8 let Codec$ = dart.generic(function(S, T) { 8 let Codec$ = dart.generic(function(S, T) {
9 class Codec extends core.Object { 9 class Codec extends core.Object {
10 Codec() { 10 Codec() {
(...skipping 12 matching lines...) Expand all
23 } 23 }
24 } 24 }
25 return Codec; 25 return Codec;
26 }); 26 });
27 let Codec = Codec$(); 27 let Codec = Codec$();
28 class Encoding extends Codec$(core.String, core.List$(core.int)) { 28 class Encoding extends Codec$(core.String, core.List$(core.int)) {
29 Encoding() { 29 Encoding() {
30 super.Codec(); 30 super.Codec();
31 } 31 }
32 decodeStream(byteStream) { 32 decodeStream(byteStream) {
33 return dart.as(byteStream.transform(dart.as(this.decoder, async.StreamTran sformer$(core.List$(core.int), dynamic))).fold(new core.StringBuffer(), (buffer, string) => dart.dinvoke(buffer, 'write', string), buffer).then((buffer) => buff er.toString()), async.Future$(core.String)); 33 return dart.as(byteStream.transform(dart.as(this.decoder, async.StreamTran sformer$(core.List$(core.int), dynamic))).fold(new core.StringBuffer(), (buffer, string) => ((() => {
34 dart.dinvoke(buffer, 'write', string);
35 return buffer;
36 })())).then(buffer => buffer.toString()), async.Future$(core.String));
34 } 37 }
35 static getByName(name) { 38 static getByName(name) {
36 if (name == null) 39 if (name == null)
37 return null; 40 return null;
38 name = name.toLowerCase(); 41 name = name.toLowerCase();
39 return Encoding[_nameToEncoding].get(name); 42 return Encoding[_nameToEncoding].get(name);
40 } 43 }
41 } 44 }
42 dart.defineLazyProperties(Encoding, { 45 dart.defineLazyProperties(Encoding, {
43 get _nameToEncoding() { 46 get _nameToEncoding() {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 class Converter extends core.Object { 79 class Converter extends core.Object {
77 Converter() { 80 Converter() {
78 } 81 }
79 fuse(other) { 82 fuse(other) {
80 return new (_FusedConverter$(S, T, dynamic))(this, other); 83 return new (_FusedConverter$(S, T, dynamic))(this, other);
81 } 84 }
82 startChunkedConversion(sink) { 85 startChunkedConversion(sink) {
83 throw new core.UnsupportedError(`This converter does not support chunked conversions: ${this}`); 86 throw new core.UnsupportedError(`This converter does not support chunked conversions: ${this}`);
84 } 87 }
85 bind(source) { 88 bind(source) {
86 return new async.Stream.eventTransformed(source, ((sink) => new _Convert erStreamEventSink(this, sink)).bind(this)); 89 return new async.Stream.eventTransformed(source, (sink => new _Converter StreamEventSink(this, sink)).bind(this));
87 } 90 }
88 } 91 }
89 Converter[dart.implements] = () => [async.StreamTransformer]; 92 Converter[dart.implements] = () => [async.StreamTransformer];
90 return Converter; 93 return Converter;
91 }); 94 });
92 let Converter = Converter$(); 95 let Converter = Converter$();
93 class _UnicodeSubsetEncoder extends Converter$(core.String, core.List$(core.in t)) { 96 class _UnicodeSubsetEncoder extends Converter$(core.String, core.List$(core.in t)) {
94 _UnicodeSubsetEncoder(subsetMask) { 97 _UnicodeSubsetEncoder(subsetMask) {
95 this[_subsetMask] = subsetMask; 98 this[_subsetMask] = subsetMask;
96 super.Converter(); 99 super.Converter();
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 add(chunk) { 349 add(chunk) {
347 let freeCount = dart.notNull(this[_buffer][core.$length]) - dart.notNull(t his[_bufferIndex]); 350 let freeCount = dart.notNull(this[_buffer][core.$length]) - dart.notNull(t his[_bufferIndex]);
348 if (dart.notNull(chunk[core.$length]) > dart.notNull(freeCount)) { 351 if (dart.notNull(chunk[core.$length]) > dart.notNull(freeCount)) {
349 let oldLength = this[_buffer][core.$length]; 352 let oldLength = this[_buffer][core.$length];
350 let newLength = dart.notNull(_ByteCallbackSink[_roundToPowerOf2](dart.no tNull(chunk[core.$length]) + dart.notNull(oldLength))) * 2; 353 let newLength = dart.notNull(_ByteCallbackSink[_roundToPowerOf2](dart.no tNull(chunk[core.$length]) + dart.notNull(oldLength))) * 2;
351 let grown = new typed_data.Uint8List(newLength); 354 let grown = new typed_data.Uint8List(newLength);
352 grown[core.$setRange](0, this[_buffer][core.$length], this[_buffer]); 355 grown[core.$setRange](0, this[_buffer][core.$length], this[_buffer]);
353 this[_buffer] = grown; 356 this[_buffer] = grown;
354 } 357 }
355 this[_buffer][core.$setRange](this[_bufferIndex], dart.notNull(this[_buffe rIndex]) + dart.notNull(chunk[core.$length]), chunk); 358 this[_buffer][core.$setRange](this[_bufferIndex], dart.notNull(this[_buffe rIndex]) + dart.notNull(chunk[core.$length]), chunk);
356 this[_bufferIndex] = chunk[core.$length]; 359 this[_bufferIndex] = dart.notNull(this[_bufferIndex]) + dart.notNull(chunk [core.$length]);
357 } 360 }
358 static [_roundToPowerOf2](v) { 361 static [_roundToPowerOf2](v) {
359 dart.assert(dart.notNull(v) > 0); 362 dart.assert(dart.notNull(v) > 0);
360 v = dart.notNull(v) - 1; 363 v = dart.notNull(v) - 1;
361 v = dart.notNull(v) >> 1; 364 v = dart.notNull(v) | dart.notNull(v) >> 1;
362 v = dart.notNull(v) >> 2; 365 v = dart.notNull(v) | dart.notNull(v) >> 2;
363 v = dart.notNull(v) >> 4; 366 v = dart.notNull(v) | dart.notNull(v) >> 4;
364 v = dart.notNull(v) >> 8; 367 v = dart.notNull(v) | dart.notNull(v) >> 8;
365 v = dart.notNull(v) >> 16; 368 v = dart.notNull(v) | dart.notNull(v) >> 16;
366 v = dart.notNull(v) + 1; 369 v = dart.notNull(v) + 1;
367 return v; 370 return v;
368 } 371 }
369 close() { 372 close() {
370 this[_callback](this[_buffer][core.$sublist](0, this[_bufferIndex])); 373 this[_callback](this[_buffer][core.$sublist](0, this[_bufferIndex]));
371 } 374 }
372 } 375 }
373 _ByteCallbackSink._INITIAL_BUFFER_SIZE = 1024; 376 _ByteCallbackSink._INITIAL_BUFFER_SIZE = 1024;
374 let _ChunkedConversionCallback$ = dart.generic(function(T) { 377 let _ChunkedConversionCallback$ = dart.generic(function(T) {
375 class _ChunkedConversionCallback extends core.Function {} 378 class _ChunkedConversionCallback extends core.Function {}
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 let length = dart.notNull(end) - dart.notNull(start); 751 let length = dart.notNull(end) - dart.notNull(start);
749 chunk = new typed_data.Uint8List.view(chunk.buffer, dart.notNull(chunk .offsetInBytes) + dart.notNull(start), length); 752 chunk = new typed_data.Uint8List.view(chunk.buffer, dart.notNull(chunk .offsetInBytes) + dart.notNull(start), length);
750 } 753 }
751 bytes[core.$add](chunk); 754 bytes[core.$add](chunk);
752 } 755 }
753 _JsonUtf8Stringifier.stringify(object, this[_indent], dart.as(this[_toEnco dable$], dart.throw_("Unimplemented type (Object) → dynamic")), this[_bufferSize ], addChunk); 756 _JsonUtf8Stringifier.stringify(object, this[_indent], dart.as(this[_toEnco dable$], dart.throw_("Unimplemented type (Object) → dynamic")), this[_bufferSize ], addChunk);
754 if (bytes[core.$length] == 1) 757 if (bytes[core.$length] == 1)
755 return bytes[core.$get](0); 758 return bytes[core.$get](0);
756 let length = 0; 759 let length = 0;
757 for (let i = 0; dart.notNull(i) < dart.notNull(bytes[core.$length]); i = d art.notNull(i) + 1) { 760 for (let i = 0; dart.notNull(i) < dart.notNull(bytes[core.$length]); i = d art.notNull(i) + 1) {
758 length = bytes[core.$get](i)[core.$length]; 761 length = dart.notNull(length) + dart.notNull(bytes[core.$get](i)[core.$l ength]);
759 } 762 }
760 let result = new typed_data.Uint8List(length); 763 let result = new typed_data.Uint8List(length);
761 for (let i = 0, offset = 0; dart.notNull(i) < dart.notNull(bytes[core.$len gth]); i = dart.notNull(i) + 1) { 764 for (let i = 0, offset = 0; dart.notNull(i) < dart.notNull(bytes[core.$len gth]); i = dart.notNull(i) + 1) {
762 let byteList = bytes[core.$get](i); 765 let byteList = bytes[core.$get](i);
763 let end = dart.notNull(offset) + dart.notNull(byteList[core.$length]); 766 let end = dart.notNull(offset) + dart.notNull(byteList[core.$length]);
764 result[core.$setRange](offset, end, byteList); 767 result[core.$setRange](offset, end, byteList);
765 offset = end; 768 offset = end;
766 } 769 }
767 return result; 770 return result;
768 } 771 }
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
1219 this.writeByte(128 | dart.notNull(charCode) >> 6 & 63); 1222 this.writeByte(128 | dart.notNull(charCode) >> 6 & 63);
1220 this.writeByte(128 | dart.notNull(charCode) & 63); 1223 this.writeByte(128 | dart.notNull(charCode) & 63);
1221 } 1224 }
1222 writeByte(byte) { 1225 writeByte(byte) {
1223 dart.assert(dart.notNull(byte) <= 255); 1226 dart.assert(dart.notNull(byte) <= 255);
1224 if (this.index == this.buffer[core.$length]) { 1227 if (this.index == this.buffer[core.$length]) {
1225 dart.dinvokef(this.addChunk, this.buffer, 0, this.index); 1228 dart.dinvokef(this.addChunk, this.buffer, 0, this.index);
1226 this.buffer = new typed_data.Uint8List(this.bufferSize); 1229 this.buffer = new typed_data.Uint8List(this.bufferSize);
1227 this.index = 0; 1230 this.index = 0;
1228 } 1231 }
1229 this.buffer[core.$set](((x$) => this.index = dart.notNull(x$) + 1, x$).bin d(this)(this.index), byte); 1232 this.buffer[core.$set]((() => {
1233 let x$ = this.index;
1234 this.index = dart.notNull(x$) + 1;
1235 return x$;
1236 }).bind(this)(), byte);
1230 } 1237 }
1231 } 1238 }
1232 class _JsonUtf8StringifierPretty extends dart.mixin(_JsonUtf8Stringifier, _Jso nPrettyPrintMixin) { 1239 class _JsonUtf8StringifierPretty extends dart.mixin(_JsonUtf8Stringifier, _Jso nPrettyPrintMixin) {
1233 _JsonUtf8StringifierPretty(toEncodableFunction, indent, bufferSize, addChunk ) { 1240 _JsonUtf8StringifierPretty(toEncodableFunction, indent, bufferSize, addChunk ) {
1234 this.indent = indent; 1241 this.indent = indent;
1235 super._JsonUtf8Stringifier(toEncodableFunction, dart.as(bufferSize, core.i nt), dart.as(addChunk, core.Function)); 1242 super._JsonUtf8Stringifier(toEncodableFunction, dart.as(bufferSize, core.i nt), dart.as(addChunk, core.Function));
1236 } 1243 }
1237 writeIndentation(count) { 1244 writeIndentation(count) {
1238 let indent = this.indent; 1245 let indent = this.indent;
1239 let indentLength = indent[core.$length]; 1246 let indentLength = indent[core.$length];
1240 if (indentLength == 1) { 1247 if (indentLength == 1) {
1241 let char = indent[core.$get](0); 1248 let char = indent[core.$get](0);
1242 while (dart.notNull(count) > 0) { 1249 while (dart.notNull(count) > 0) {
1243 this.writeByte(char); 1250 this.writeByte(char);
1244 count = 1; 1251 count = dart.notNull(count) - 1;
1245 } 1252 }
1246 return; 1253 return;
1247 } 1254 }
1248 while (dart.notNull(count) > 0) { 1255 while (dart.notNull(count) > 0) {
1249 count = dart.notNull(count) - 1; 1256 count = dart.notNull(count) - 1;
1250 let end = dart.notNull(this.index) + dart.notNull(indentLength); 1257 let end = dart.notNull(this.index) + dart.notNull(indentLength);
1251 if (dart.notNull(end) <= dart.notNull(this.buffer[core.$length])) { 1258 if (dart.notNull(end) <= dart.notNull(this.buffer[core.$length])) {
1252 this.buffer[core.$setRange](this.index, end, indent); 1259 this.buffer[core.$setRange](this.index, end, indent);
1253 this.index = end; 1260 this.index = end;
1254 } else { 1261 } else {
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
1748 this[_bufferIndex] = 0; 1755 this[_bufferIndex] = 0;
1749 } 1756 }
1750 static [_createBuffer](size) { 1757 static [_createBuffer](size) {
1751 return new typed_data.Uint8List(size); 1758 return new typed_data.Uint8List(size);
1752 } 1759 }
1753 [_writeSurrogate](leadingSurrogate, nextCodeUnit) { 1760 [_writeSurrogate](leadingSurrogate, nextCodeUnit) {
1754 if (_isTailSurrogate(nextCodeUnit)) { 1761 if (_isTailSurrogate(nextCodeUnit)) {
1755 let rune = _combineSurrogatePair(leadingSurrogate, nextCodeUnit); 1762 let rune = _combineSurrogatePair(leadingSurrogate, nextCodeUnit);
1756 dart.assert(dart.notNull(rune) > dart.notNull(_THREE_BYTE_LIMIT)); 1763 dart.assert(dart.notNull(rune) > dart.notNull(_THREE_BYTE_LIMIT));
1757 dart.assert(dart.notNull(rune) <= dart.notNull(_FOUR_BYTE_LIMIT)); 1764 dart.assert(dart.notNull(rune) <= dart.notNull(_FOUR_BYTE_LIMIT));
1758 this[_buffer][core.$set](((x$) => this[_bufferIndex] = dart.notNull(x$) + 1, x$).bind(this)(this[_bufferIndex]), 240 | dart.notNull(rune) >> 18); 1765 this[_buffer][core.$set]((() => {
1759 this[_buffer][core.$set](((x$) => this[_bufferIndex] = dart.notNull(x$) + 1, x$).bind(this)(this[_bufferIndex]), 128 | dart.notNull(rune) >> 12 & 63); 1766 let x$ = this[_bufferIndex];
1760 this[_buffer][core.$set](((x$) => this[_bufferIndex] = dart.notNull(x$) + 1, x$).bind(this)(this[_bufferIndex]), 128 | dart.notNull(rune) >> 6 & 63); 1767 this[_bufferIndex] = dart.notNull(x$) + 1;
1761 this[_buffer][core.$set](((x$) => this[_bufferIndex] = dart.notNull(x$) + 1, x$).bind(this)(this[_bufferIndex]), 128 | dart.notNull(rune) & 63); 1768 return x$;
1769 }).bind(this)(), 240 | dart.notNull(rune) >> 18);
1770 this[_buffer][core.$set]((() => {
1771 let x$ = this[_bufferIndex];
1772 this[_bufferIndex] = dart.notNull(x$) + 1;
1773 return x$;
1774 }).bind(this)(), 128 | dart.notNull(rune) >> 12 & 63);
1775 this[_buffer][core.$set]((() => {
1776 let x$ = this[_bufferIndex];
1777 this[_bufferIndex] = dart.notNull(x$) + 1;
1778 return x$;
1779 }).bind(this)(), 128 | dart.notNull(rune) >> 6 & 63);
1780 this[_buffer][core.$set]((() => {
1781 let x$ = this[_bufferIndex];
1782 this[_bufferIndex] = dart.notNull(x$) + 1;
1783 return x$;
1784 }).bind(this)(), 128 | dart.notNull(rune) & 63);
1762 return true; 1785 return true;
1763 } else { 1786 } else {
1764 this[_buffer][core.$set](((x$) => this[_bufferIndex] = dart.notNull(x$) + 1, x$).bind(this)(this[_bufferIndex]), 224 | dart.notNull(leadingSurrogate) >> 12); 1787 this[_buffer][core.$set]((() => {
1765 this[_buffer][core.$set](((x$) => this[_bufferIndex] = dart.notNull(x$) + 1, x$).bind(this)(this[_bufferIndex]), 128 | dart.notNull(leadingSurrogate) >> 6 & 63); 1788 let x$ = this[_bufferIndex];
1766 this[_buffer][core.$set](((x$) => this[_bufferIndex] = dart.notNull(x$) + 1, x$).bind(this)(this[_bufferIndex]), 128 | dart.notNull(leadingSurrogate) & 63); 1789 this[_bufferIndex] = dart.notNull(x$) + 1;
1790 return x$;
1791 }).bind(this)(), 224 | dart.notNull(leadingSurrogate) >> 12);
1792 this[_buffer][core.$set]((() => {
1793 let x$ = this[_bufferIndex];
1794 this[_bufferIndex] = dart.notNull(x$) + 1;
1795 return x$;
1796 }).bind(this)(), 128 | dart.notNull(leadingSurrogate) >> 6 & 63);
1797 this[_buffer][core.$set]((() => {
1798 let x$ = this[_bufferIndex];
1799 this[_bufferIndex] = dart.notNull(x$) + 1;
1800 return x$;
1801 }).bind(this)(), 128 | dart.notNull(leadingSurrogate) & 63);
1767 return false; 1802 return false;
1768 } 1803 }
1769 } 1804 }
1770 [_fillBuffer](str, start, end) { 1805 [_fillBuffer](str, start, end) {
1771 if (start != end && dart.notNull(_isLeadSurrogate(str.codeUnitAt(dart.notN ull(end) - 1)))) { 1806 if (start != end && dart.notNull(_isLeadSurrogate(str.codeUnitAt(dart.notN ull(end) - 1)))) {
1772 end = dart.notNull(end) - 1; 1807 end = dart.notNull(end) - 1;
1773 } 1808 }
1774 let stringIndex = null; 1809 let stringIndex = null;
1775 for (stringIndex = start; dart.notNull(stringIndex) < dart.notNull(end); s tringIndex = dart.notNull(stringIndex) + 1) { 1810 for (stringIndex = start; dart.notNull(stringIndex) < dart.notNull(end); s tringIndex = dart.notNull(stringIndex) + 1) {
1776 let codeUnit = str.codeUnitAt(stringIndex); 1811 let codeUnit = str.codeUnitAt(stringIndex);
1777 if (dart.notNull(codeUnit) <= dart.notNull(_ONE_BYTE_LIMIT)) { 1812 if (dart.notNull(codeUnit) <= dart.notNull(_ONE_BYTE_LIMIT)) {
1778 if (dart.notNull(this[_bufferIndex]) >= dart.notNull(this[_buffer][cor e.$length])) 1813 if (dart.notNull(this[_bufferIndex]) >= dart.notNull(this[_buffer][cor e.$length]))
1779 break; 1814 break;
1780 this[_buffer][core.$set](((x$) => this[_bufferIndex] = dart.notNull(x$ ) + 1, x$).bind(this)(this[_bufferIndex]), codeUnit); 1815 this[_buffer][core.$set]((() => {
1816 let x$ = this[_bufferIndex];
1817 this[_bufferIndex] = dart.notNull(x$) + 1;
1818 return x$;
1819 }).bind(this)(), codeUnit);
1781 } else if (_isLeadSurrogate(codeUnit)) { 1820 } else if (_isLeadSurrogate(codeUnit)) {
1782 if (dart.notNull(this[_bufferIndex]) + 3 >= dart.notNull(this[_buffer] [core.$length])) 1821 if (dart.notNull(this[_bufferIndex]) + 3 >= dart.notNull(this[_buffer] [core.$length]))
1783 break; 1822 break;
1784 let nextCodeUnit = str.codeUnitAt(dart.notNull(stringIndex) + 1); 1823 let nextCodeUnit = str.codeUnitAt(dart.notNull(stringIndex) + 1);
1785 let wasCombined = this[_writeSurrogate](codeUnit, nextCodeUnit); 1824 let wasCombined = this[_writeSurrogate](codeUnit, nextCodeUnit);
1786 if (wasCombined) 1825 if (wasCombined) {
1787 stringIndex = dart.notNull(stringIndex) + 1; 1826 stringIndex = dart.notNull(stringIndex) + 1;
1827 }
1788 } else { 1828 } else {
1789 let rune = codeUnit; 1829 let rune = codeUnit;
1790 if (dart.notNull(rune) <= dart.notNull(_TWO_BYTE_LIMIT)) { 1830 if (dart.notNull(rune) <= dart.notNull(_TWO_BYTE_LIMIT)) {
1791 if (dart.notNull(this[_bufferIndex]) + 1 >= dart.notNull(this[_buffe r][core.$length])) 1831 if (dart.notNull(this[_bufferIndex]) + 1 >= dart.notNull(this[_buffe r][core.$length]))
1792 break; 1832 break;
1793 this[_buffer][core.$set](((x$) => this[_bufferIndex] = dart.notNull( x$) + 1, x$).bind(this)(this[_bufferIndex]), 192 | dart.notNull(rune) >> 6); 1833 this[_buffer][core.$set]((() => {
1794 this[_buffer][core.$set](((x$) => this[_bufferIndex] = dart.notNull( x$) + 1, x$).bind(this)(this[_bufferIndex]), 128 | dart.notNull(rune) & 63); 1834 let x$ = this[_bufferIndex];
1835 this[_bufferIndex] = dart.notNull(x$) + 1;
1836 return x$;
1837 }).bind(this)(), 192 | dart.notNull(rune) >> 6);
1838 this[_buffer][core.$set]((() => {
1839 let x$ = this[_bufferIndex];
1840 this[_bufferIndex] = dart.notNull(x$) + 1;
1841 return x$;
1842 }).bind(this)(), 128 | dart.notNull(rune) & 63);
1795 } else { 1843 } else {
1796 dart.assert(dart.notNull(rune) <= dart.notNull(_THREE_BYTE_LIMIT)); 1844 dart.assert(dart.notNull(rune) <= dart.notNull(_THREE_BYTE_LIMIT));
1797 if (dart.notNull(this[_bufferIndex]) + 2 >= dart.notNull(this[_buffe r][core.$length])) 1845 if (dart.notNull(this[_bufferIndex]) + 2 >= dart.notNull(this[_buffe r][core.$length]))
1798 break; 1846 break;
1799 this[_buffer][core.$set](((x$) => this[_bufferIndex] = dart.notNull( x$) + 1, x$).bind(this)(this[_bufferIndex]), 224 | dart.notNull(rune) >> 12); 1847 this[_buffer][core.$set]((() => {
1800 this[_buffer][core.$set](((x$) => this[_bufferIndex] = dart.notNull( x$) + 1, x$).bind(this)(this[_bufferIndex]), 128 | dart.notNull(rune) >> 6 & 63) ; 1848 let x$ = this[_bufferIndex];
1801 this[_buffer][core.$set](((x$) => this[_bufferIndex] = dart.notNull( x$) + 1, x$).bind(this)(this[_bufferIndex]), 128 | dart.notNull(rune) & 63); 1849 this[_bufferIndex] = dart.notNull(x$) + 1;
1850 return x$;
1851 }).bind(this)(), 224 | dart.notNull(rune) >> 12);
1852 this[_buffer][core.$set]((() => {
1853 let x$ = this[_bufferIndex];
1854 this[_bufferIndex] = dart.notNull(x$) + 1;
1855 return x$;
1856 }).bind(this)(), 128 | dart.notNull(rune) >> 6 & 63);
1857 this[_buffer][core.$set]((() => {
1858 let x$ = this[_bufferIndex];
1859 this[_bufferIndex] = dart.notNull(x$) + 1;
1860 return x$;
1861 }).bind(this)(), 128 | dart.notNull(rune) & 63);
1802 } 1862 }
1803 } 1863 }
1804 } 1864 }
1805 return stringIndex; 1865 return stringIndex;
1806 } 1866 }
1807 } 1867 }
1808 dart.defineNamedConstructor(_Utf8Encoder, 'withBufferSize'); 1868 dart.defineNamedConstructor(_Utf8Encoder, 'withBufferSize');
1809 _Utf8Encoder._DEFAULT_BYTE_BUFFER_SIZE = 1024; 1869 _Utf8Encoder._DEFAULT_BYTE_BUFFER_SIZE = 1024;
1810 class _Utf8EncoderSink extends dart.mixin(_Utf8Encoder, StringConversionSinkMi xin) { 1870 class _Utf8EncoderSink extends dart.mixin(_Utf8Encoder, StringConversionSinkMi xin) {
1811 _Utf8EncoderSink(sink$) { 1871 _Utf8EncoderSink(sink$) {
(...skipping 14 matching lines...) Expand all
1826 } 1886 }
1827 if (this[_carry] != 0) { 1887 if (this[_carry] != 0) {
1828 let nextCodeUnit = 0; 1888 let nextCodeUnit = 0;
1829 if (start != end) { 1889 if (start != end) {
1830 nextCodeUnit = str.codeUnitAt(start); 1890 nextCodeUnit = str.codeUnitAt(start);
1831 } else { 1891 } else {
1832 dart.assert(isLast); 1892 dart.assert(isLast);
1833 } 1893 }
1834 let wasCombined = this[_writeSurrogate](this[_carry], nextCodeUnit); 1894 let wasCombined = this[_writeSurrogate](this[_carry], nextCodeUnit);
1835 dart.assert(!dart.notNull(wasCombined) || start != end); 1895 dart.assert(!dart.notNull(wasCombined) || start != end);
1836 if (wasCombined) 1896 if (wasCombined) {
1837 start = dart.notNull(start) + 1; 1897 start = dart.notNull(start) + 1;
1898 }
1838 this[_carry] = 0; 1899 this[_carry] = 0;
1839 } 1900 }
1840 do { 1901 do {
1841 start = this[_fillBuffer](str, start, end); 1902 start = this[_fillBuffer](str, start, end);
1842 let isLastSlice = dart.notNull(isLast) && start == end; 1903 let isLastSlice = dart.notNull(isLast) && start == end;
1843 if (start == dart.notNull(end) - 1 && dart.notNull(_isLeadSurrogate(str. codeUnitAt(start)))) { 1904 if (start == dart.notNull(end) - 1 && dart.notNull(_isLeadSurrogate(str. codeUnitAt(start)))) {
1844 if (dart.notNull(isLast) && dart.notNull(this[_bufferIndex]) < dart.no tNull(this[_buffer][core.$length]) - 3) { 1905 if (dart.notNull(isLast) && dart.notNull(this[_bufferIndex]) < dart.no tNull(this[_buffer][core.$length]) - 3) {
1845 let hasBeenCombined = this[_writeSurrogate](str.codeUnitAt(start), 0 ); 1906 let hasBeenCombined = this[_writeSurrogate](str.codeUnitAt(start), 0 );
1846 dart.assert(!dart.notNull(hasBeenCombined)); 1907 dart.assert(!dart.notNull(hasBeenCombined));
1847 } else { 1908 } else {
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
2013 if (!dart.notNull(this[_isFirstCharacter]) || value != UNICODE_BOM _CHARACTER_RUNE) { 2074 if (!dart.notNull(this[_isFirstCharacter]) || value != UNICODE_BOM _CHARACTER_RUNE) {
2014 this[_stringSink].writeCharCode(value); 2075 this[_stringSink].writeCharCode(value);
2015 } 2076 }
2016 this[_isFirstCharacter] = false; 2077 this[_isFirstCharacter] = false;
2017 } 2078 }
2018 while (dart.notNull(i) < dart.notNull(endIndex)) { 2079 while (dart.notNull(i) < dart.notNull(endIndex)) {
2019 let oneBytes = scanOneByteCharacters(codeUnits, i); 2080 let oneBytes = scanOneByteCharacters(codeUnits, i);
2020 if (dart.notNull(oneBytes) > 0) { 2081 if (dart.notNull(oneBytes) > 0) {
2021 this[_isFirstCharacter] = false; 2082 this[_isFirstCharacter] = false;
2022 addSingleBytes(i, dart.notNull(i) + dart.notNull(oneBytes)); 2083 addSingleBytes(i, dart.notNull(i) + dart.notNull(oneBytes));
2023 i = oneBytes; 2084 i = dart.notNull(i) + dart.notNull(oneBytes);
2024 if (i == endIndex) 2085 if (i == endIndex)
2025 break; 2086 break;
2026 } 2087 }
2027 let unit = codeUnits[core.$get](((x$) => i = dart.notNull(x$) + 1, x $)(i)); 2088 let unit = codeUnits[core.$get]((() => {
2089 let x$ = i;
2090 i = dart.notNull(x$) + 1;
2091 return x$;
2092 })());
2028 if (dart.notNull(unit) < 0) { 2093 if (dart.notNull(unit) < 0) {
2029 if (!dart.notNull(this[_allowMalformed])) { 2094 if (!dart.notNull(this[_allowMalformed])) {
2030 throw new core.FormatException(`Negative UTF-8 code unit: -0x${( -dart.notNull(unit)).toRadixString(16)}`); 2095 throw new core.FormatException(`Negative UTF-8 code unit: -0x${( -dart.notNull(unit)).toRadixString(16)}`);
2031 } 2096 }
2032 this[_stringSink].writeCharCode(UNICODE_REPLACEMENT_CHARACTER_RUNE ); 2097 this[_stringSink].writeCharCode(UNICODE_REPLACEMENT_CHARACTER_RUNE );
2033 } else { 2098 } else {
2034 dart.assert(dart.notNull(unit) > dart.notNull(_ONE_BYTE_LIMIT)); 2099 dart.assert(dart.notNull(unit) > dart.notNull(_ONE_BYTE_LIMIT));
2035 if ((dart.notNull(unit) & 224) == 192) { 2100 if ((dart.notNull(unit) & 224) == 192) {
2036 value = dart.notNull(unit) & 31; 2101 value = dart.notNull(unit) & 31;
2037 expectedUnits = extraUnits = 1; 2102 expectedUnits = extraUnits = 1;
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
2152 return dart.notNull(this.length) > 0; 2217 return dart.notNull(this.length) > 0;
2153 } 2218 }
2154 get keys() { 2219 get keys() {
2155 if (this[_isUpgraded]) 2220 if (this[_isUpgraded])
2156 return this[_upgradedMap].keys; 2221 return this[_upgradedMap].keys;
2157 return new _JsonMapKeyIterable(this); 2222 return new _JsonMapKeyIterable(this);
2158 } 2223 }
2159 get values() { 2224 get values() {
2160 if (this[_isUpgraded]) 2225 if (this[_isUpgraded])
2161 return this[_upgradedMap].values; 2226 return this[_upgradedMap].values;
2162 return new _internal.MappedIterable(this[_computeKeys](), ((each) => this. get(each)).bind(this)); 2227 return new _internal.MappedIterable(this[_computeKeys](), (each => this.ge t(each)).bind(this));
2163 } 2228 }
2164 set(key, value) { 2229 set(key, value) {
2165 if (this[_isUpgraded]) { 2230 if (this[_isUpgraded]) {
2166 this[_upgradedMap].set(key, value); 2231 this[_upgradedMap].set(key, value);
2167 } else if (this.containsKey(key)) { 2232 } else if (this.containsKey(key)) {
2168 let processed = this[_processed]; 2233 let processed = this[_processed];
2169 _JsonMap[_setProperty](processed, dart.as(key, core.String), value); 2234 _JsonMap[_setProperty](processed, dart.as(key, core.String), value);
2170 let original = this[_original]; 2235 let original = this[_original];
2171 if (!dart.notNull(core.identical(original, processed))) { 2236 if (!dart.notNull(core.identical(original, processed))) {
2172 _JsonMap[_setProperty](original, dart.as(key, core.String), null); 2237 _JsonMap[_setProperty](original, dart.as(key, core.String), null);
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
2369 exports.LineSplitter = LineSplitter; 2434 exports.LineSplitter = LineSplitter;
2370 exports.StringConversionSink = StringConversionSink; 2435 exports.StringConversionSink = StringConversionSink;
2371 exports.ClosableStringSink = ClosableStringSink; 2436 exports.ClosableStringSink = ClosableStringSink;
2372 exports.UNICODE_REPLACEMENT_CHARACTER_RUNE = UNICODE_REPLACEMENT_CHARACTER_RUN E; 2437 exports.UNICODE_REPLACEMENT_CHARACTER_RUNE = UNICODE_REPLACEMENT_CHARACTER_RUN E;
2373 exports.UNICODE_BOM_CHARACTER_RUNE = UNICODE_BOM_CHARACTER_RUNE; 2438 exports.UNICODE_BOM_CHARACTER_RUNE = UNICODE_BOM_CHARACTER_RUNE;
2374 exports.UTF8 = UTF8; 2439 exports.UTF8 = UTF8;
2375 exports.Utf8Codec = Utf8Codec; 2440 exports.Utf8Codec = Utf8Codec;
2376 exports.Utf8Encoder = Utf8Encoder; 2441 exports.Utf8Encoder = Utf8Encoder;
2377 exports.Utf8Decoder = Utf8Decoder; 2442 exports.Utf8Decoder = Utf8Decoder;
2378 })(convert || (convert = {})); 2443 })(convert || (convert = {}));
OLDNEW
« no previous file with comments | « lib/runtime/dart/collection.js ('k') | lib/runtime/dart/core.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698