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

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

Issue 1042943003: fixes private named constructors (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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 } else { 225 } else {
226 return new _SimpleAsciiDecoderSink(stringSink); 226 return new _SimpleAsciiDecoderSink(stringSink);
227 } 227 }
228 } 228 }
229 } 229 }
230 let _utf8Sink = Symbol('_utf8Sink'); 230 let _utf8Sink = Symbol('_utf8Sink');
231 let ChunkedConversionSink$ = dart.generic(function(T) { 231 let ChunkedConversionSink$ = dart.generic(function(T) {
232 class ChunkedConversionSink extends core.Object { 232 class ChunkedConversionSink extends core.Object {
233 ChunkedConversionSink() { 233 ChunkedConversionSink() {
234 } 234 }
235 ChunkedConversionSink$withCallback(callback) { 235 withCallback(callback) {
236 return new _SimpleCallbackSink(callback); 236 return new _SimpleCallbackSink(callback);
237 } 237 }
238 } 238 }
239 dart.defineNamedConstructor(ChunkedConversionSink, 'withCallback'); 239 dart.defineNamedConstructor(ChunkedConversionSink, 'withCallback');
240 return ChunkedConversionSink; 240 return ChunkedConversionSink;
241 }); 241 });
242 let ChunkedConversionSink = ChunkedConversionSink$(dart.dynamic); 242 let ChunkedConversionSink = ChunkedConversionSink$(dart.dynamic);
243 class ByteConversionSink extends ChunkedConversionSink$(core.List$(core.int)) { 243 class ByteConversionSink extends ChunkedConversionSink$(core.List$(core.int)) {
244 ByteConversionSink() { 244 ByteConversionSink() {
245 super.ChunkedConversionSink(); 245 super.ChunkedConversionSink();
246 } 246 }
247 ByteConversionSink$withCallback(callback) { 247 withCallback(callback) {
248 return new _ByteCallbackSink(callback); 248 return new _ByteCallbackSink(callback);
249 } 249 }
250 ByteConversionSink$from(sink) { 250 from(sink) {
251 return new _ByteAdapterSink(sink); 251 return new _ByteAdapterSink(sink);
252 } 252 }
253 } 253 }
254 dart.defineNamedConstructor(ByteConversionSink, 'withCallback'); 254 dart.defineNamedConstructor(ByteConversionSink, 'withCallback');
255 dart.defineNamedConstructor(ByteConversionSink, 'from'); 255 dart.defineNamedConstructor(ByteConversionSink, 'from');
256 class ByteConversionSinkBase extends ByteConversionSink { 256 class ByteConversionSinkBase extends ByteConversionSink {
257 addSlice(chunk, start, end, isLast) { 257 addSlice(chunk, start, end, isLast) {
258 this.add(chunk.sublist(start, end)); 258 this.add(chunk.sublist(start, end));
259 if (isLast) 259 if (isLast)
260 this.close(); 260 this.close();
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 return dart.as(this[_second].convert(this[_first].convert(input)), T); 475 return dart.as(this[_second].convert(this[_first].convert(input)), T);
476 } 476 }
477 startChunkedConversion(sink) { 477 startChunkedConversion(sink) {
478 return this[_first].startChunkedConversion(this[_second].startChunkedCon version(sink)); 478 return this[_first].startChunkedConversion(this[_second].startChunkedCon version(sink));
479 } 479 }
480 } 480 }
481 return _FusedConverter; 481 return _FusedConverter;
482 }); 482 });
483 let _FusedConverter = _FusedConverter$(dart.dynamic, dart.dynamic, dart.dynami c); 483 let _FusedConverter = _FusedConverter$(dart.dynamic, dart.dynamic, dart.dynami c);
484 let HTML_ESCAPE = new HtmlEscape(); 484 let HTML_ESCAPE = new HtmlEscape();
485 let _$ = Symbol('_');
485 let _name = Symbol('_name'); 486 let _name = Symbol('_name');
486 let _$ = Symbol('_');
487 class HtmlEscapeMode extends core.Object { 487 class HtmlEscapeMode extends core.Object {
488 HtmlEscapeMode$_(name$, escapeLtGt, escapeQuot, escapeApos, escapeSlash) { 488 [_$](name$, escapeLtGt, escapeQuot, escapeApos, escapeSlash) {
489 this[_name] = name$; 489 this[_name] = name$;
490 this.escapeLtGt = escapeLtGt; 490 this.escapeLtGt = escapeLtGt;
491 this.escapeQuot = escapeQuot; 491 this.escapeQuot = escapeQuot;
492 this.escapeApos = escapeApos; 492 this.escapeApos = escapeApos;
493 this.escapeSlash = escapeSlash; 493 this.escapeSlash = escapeSlash;
494 } 494 }
495 toString() { 495 toString() {
496 return this[_name]; 496 return this[_name];
497 } 497 }
498 } 498 }
499 dart.defineNamedConstructor(HtmlEscapeMode, _$); 499 dart.defineNamedConstructor(HtmlEscapeMode, _$);
500 HtmlEscapeMode.UNKNOWN = new HtmlEscapeMode._('unknown', true, true, true, tru e); 500 HtmlEscapeMode.UNKNOWN = new HtmlEscapeMode[_$]('unknown', true, true, true, t rue);
501 HtmlEscapeMode.ATTRIBUTE = new HtmlEscapeMode._('attribute', false, true, fals e, false); 501 HtmlEscapeMode.ATTRIBUTE = new HtmlEscapeMode[_$]('attribute', false, true, fa lse, false);
502 HtmlEscapeMode.ELEMENT = new HtmlEscapeMode._('element', true, false, false, t rue); 502 HtmlEscapeMode.ELEMENT = new HtmlEscapeMode[_$]('element', true, false, false, true);
503 let _convert = Symbol('_convert'); 503 let _convert = Symbol('_convert');
504 class HtmlEscape extends Converter$(core.String, core.String) { 504 class HtmlEscape extends Converter$(core.String, core.String) {
505 HtmlEscape(mode) { 505 HtmlEscape(mode) {
506 if (mode === void 0) 506 if (mode === void 0)
507 mode = HtmlEscapeMode.UNKNOWN; 507 mode = HtmlEscapeMode.UNKNOWN;
508 this.mode = mode; 508 this.mode = mode;
509 super.Converter(); 509 super.Converter();
510 } 510 }
511 convert(text) { 511 convert(text) {
512 let val = this[_convert](text, 0, text.length); 512 let val = this[_convert](text, 0, text.length);
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 let _reviver = Symbol('_reviver'); 624 let _reviver = Symbol('_reviver');
625 let _toEncodable$ = Symbol('_toEncodable'); 625 let _toEncodable$ = Symbol('_toEncodable');
626 class JsonCodec extends Codec$(core.Object, core.String) { 626 class JsonCodec extends Codec$(core.Object, core.String) {
627 JsonCodec(opts) { 627 JsonCodec(opts) {
628 let reviver = opts && 'reviver' in opts ? opts.reviver : null; 628 let reviver = opts && 'reviver' in opts ? opts.reviver : null;
629 let toEncodable = opts && 'toEncodable' in opts ? opts.toEncodable : null; 629 let toEncodable = opts && 'toEncodable' in opts ? opts.toEncodable : null;
630 this[_reviver] = reviver; 630 this[_reviver] = reviver;
631 this[_toEncodable$] = toEncodable; 631 this[_toEncodable$] = toEncodable;
632 super.Codec(); 632 super.Codec();
633 } 633 }
634 JsonCodec$withReviver(reviver) { 634 withReviver(reviver) {
635 this.JsonCodec({reviver: reviver}); 635 this.JsonCodec({reviver: reviver});
636 } 636 }
637 decode(source, opts) { 637 decode(source, opts) {
638 let reviver = opts && 'reviver' in opts ? opts.reviver : null; 638 let reviver = opts && 'reviver' in opts ? opts.reviver : null;
639 if (reviver === null) 639 if (reviver === null)
640 reviver = this[_reviver]; 640 reviver = this[_reviver];
641 if (reviver === null) 641 if (reviver === null)
642 return this.decoder.convert(source); 642 return this.decoder.convert(source);
643 return new JsonDecoder(reviver).convert(source); 643 return new JsonDecoder(reviver).convert(source);
644 } 644 }
(...skipping 18 matching lines...) Expand all
663 } 663 }
664 dart.defineNamedConstructor(JsonCodec, 'withReviver'); 664 dart.defineNamedConstructor(JsonCodec, 'withReviver');
665 class JsonEncoder extends Converter$(core.Object, core.String) { 665 class JsonEncoder extends Converter$(core.Object, core.String) {
666 JsonEncoder(toEncodable) { 666 JsonEncoder(toEncodable) {
667 if (toEncodable === void 0) 667 if (toEncodable === void 0)
668 toEncodable = null; 668 toEncodable = null;
669 this.indent = null; 669 this.indent = null;
670 this[_toEncodable$] = toEncodable; 670 this[_toEncodable$] = toEncodable;
671 super.Converter(); 671 super.Converter();
672 } 672 }
673 JsonEncoder$withIndent(indent, toEncodable) { 673 withIndent(indent, toEncodable) {
674 if (toEncodable === void 0) 674 if (toEncodable === void 0)
675 toEncodable = null; 675 toEncodable = null;
676 this.indent = indent; 676 this.indent = indent;
677 this[_toEncodable$] = toEncodable; 677 this[_toEncodable$] = toEncodable;
678 super.Converter(); 678 super.Converter();
679 } 679 }
680 convert(object) { 680 convert(object) {
681 return _JsonStringStringifier.stringify(object, dart.as(this[_toEncodable$ ], dart.throw_("Unimplemented type (dynamic) → dynamic")), this.indent); 681 return _JsonStringStringifier.stringify(object, dart.as(this[_toEncodable$ ], dart.throw_("Unimplemented type (dynamic) → dynamic")), this.indent);
682 } 682 }
683 startChunkedConversion(sink) { 683 startChunkedConversion(sink) {
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after
1427 } 1427 }
1428 return null; 1428 return null;
1429 } 1429 }
1430 } 1430 }
1431 _LineSplitterSink._LF = 10; 1431 _LineSplitterSink._LF = 10;
1432 _LineSplitterSink._CR = 13; 1432 _LineSplitterSink._CR = 13;
1433 class StringConversionSink extends ChunkedConversionSink$(core.String) { 1433 class StringConversionSink extends ChunkedConversionSink$(core.String) {
1434 StringConversionSink() { 1434 StringConversionSink() {
1435 super.ChunkedConversionSink(); 1435 super.ChunkedConversionSink();
1436 } 1436 }
1437 StringConversionSink$withCallback(callback) { 1437 withCallback(callback) {
1438 return new _StringCallbackSink(callback); 1438 return new _StringCallbackSink(callback);
1439 } 1439 }
1440 StringConversionSink$from(sink) { 1440 from(sink) {
1441 return new _StringAdapterSink(sink); 1441 return new _StringAdapterSink(sink);
1442 } 1442 }
1443 StringConversionSink$fromStringSink(sink) { 1443 fromStringSink(sink) {
1444 return new _StringSinkConversionSink(sink); 1444 return new _StringSinkConversionSink(sink);
1445 } 1445 }
1446 } 1446 }
1447 dart.defineNamedConstructor(StringConversionSink, 'withCallback'); 1447 dart.defineNamedConstructor(StringConversionSink, 'withCallback');
1448 dart.defineNamedConstructor(StringConversionSink, 'from'); 1448 dart.defineNamedConstructor(StringConversionSink, 'from');
1449 dart.defineNamedConstructor(StringConversionSink, 'fromStringSink'); 1449 dart.defineNamedConstructor(StringConversionSink, 'fromStringSink');
1450 class ClosableStringSink extends core.StringSink { 1450 class ClosableStringSink extends core.StringSink {
1451 ClosableStringSink$fromStringSink(sink, onClose) { 1451 fromStringSink(sink, onClose) {
1452 return new _ClosableStringSink(sink, onClose); 1452 return new _ClosableStringSink(sink, onClose);
1453 } 1453 }
1454 } 1454 }
1455 dart.defineNamedConstructor(ClosableStringSink, 'fromStringSink'); 1455 dart.defineNamedConstructor(ClosableStringSink, 'fromStringSink');
1456 class _ClosableStringSink extends core.Object { 1456 class _ClosableStringSink extends core.Object {
1457 _ClosableStringSink(sink$, callback$) { 1457 _ClosableStringSink(sink$, callback$) {
1458 this[_sink] = sink$; 1458 this[_sink] = sink$;
1459 this[_callback] = callback$; 1459 this[_callback] = callback$;
1460 } 1460 }
1461 close() { 1461 close() {
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
1613 } 1613 }
1614 add(chunk) { 1614 add(chunk) {
1615 this.addSlice(chunk, 0, chunk.length, false); 1615 this.addSlice(chunk, 0, chunk.length, false);
1616 } 1616 }
1617 addSlice(codeUnits, startIndex, endIndex, isLast) { 1617 addSlice(codeUnits, startIndex, endIndex, isLast) {
1618 this[_decoder].convert(codeUnits, startIndex, endIndex); 1618 this[_decoder].convert(codeUnits, startIndex, endIndex);
1619 if (isLast) 1619 if (isLast)
1620 this.close(); 1620 this.close();
1621 } 1621 }
1622 } 1622 }
1623 let _Utf8ConversionSink$_ = Symbol('_Utf8ConversionSink$_');
1624 class _Utf8ConversionSink extends ByteConversionSink { 1623 class _Utf8ConversionSink extends ByteConversionSink {
1625 _Utf8ConversionSink(sink, allowMalformed) { 1624 _Utf8ConversionSink(sink, allowMalformed) {
1626 this[_Utf8ConversionSink$_](sink, new core.StringBuffer(), allowMalformed) ; 1625 this[_$](sink, new core.StringBuffer(), allowMalformed);
1627 } 1626 }
1628 _Utf8ConversionSink$_(chunkedSink, stringBuffer, allowMalformed) { 1627 [_$](chunkedSink, stringBuffer, allowMalformed) {
1629 this[_chunkedSink] = chunkedSink; 1628 this[_chunkedSink] = chunkedSink;
1630 this[_decoder] = new _Utf8Decoder(stringBuffer, allowMalformed); 1629 this[_decoder] = new _Utf8Decoder(stringBuffer, allowMalformed);
1631 this[_buffer] = stringBuffer; 1630 this[_buffer] = stringBuffer;
1632 super.ByteConversionSink(); 1631 super.ByteConversionSink();
1633 } 1632 }
1634 close() { 1633 close() {
1635 this[_decoder].close(); 1634 this[_decoder].close();
1636 if (this[_buffer].isNotEmpty) { 1635 if (this[_buffer].isNotEmpty) {
1637 let accumulated = this[_buffer].toString(); 1636 let accumulated = this[_buffer].toString();
1638 this[_buffer].clear(); 1637 this[_buffer].clear();
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
1713 startChunkedConversion(sink) { 1712 startChunkedConversion(sink) {
1714 if (!dart.is(sink, ByteConversionSink)) { 1713 if (!dart.is(sink, ByteConversionSink)) {
1715 sink = new ByteConversionSink.from(sink); 1714 sink = new ByteConversionSink.from(sink);
1716 } 1715 }
1717 return new _Utf8EncoderSink(dart.as(sink, ByteConversionSink)); 1716 return new _Utf8EncoderSink(dart.as(sink, ByteConversionSink));
1718 } 1717 }
1719 bind(stream) { 1718 bind(stream) {
1720 return dart.as(super.bind(stream), async.Stream$(core.List$(core.int))); 1719 return dart.as(super.bind(stream), async.Stream$(core.List$(core.int)));
1721 } 1720 }
1722 } 1721 }
1723 let _Utf8Encoder$withBufferSize = Symbol('_Utf8Encoder$withBufferSize');
1724 let _DEFAULT_BYTE_BUFFER_SIZE = Symbol('_DEFAULT_BYTE_BUFFER_SIZE'); 1722 let _DEFAULT_BYTE_BUFFER_SIZE = Symbol('_DEFAULT_BYTE_BUFFER_SIZE');
1725 let _createBuffer = Symbol('_createBuffer'); 1723 let _createBuffer = Symbol('_createBuffer');
1726 let _writeSurrogate = Symbol('_writeSurrogate'); 1724 let _writeSurrogate = Symbol('_writeSurrogate');
1727 let _fillBuffer = Symbol('_fillBuffer'); 1725 let _fillBuffer = Symbol('_fillBuffer');
1728 class _Utf8Encoder extends core.Object { 1726 class _Utf8Encoder extends core.Object {
1729 _Utf8Encoder() { 1727 _Utf8Encoder() {
1730 this[_Utf8Encoder$withBufferSize](_Utf8Encoder[_DEFAULT_BYTE_BUFFER_SIZE]) ; 1728 this.withBufferSize(_Utf8Encoder[_DEFAULT_BYTE_BUFFER_SIZE]);
1731 } 1729 }
1732 _Utf8Encoder$withBufferSize(bufferSize) { 1730 withBufferSize(bufferSize) {
1733 this[_buffer] = _Utf8Encoder[_createBuffer](bufferSize); 1731 this[_buffer] = _Utf8Encoder[_createBuffer](bufferSize);
1734 this[_carry] = 0; 1732 this[_carry] = 0;
1735 this[_bufferIndex] = 0; 1733 this[_bufferIndex] = 0;
1736 } 1734 }
1737 static [_createBuffer](size) { 1735 static [_createBuffer](size) {
1738 return new typed_data.Uint8List(size); 1736 return new typed_data.Uint8List(size);
1739 } 1737 }
1740 [_writeSurrogate](leadingSurrogate, nextCodeUnit) { 1738 [_writeSurrogate](leadingSurrogate, nextCodeUnit) {
1741 if (_isTailSurrogate(nextCodeUnit)) { 1739 if (_isTailSurrogate(nextCodeUnit)) {
1742 let rune = _combineSurrogatePair(leadingSurrogate, nextCodeUnit); 1740 let rune = _combineSurrogatePair(leadingSurrogate, nextCodeUnit);
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
2355 exports.LineSplitter = LineSplitter; 2353 exports.LineSplitter = LineSplitter;
2356 exports.StringConversionSink = StringConversionSink; 2354 exports.StringConversionSink = StringConversionSink;
2357 exports.ClosableStringSink = ClosableStringSink; 2355 exports.ClosableStringSink = ClosableStringSink;
2358 exports.UNICODE_REPLACEMENT_CHARACTER_RUNE = UNICODE_REPLACEMENT_CHARACTER_RUN E; 2356 exports.UNICODE_REPLACEMENT_CHARACTER_RUNE = UNICODE_REPLACEMENT_CHARACTER_RUN E;
2359 exports.UNICODE_BOM_CHARACTER_RUNE = UNICODE_BOM_CHARACTER_RUNE; 2357 exports.UNICODE_BOM_CHARACTER_RUNE = UNICODE_BOM_CHARACTER_RUNE;
2360 exports.UTF8 = UTF8; 2358 exports.UTF8 = UTF8;
2361 exports.Utf8Codec = Utf8Codec; 2359 exports.Utf8Codec = Utf8Codec;
2362 exports.Utf8Encoder = Utf8Encoder; 2360 exports.Utf8Encoder = Utf8Encoder;
2363 exports.Utf8Decoder = Utf8Decoder; 2361 exports.Utf8Decoder = Utf8Decoder;
2364 })(convert || (convert = {})); 2362 })(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