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

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
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) => dart .dinvoke(buffer, '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) => (dart.dinvoke(buffer, 'write', string), buffer)).then((buffer) => da rt.dinvoke(buffer, 'toString')), async.Future$(core.String));
34 } 34 }
35 static getByName(name) { 35 static getByName(name) {
36 if (name == null) 36 if (name == null)
37 return null; 37 return null;
38 name = name.toLowerCase(); 38 name = name.toLowerCase();
39 return Encoding[_nameToEncoding].get(name); 39 return Encoding[_nameToEncoding].get(name);
40 } 40 }
41 } 41 }
42 dart.defineLazyProperties(Encoding, { 42 dart.defineLazyProperties(Encoding, {
43 get _nameToEncoding() { 43 get _nameToEncoding() {
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 add(chunk) { 346 add(chunk) {
347 let freeCount = dart.notNull(this[_buffer][core.$length]) - dart.notNull(t his[_bufferIndex]); 347 let freeCount = dart.notNull(this[_buffer][core.$length]) - dart.notNull(t his[_bufferIndex]);
348 if (dart.notNull(chunk[core.$length]) > dart.notNull(freeCount)) { 348 if (dart.notNull(chunk[core.$length]) > dart.notNull(freeCount)) {
349 let oldLength = this[_buffer][core.$length]; 349 let oldLength = this[_buffer][core.$length];
350 let newLength = dart.notNull(_ByteCallbackSink[_roundToPowerOf2](dart.no tNull(chunk[core.$length]) + dart.notNull(oldLength))) * 2; 350 let newLength = dart.notNull(_ByteCallbackSink[_roundToPowerOf2](dart.no tNull(chunk[core.$length]) + dart.notNull(oldLength))) * 2;
351 let grown = new typed_data.Uint8List(newLength); 351 let grown = new typed_data.Uint8List(newLength);
352 grown[core.$setRange](0, this[_buffer][core.$length], this[_buffer]); 352 grown[core.$setRange](0, this[_buffer][core.$length], this[_buffer]);
353 this[_buffer] = grown; 353 this[_buffer] = grown;
354 } 354 }
355 this[_buffer][core.$setRange](this[_bufferIndex], dart.notNull(this[_buffe rIndex]) + dart.notNull(chunk[core.$length]), chunk); 355 this[_buffer][core.$setRange](this[_bufferIndex], dart.notNull(this[_buffe rIndex]) + dart.notNull(chunk[core.$length]), chunk);
356 this[_bufferIndex] = chunk[core.$length]; 356 this[_bufferIndex] = dart.notNull(this[_bufferIndex]) + dart.notNull(chunk [core.$length]);
357 } 357 }
358 static [_roundToPowerOf2](v) { 358 static [_roundToPowerOf2](v) {
359 dart.assert(dart.notNull(v) > 0); 359 dart.assert(dart.notNull(v) > 0);
360 v = dart.notNull(v) - 1; 360 v = dart.notNull(v) - 1;
361 v = dart.notNull(v) >> 1; 361 v = dart.notNull(v) | dart.notNull(v) >> 1;
362 v = dart.notNull(v) >> 2; 362 v = dart.notNull(v) | dart.notNull(v) >> 2;
363 v = dart.notNull(v) >> 4; 363 v = dart.notNull(v) | dart.notNull(v) >> 4;
364 v = dart.notNull(v) >> 8; 364 v = dart.notNull(v) | dart.notNull(v) >> 8;
365 v = dart.notNull(v) >> 16; 365 v = dart.notNull(v) | dart.notNull(v) >> 16;
366 v = dart.notNull(v) + 1; 366 v = dart.notNull(v) + 1;
367 return v; 367 return v;
368 } 368 }
369 close() { 369 close() {
370 this[_callback](this[_buffer][core.$sublist](0, this[_bufferIndex])); 370 this[_callback](this[_buffer][core.$sublist](0, this[_bufferIndex]));
371 } 371 }
372 } 372 }
373 _ByteCallbackSink._INITIAL_BUFFER_SIZE = 1024; 373 _ByteCallbackSink._INITIAL_BUFFER_SIZE = 1024;
374 let _ChunkedConversionCallback$ = dart.generic(function(T) { 374 let _ChunkedConversionCallback$ = dart.generic(function(T) {
375 class _ChunkedConversionCallback extends core.Function {} 375 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); 748 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); 749 chunk = new typed_data.Uint8List.view(chunk.buffer, dart.notNull(chunk .offsetInBytes) + dart.notNull(start), length);
750 } 750 }
751 bytes[core.$add](chunk); 751 bytes[core.$add](chunk);
752 } 752 }
753 _JsonUtf8Stringifier.stringify(object, this[_indent], dart.as(this[_toEnco dable$], dart.throw_("Unimplemented type (Object) → dynamic")), this[_bufferSize ], addChunk); 753 _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) 754 if (bytes[core.$length] == 1)
755 return bytes[core.$get](0); 755 return bytes[core.$get](0);
756 let length = 0; 756 let length = 0;
757 for (let i = 0; dart.notNull(i) < dart.notNull(bytes[core.$length]); i = d art.notNull(i) + 1) { 757 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]; 758 length = dart.notNull(length) + dart.notNull(bytes[core.$get](i)[core.$l ength]);
759 } 759 }
760 let result = new typed_data.Uint8List(length); 760 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) { 761 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); 762 let byteList = bytes[core.$get](i);
763 let end = dart.notNull(offset) + dart.notNull(byteList[core.$length]); 763 let end = dart.notNull(offset) + dart.notNull(byteList[core.$length]);
764 result[core.$setRange](offset, end, byteList); 764 result[core.$setRange](offset, end, byteList);
765 offset = end; 765 offset = end;
766 } 766 }
767 return result; 767 return result;
768 } 768 }
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
1219 this.writeByte(128 | dart.notNull(charCode) >> 6 & 63); 1219 this.writeByte(128 | dart.notNull(charCode) >> 6 & 63);
1220 this.writeByte(128 | dart.notNull(charCode) & 63); 1220 this.writeByte(128 | dart.notNull(charCode) & 63);
1221 } 1221 }
1222 writeByte(byte) { 1222 writeByte(byte) {
1223 dart.assert(dart.notNull(byte) <= 255); 1223 dart.assert(dart.notNull(byte) <= 255);
1224 if (this.index == this.buffer[core.$length]) { 1224 if (this.index == this.buffer[core.$length]) {
1225 dart.dinvokef(this.addChunk, this.buffer, 0, this.index); 1225 dart.dinvokef(this.addChunk, this.buffer, 0, this.index);
1226 this.buffer = new typed_data.Uint8List(this.bufferSize); 1226 this.buffer = new typed_data.Uint8List(this.bufferSize);
1227 this.index = 0; 1227 this.index = 0;
1228 } 1228 }
1229 this.buffer[core.$set](((x$) => this.index = dart.notNull(x$) + 1, x$).bin d(this)(this.index), byte); 1229 this.buffer[core.$set](((x$) => (x$ = this.index, this.index = dart.notNul l(x$) + 1, x$)).bind(this)(), byte);
1230 } 1230 }
1231 } 1231 }
1232 class _JsonUtf8StringifierPretty extends dart.mixin(_JsonUtf8Stringifier, _Jso nPrettyPrintMixin) { 1232 class _JsonUtf8StringifierPretty extends dart.mixin(_JsonUtf8Stringifier, _Jso nPrettyPrintMixin) {
1233 _JsonUtf8StringifierPretty(toEncodableFunction, indent, bufferSize, addChunk ) { 1233 _JsonUtf8StringifierPretty(toEncodableFunction, indent, bufferSize, addChunk ) {
1234 this.indent = indent; 1234 this.indent = indent;
1235 super._JsonUtf8Stringifier(toEncodableFunction, dart.as(bufferSize, core.i nt), dart.as(addChunk, core.Function)); 1235 super._JsonUtf8Stringifier(toEncodableFunction, dart.as(bufferSize, core.i nt), dart.as(addChunk, core.Function));
1236 } 1236 }
1237 writeIndentation(count) { 1237 writeIndentation(count) {
1238 let indent = this.indent; 1238 let indent = this.indent;
1239 let indentLength = indent[core.$length]; 1239 let indentLength = indent[core.$length];
1240 if (indentLength == 1) { 1240 if (indentLength == 1) {
1241 let char = indent[core.$get](0); 1241 let char = indent[core.$get](0);
1242 while (dart.notNull(count) > 0) { 1242 while (dart.notNull(count) > 0) {
1243 this.writeByte(char); 1243 this.writeByte(char);
1244 count = 1; 1244 count = dart.notNull(count) - 1;
1245 } 1245 }
1246 return; 1246 return;
1247 } 1247 }
1248 while (dart.notNull(count) > 0) { 1248 while (dart.notNull(count) > 0) {
1249 count = dart.notNull(count) - 1; 1249 count = dart.notNull(count) - 1;
1250 let end = dart.notNull(this.index) + dart.notNull(indentLength); 1250 let end = dart.notNull(this.index) + dart.notNull(indentLength);
1251 if (dart.notNull(end) <= dart.notNull(this.buffer[core.$length])) { 1251 if (dart.notNull(end) <= dart.notNull(this.buffer[core.$length])) {
1252 this.buffer[core.$setRange](this.index, end, indent); 1252 this.buffer[core.$setRange](this.index, end, indent);
1253 this.index = end; 1253 this.index = end;
1254 } else { 1254 } else {
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
1748 this[_bufferIndex] = 0; 1748 this[_bufferIndex] = 0;
1749 } 1749 }
1750 static [_createBuffer](size) { 1750 static [_createBuffer](size) {
1751 return new typed_data.Uint8List(size); 1751 return new typed_data.Uint8List(size);
1752 } 1752 }
1753 [_writeSurrogate](leadingSurrogate, nextCodeUnit) { 1753 [_writeSurrogate](leadingSurrogate, nextCodeUnit) {
1754 if (_isTailSurrogate(nextCodeUnit)) { 1754 if (_isTailSurrogate(nextCodeUnit)) {
1755 let rune = _combineSurrogatePair(leadingSurrogate, nextCodeUnit); 1755 let rune = _combineSurrogatePair(leadingSurrogate, nextCodeUnit);
1756 dart.assert(dart.notNull(rune) > dart.notNull(_THREE_BYTE_LIMIT)); 1756 dart.assert(dart.notNull(rune) > dart.notNull(_THREE_BYTE_LIMIT));
1757 dart.assert(dart.notNull(rune) <= dart.notNull(_FOUR_BYTE_LIMIT)); 1757 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); 1758 this[_buffer][core.$set](((x$) => (x$ = this[_bufferIndex], this[_buffer Index] = dart.notNull(x$) + 1, x$)).bind(this)(), 240 | dart.notNull(rune) >> 18 );
1759 this[_buffer][core.$set](((x$) => this[_bufferIndex] = dart.notNull(x$) + 1, x$).bind(this)(this[_bufferIndex]), 128 | dart.notNull(rune) >> 12 & 63); 1759 this[_buffer][core.$set](((x$) => (x$ = this[_bufferIndex], this[_buffer Index] = dart.notNull(x$) + 1, x$)).bind(this)(), 128 | dart.notNull(rune) >> 12 & 63);
1760 this[_buffer][core.$set](((x$) => this[_bufferIndex] = dart.notNull(x$) + 1, x$).bind(this)(this[_bufferIndex]), 128 | dart.notNull(rune) >> 6 & 63); 1760 this[_buffer][core.$set](((x$) => (x$ = this[_bufferIndex], this[_buffer Index] = dart.notNull(x$) + 1, x$)).bind(this)(), 128 | dart.notNull(rune) >> 6 & 63);
1761 this[_buffer][core.$set](((x$) => this[_bufferIndex] = dart.notNull(x$) + 1, x$).bind(this)(this[_bufferIndex]), 128 | dart.notNull(rune) & 63); 1761 this[_buffer][core.$set](((x$) => (x$ = this[_bufferIndex], this[_buffer Index] = dart.notNull(x$) + 1, x$)).bind(this)(), 128 | dart.notNull(rune) & 63) ;
1762 return true; 1762 return true;
1763 } else { 1763 } else {
1764 this[_buffer][core.$set](((x$) => this[_bufferIndex] = dart.notNull(x$) + 1, x$).bind(this)(this[_bufferIndex]), 224 | dart.notNull(leadingSurrogate) >> 12); 1764 this[_buffer][core.$set](((x$) => (x$ = this[_bufferIndex], this[_buffer Index] = dart.notNull(x$) + 1, x$)).bind(this)(), 224 | dart.notNull(leadingSurr ogate) >> 12);
1765 this[_buffer][core.$set](((x$) => this[_bufferIndex] = dart.notNull(x$) + 1, x$).bind(this)(this[_bufferIndex]), 128 | dart.notNull(leadingSurrogate) >> 6 & 63); 1765 this[_buffer][core.$set](((x$) => (x$ = this[_bufferIndex], this[_buffer Index] = dart.notNull(x$) + 1, x$)).bind(this)(), 128 | dart.notNull(leadingSurr ogate) >> 6 & 63);
1766 this[_buffer][core.$set](((x$) => this[_bufferIndex] = dart.notNull(x$) + 1, x$).bind(this)(this[_bufferIndex]), 128 | dart.notNull(leadingSurrogate) & 63); 1766 this[_buffer][core.$set](((x$) => (x$ = this[_bufferIndex], this[_buffer Index] = dart.notNull(x$) + 1, x$)).bind(this)(), 128 | dart.notNull(leadingSurr ogate) & 63);
1767 return false; 1767 return false;
1768 } 1768 }
1769 } 1769 }
1770 [_fillBuffer](str, start, end) { 1770 [_fillBuffer](str, start, end) {
1771 if (start != end && dart.notNull(_isLeadSurrogate(str.codeUnitAt(dart.notN ull(end) - 1)))) { 1771 if (start != end && dart.notNull(_isLeadSurrogate(str.codeUnitAt(dart.notN ull(end) - 1)))) {
1772 end = dart.notNull(end) - 1; 1772 end = dart.notNull(end) - 1;
1773 } 1773 }
1774 let stringIndex = null; 1774 let stringIndex = null;
1775 for (stringIndex = start; dart.notNull(stringIndex) < dart.notNull(end); s tringIndex = dart.notNull(stringIndex) + 1) { 1775 for (stringIndex = start; dart.notNull(stringIndex) < dart.notNull(end); s tringIndex = dart.notNull(stringIndex) + 1) {
1776 let codeUnit = str.codeUnitAt(stringIndex); 1776 let codeUnit = str.codeUnitAt(stringIndex);
1777 if (dart.notNull(codeUnit) <= dart.notNull(_ONE_BYTE_LIMIT)) { 1777 if (dart.notNull(codeUnit) <= dart.notNull(_ONE_BYTE_LIMIT)) {
1778 if (dart.notNull(this[_bufferIndex]) >= dart.notNull(this[_buffer][cor e.$length])) 1778 if (dart.notNull(this[_bufferIndex]) >= dart.notNull(this[_buffer][cor e.$length]))
1779 break; 1779 break;
1780 this[_buffer][core.$set](((x$) => this[_bufferIndex] = dart.notNull(x$ ) + 1, x$).bind(this)(this[_bufferIndex]), codeUnit); 1780 this[_buffer][core.$set](((x$) => (x$ = this[_bufferIndex], this[_buff erIndex] = dart.notNull(x$) + 1, x$)).bind(this)(), codeUnit);
1781 } else if (_isLeadSurrogate(codeUnit)) { 1781 } else if (_isLeadSurrogate(codeUnit)) {
1782 if (dart.notNull(this[_bufferIndex]) + 3 >= dart.notNull(this[_buffer] [core.$length])) 1782 if (dart.notNull(this[_bufferIndex]) + 3 >= dart.notNull(this[_buffer] [core.$length]))
1783 break; 1783 break;
1784 let nextCodeUnit = str.codeUnitAt(dart.notNull(stringIndex) + 1); 1784 let nextCodeUnit = str.codeUnitAt(dart.notNull(stringIndex) + 1);
1785 let wasCombined = this[_writeSurrogate](codeUnit, nextCodeUnit); 1785 let wasCombined = this[_writeSurrogate](codeUnit, nextCodeUnit);
1786 if (wasCombined) 1786 if (wasCombined) {
1787 stringIndex = dart.notNull(stringIndex) + 1; 1787 stringIndex = dart.notNull(stringIndex) + 1;
1788 }
1788 } else { 1789 } else {
1789 let rune = codeUnit; 1790 let rune = codeUnit;
1790 if (dart.notNull(rune) <= dart.notNull(_TWO_BYTE_LIMIT)) { 1791 if (dart.notNull(rune) <= dart.notNull(_TWO_BYTE_LIMIT)) {
1791 if (dart.notNull(this[_bufferIndex]) + 1 >= dart.notNull(this[_buffe r][core.$length])) 1792 if (dart.notNull(this[_bufferIndex]) + 1 >= dart.notNull(this[_buffe r][core.$length]))
1792 break; 1793 break;
1793 this[_buffer][core.$set](((x$) => this[_bufferIndex] = dart.notNull( x$) + 1, x$).bind(this)(this[_bufferIndex]), 192 | dart.notNull(rune) >> 6); 1794 this[_buffer][core.$set](((x$) => (x$ = this[_bufferIndex], this[_bu fferIndex] = dart.notNull(x$) + 1, x$)).bind(this)(), 192 | dart.notNull(rune) > > 6);
1794 this[_buffer][core.$set](((x$) => this[_bufferIndex] = dart.notNull( x$) + 1, x$).bind(this)(this[_bufferIndex]), 128 | dart.notNull(rune) & 63); 1795 this[_buffer][core.$set](((x$) => (x$ = this[_bufferIndex], this[_bu fferIndex] = dart.notNull(x$) + 1, x$)).bind(this)(), 128 | dart.notNull(rune) & 63);
1795 } else { 1796 } else {
1796 dart.assert(dart.notNull(rune) <= dart.notNull(_THREE_BYTE_LIMIT)); 1797 dart.assert(dart.notNull(rune) <= dart.notNull(_THREE_BYTE_LIMIT));
1797 if (dart.notNull(this[_bufferIndex]) + 2 >= dart.notNull(this[_buffe r][core.$length])) 1798 if (dart.notNull(this[_bufferIndex]) + 2 >= dart.notNull(this[_buffe r][core.$length]))
1798 break; 1799 break;
1799 this[_buffer][core.$set](((x$) => this[_bufferIndex] = dart.notNull( x$) + 1, x$).bind(this)(this[_bufferIndex]), 224 | dart.notNull(rune) >> 12); 1800 this[_buffer][core.$set](((x$) => (x$ = this[_bufferIndex], this[_bu fferIndex] = dart.notNull(x$) + 1, x$)).bind(this)(), 224 | dart.notNull(rune) > > 12);
1800 this[_buffer][core.$set](((x$) => this[_bufferIndex] = dart.notNull( x$) + 1, x$).bind(this)(this[_bufferIndex]), 128 | dart.notNull(rune) >> 6 & 63) ; 1801 this[_buffer][core.$set](((x$) => (x$ = this[_bufferIndex], this[_bu fferIndex] = dart.notNull(x$) + 1, x$)).bind(this)(), 128 | dart.notNull(rune) > > 6 & 63);
1801 this[_buffer][core.$set](((x$) => this[_bufferIndex] = dart.notNull( x$) + 1, x$).bind(this)(this[_bufferIndex]), 128 | dart.notNull(rune) & 63); 1802 this[_buffer][core.$set](((x$) => (x$ = this[_bufferIndex], this[_bu fferIndex] = dart.notNull(x$) + 1, x$)).bind(this)(), 128 | dart.notNull(rune) & 63);
1802 } 1803 }
1803 } 1804 }
1804 } 1805 }
1805 return stringIndex; 1806 return stringIndex;
1806 } 1807 }
1807 } 1808 }
1808 dart.defineNamedConstructor(_Utf8Encoder, 'withBufferSize'); 1809 dart.defineNamedConstructor(_Utf8Encoder, 'withBufferSize');
1809 _Utf8Encoder._DEFAULT_BYTE_BUFFER_SIZE = 1024; 1810 _Utf8Encoder._DEFAULT_BYTE_BUFFER_SIZE = 1024;
1810 class _Utf8EncoderSink extends dart.mixin(_Utf8Encoder, StringConversionSinkMi xin) { 1811 class _Utf8EncoderSink extends dart.mixin(_Utf8Encoder, StringConversionSinkMi xin) {
1811 _Utf8EncoderSink(sink$) { 1812 _Utf8EncoderSink(sink$) {
(...skipping 14 matching lines...) Expand all
1826 } 1827 }
1827 if (this[_carry] != 0) { 1828 if (this[_carry] != 0) {
1828 let nextCodeUnit = 0; 1829 let nextCodeUnit = 0;
1829 if (start != end) { 1830 if (start != end) {
1830 nextCodeUnit = str.codeUnitAt(start); 1831 nextCodeUnit = str.codeUnitAt(start);
1831 } else { 1832 } else {
1832 dart.assert(isLast); 1833 dart.assert(isLast);
1833 } 1834 }
1834 let wasCombined = this[_writeSurrogate](this[_carry], nextCodeUnit); 1835 let wasCombined = this[_writeSurrogate](this[_carry], nextCodeUnit);
1835 dart.assert(!dart.notNull(wasCombined) || start != end); 1836 dart.assert(!dart.notNull(wasCombined) || start != end);
1836 if (wasCombined) 1837 if (wasCombined) {
1837 start = dart.notNull(start) + 1; 1838 start = dart.notNull(start) + 1;
1839 }
1838 this[_carry] = 0; 1840 this[_carry] = 0;
1839 } 1841 }
1840 do { 1842 do {
1841 start = this[_fillBuffer](str, start, end); 1843 start = this[_fillBuffer](str, start, end);
1842 let isLastSlice = dart.notNull(isLast) && start == end; 1844 let isLastSlice = dart.notNull(isLast) && start == end;
1843 if (start == dart.notNull(end) - 1 && dart.notNull(_isLeadSurrogate(str. codeUnitAt(start)))) { 1845 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) { 1846 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 ); 1847 let hasBeenCombined = this[_writeSurrogate](str.codeUnitAt(start), 0 );
1846 dart.assert(!dart.notNull(hasBeenCombined)); 1848 dart.assert(!dart.notNull(hasBeenCombined));
1847 } else { 1849 } else {
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
2013 if (!dart.notNull(this[_isFirstCharacter]) || value != UNICODE_BOM _CHARACTER_RUNE) { 2015 if (!dart.notNull(this[_isFirstCharacter]) || value != UNICODE_BOM _CHARACTER_RUNE) {
2014 this[_stringSink].writeCharCode(value); 2016 this[_stringSink].writeCharCode(value);
2015 } 2017 }
2016 this[_isFirstCharacter] = false; 2018 this[_isFirstCharacter] = false;
2017 } 2019 }
2018 while (dart.notNull(i) < dart.notNull(endIndex)) { 2020 while (dart.notNull(i) < dart.notNull(endIndex)) {
2019 let oneBytes = scanOneByteCharacters(codeUnits, i); 2021 let oneBytes = scanOneByteCharacters(codeUnits, i);
2020 if (dart.notNull(oneBytes) > 0) { 2022 if (dart.notNull(oneBytes) > 0) {
2021 this[_isFirstCharacter] = false; 2023 this[_isFirstCharacter] = false;
2022 addSingleBytes(i, dart.notNull(i) + dart.notNull(oneBytes)); 2024 addSingleBytes(i, dart.notNull(i) + dart.notNull(oneBytes));
2023 i = oneBytes; 2025 i = dart.notNull(i) + dart.notNull(oneBytes);
2024 if (i == endIndex) 2026 if (i == endIndex)
2025 break; 2027 break;
2026 } 2028 }
2027 let unit = codeUnits[core.$get](((x$) => i = dart.notNull(x$) + 1, x $)(i)); 2029 let unit = codeUnits[core.$get](((x$) => (x$ = i, i = dart.notNull(x $) + 1, x$))());
2028 if (dart.notNull(unit) < 0) { 2030 if (dart.notNull(unit) < 0) {
2029 if (!dart.notNull(this[_allowMalformed])) { 2031 if (!dart.notNull(this[_allowMalformed])) {
2030 throw new core.FormatException(`Negative UTF-8 code unit: -0x${( -dart.notNull(unit)).toRadixString(16)}`); 2032 throw new core.FormatException(`Negative UTF-8 code unit: -0x${( -dart.notNull(unit)).toRadixString(16)}`);
2031 } 2033 }
2032 this[_stringSink].writeCharCode(UNICODE_REPLACEMENT_CHARACTER_RUNE ); 2034 this[_stringSink].writeCharCode(UNICODE_REPLACEMENT_CHARACTER_RUNE );
2033 } else { 2035 } else {
2034 dart.assert(dart.notNull(unit) > dart.notNull(_ONE_BYTE_LIMIT)); 2036 dart.assert(dart.notNull(unit) > dart.notNull(_ONE_BYTE_LIMIT));
2035 if ((dart.notNull(unit) & 224) == 192) { 2037 if ((dart.notNull(unit) & 224) == 192) {
2036 value = dart.notNull(unit) & 31; 2038 value = dart.notNull(unit) & 31;
2037 expectedUnits = extraUnits = 1; 2039 expectedUnits = extraUnits = 1;
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
2369 exports.LineSplitter = LineSplitter; 2371 exports.LineSplitter = LineSplitter;
2370 exports.StringConversionSink = StringConversionSink; 2372 exports.StringConversionSink = StringConversionSink;
2371 exports.ClosableStringSink = ClosableStringSink; 2373 exports.ClosableStringSink = ClosableStringSink;
2372 exports.UNICODE_REPLACEMENT_CHARACTER_RUNE = UNICODE_REPLACEMENT_CHARACTER_RUN E; 2374 exports.UNICODE_REPLACEMENT_CHARACTER_RUNE = UNICODE_REPLACEMENT_CHARACTER_RUN E;
2373 exports.UNICODE_BOM_CHARACTER_RUNE = UNICODE_BOM_CHARACTER_RUNE; 2375 exports.UNICODE_BOM_CHARACTER_RUNE = UNICODE_BOM_CHARACTER_RUNE;
2374 exports.UTF8 = UTF8; 2376 exports.UTF8 = UTF8;
2375 exports.Utf8Codec = Utf8Codec; 2377 exports.Utf8Codec = Utf8Codec;
2376 exports.Utf8Encoder = Utf8Encoder; 2378 exports.Utf8Encoder = Utf8Encoder;
2377 exports.Utf8Decoder = Utf8Decoder; 2379 exports.Utf8Decoder = Utf8Decoder;
2378 })(convert || (convert = {})); 2380 })(convert || (convert = {}));
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698