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

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

Issue 1117793002: add checks needed for covariant generics, and List<E> (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 7 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 = dart.const(new AsciiCodec()); 4 let ASCII = dart.const(new AsciiCodec());
5 let _ASCII_MASK = 127; 5 let _ASCII_MASK = 127;
6 let _allowInvalid = Symbol('_allowInvalid'); 6 let _allowInvalid = Symbol('_allowInvalid');
7 let Codec$ = dart.generic(function(S, T) { 7 let Codec$ = dart.generic(function(S, T) {
8 class Codec extends core.Object { 8 class Codec extends core.Object {
9 Codec() { 9 Codec() {
10 } 10 }
11 encode(input) { 11 encode(input) {
12 dart.as(input, S);
12 return this.encoder.convert(input); 13 return this.encoder.convert(input);
13 } 14 }
14 decode(encoded) { 15 decode(encoded) {
16 dart.as(encoded, T);
15 return this.decoder.convert(encoded); 17 return this.decoder.convert(encoded);
16 } 18 }
17 fuse(other) { 19 fuse(other) {
20 dart.as(other, Codec$(T, dart.dynamic));
18 return new (_FusedCodec$(S, T, dart.dynamic))(this, other); 21 return new (_FusedCodec$(S, T, dart.dynamic))(this, other);
19 } 22 }
20 get inverted() { 23 get inverted() {
21 return new (_InvertedCodec$(T, S))(this); 24 return new (_InvertedCodec$(T, S))(this);
22 } 25 }
23 } 26 }
24 return Codec; 27 return Codec;
25 }); 28 });
26 let Codec = Codec$(); 29 let Codec = Codec$();
27 class Encoding extends Codec$(core.String, core.List$(core.int)) { 30 class Encoding extends Codec$(core.String, core.List$(core.int)) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 get decoder() { 75 get decoder() {
73 return this[_allowInvalid] ? dart.const(new AsciiDecoder({allowInvalid: tr ue})) : dart.const(new AsciiDecoder({allowInvalid: false})); 76 return this[_allowInvalid] ? dart.const(new AsciiDecoder({allowInvalid: tr ue})) : dart.const(new AsciiDecoder({allowInvalid: false}));
74 } 77 }
75 } 78 }
76 let _subsetMask = Symbol('_subsetMask'); 79 let _subsetMask = Symbol('_subsetMask');
77 let Converter$ = dart.generic(function(S, T) { 80 let Converter$ = dart.generic(function(S, T) {
78 class Converter extends core.Object { 81 class Converter extends core.Object {
79 Converter() { 82 Converter() {
80 } 83 }
81 fuse(other) { 84 fuse(other) {
85 dart.as(other, Converter$(T, dart.dynamic));
82 return new (_FusedConverter$(S, T, dart.dynamic))(this, other); 86 return new (_FusedConverter$(S, T, dart.dynamic))(this, other);
83 } 87 }
84 startChunkedConversion(sink) { 88 startChunkedConversion(sink) {
85 throw new core.UnsupportedError(`This converter does not support chunked conversions: ${this}`); 89 throw new core.UnsupportedError(`This converter does not support chunked conversions: ${this}`);
86 } 90 }
87 bind(source) { 91 bind(source) {
88 return new async.Stream.eventTransformed(source, (sink => new _Converter StreamEventSink(this, sink)).bind(this)); 92 return new async.Stream.eventTransformed(source, (sink => new _Converter StreamEventSink(this, sink)).bind(this));
89 } 93 }
90 } 94 }
91 Converter[dart.implements] = () => [async.StreamTransformer]; 95 Converter[dart.implements] = () => [async.StreamTransformer];
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 let _ChunkedConversionCallback = _ChunkedConversionCallback$(); 377 let _ChunkedConversionCallback = _ChunkedConversionCallback$();
374 let _accumulated = Symbol('_accumulated'); 378 let _accumulated = Symbol('_accumulated');
375 let _SimpleCallbackSink$ = dart.generic(function(T) { 379 let _SimpleCallbackSink$ = dart.generic(function(T) {
376 class _SimpleCallbackSink extends ChunkedConversionSink$(T) { 380 class _SimpleCallbackSink extends ChunkedConversionSink$(T) {
377 _SimpleCallbackSink(callback) { 381 _SimpleCallbackSink(callback) {
378 this[_accumulated] = dart.setType([], core.List$(T)); 382 this[_accumulated] = dart.setType([], core.List$(T));
379 this[_callback] = callback; 383 this[_callback] = callback;
380 super.ChunkedConversionSink(); 384 super.ChunkedConversionSink();
381 } 385 }
382 add(chunk) { 386 add(chunk) {
387 dart.as(chunk, T);
383 this[_accumulated][core.$add](chunk); 388 this[_accumulated][core.$add](chunk);
384 } 389 }
385 close() { 390 close() {
386 this[_callback](this[_accumulated]); 391 this[_callback](this[_accumulated]);
387 } 392 }
388 } 393 }
389 return _SimpleCallbackSink; 394 return _SimpleCallbackSink;
390 }); 395 });
391 let _SimpleCallbackSink = _SimpleCallbackSink$(); 396 let _SimpleCallbackSink = _SimpleCallbackSink$();
392 let _EventSinkAdapter$ = dart.generic(function(T) { 397 let _EventSinkAdapter$ = dart.generic(function(T) {
393 class _EventSinkAdapter extends core.Object { 398 class _EventSinkAdapter extends core.Object {
394 _EventSinkAdapter(sink) { 399 _EventSinkAdapter(sink) {
395 this[_sink] = sink; 400 this[_sink] = sink;
396 } 401 }
397 add(data) { 402 add(data) {
403 dart.as(data, T);
398 return this[_sink].add(data); 404 return this[_sink].add(data);
399 } 405 }
400 close() { 406 close() {
401 return this[_sink].close(); 407 return this[_sink].close();
402 } 408 }
403 } 409 }
404 _EventSinkAdapter[dart.implements] = () => [ChunkedConversionSink$(T)]; 410 _EventSinkAdapter[dart.implements] = () => [ChunkedConversionSink$(T)];
405 return _EventSinkAdapter; 411 return _EventSinkAdapter;
406 }); 412 });
407 let _EventSinkAdapter = _EventSinkAdapter$(); 413 let _EventSinkAdapter = _EventSinkAdapter$();
408 let _eventSink = Symbol('_eventSink'); 414 let _eventSink = Symbol('_eventSink');
409 let _chunkedSink = Symbol('_chunkedSink'); 415 let _chunkedSink = Symbol('_chunkedSink');
410 let _ConverterStreamEventSink$ = dart.generic(function(S, T) { 416 let _ConverterStreamEventSink$ = dart.generic(function(S, T) {
411 class _ConverterStreamEventSink extends core.Object { 417 class _ConverterStreamEventSink extends core.Object {
412 _ConverterStreamEventSink(converter, sink) { 418 _ConverterStreamEventSink(converter, sink) {
413 this[_eventSink] = sink; 419 this[_eventSink] = sink;
414 this[_chunkedSink] = converter.startChunkedConversion(sink); 420 this[_chunkedSink] = converter.startChunkedConversion(sink);
415 } 421 }
416 add(o) { 422 add(o) {
423 dart.as(o, S);
417 return this[_chunkedSink].add(o); 424 return this[_chunkedSink].add(o);
418 } 425 }
419 addError(error, stackTrace) { 426 addError(error, stackTrace) {
420 if (stackTrace === void 0) 427 if (stackTrace === void 0)
421 stackTrace = null; 428 stackTrace = null;
422 this[_eventSink].addError(error, stackTrace); 429 this[_eventSink].addError(error, stackTrace);
423 } 430 }
424 close() { 431 close() {
425 return this[_chunkedSink].close(); 432 return this[_chunkedSink].close();
426 } 433 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 }); 476 });
470 let _InvertedCodec = _InvertedCodec$(); 477 let _InvertedCodec = _InvertedCodec$();
471 let _FusedConverter$ = dart.generic(function(S, M, T) { 478 let _FusedConverter$ = dart.generic(function(S, M, T) {
472 class _FusedConverter extends Converter$(S, T) { 479 class _FusedConverter extends Converter$(S, T) {
473 _FusedConverter(first, second) { 480 _FusedConverter(first, second) {
474 this[_first] = first; 481 this[_first] = first;
475 this[_second] = second; 482 this[_second] = second;
476 super.Converter(); 483 super.Converter();
477 } 484 }
478 convert(input) { 485 convert(input) {
486 dart.as(input, S);
479 return dart.as(this[_second].convert(this[_first].convert(input)), T); 487 return dart.as(this[_second].convert(this[_first].convert(input)), T);
480 } 488 }
481 startChunkedConversion(sink) { 489 startChunkedConversion(sink) {
482 return this[_first].startChunkedConversion(this[_second].startChunkedCon version(sink)); 490 return this[_first].startChunkedConversion(this[_second].startChunkedCon version(sink));
483 } 491 }
484 } 492 }
485 return _FusedConverter; 493 return _FusedConverter;
486 }); 494 });
487 let _FusedConverter = _FusedConverter$(); 495 let _FusedConverter = _FusedConverter$();
488 let HTML_ESCAPE = dart.const(new HtmlEscape()); 496 let HTML_ESCAPE = dart.const(new HtmlEscape());
(...skipping 1921 matching lines...) Expand 10 before | Expand all | Expand 10 after
2410 exports.LineSplitter = LineSplitter; 2418 exports.LineSplitter = LineSplitter;
2411 exports.StringConversionSink = StringConversionSink; 2419 exports.StringConversionSink = StringConversionSink;
2412 exports.ClosableStringSink = ClosableStringSink; 2420 exports.ClosableStringSink = ClosableStringSink;
2413 exports.UNICODE_REPLACEMENT_CHARACTER_RUNE = UNICODE_REPLACEMENT_CHARACTER_RUN E; 2421 exports.UNICODE_REPLACEMENT_CHARACTER_RUNE = UNICODE_REPLACEMENT_CHARACTER_RUN E;
2414 exports.UNICODE_BOM_CHARACTER_RUNE = UNICODE_BOM_CHARACTER_RUNE; 2422 exports.UNICODE_BOM_CHARACTER_RUNE = UNICODE_BOM_CHARACTER_RUNE;
2415 exports.UTF8 = UTF8; 2423 exports.UTF8 = UTF8;
2416 exports.Utf8Codec = Utf8Codec; 2424 exports.Utf8Codec = Utf8Codec;
2417 exports.Utf8Encoder = Utf8Encoder; 2425 exports.Utf8Encoder = Utf8Encoder;
2418 exports.Utf8Decoder = Utf8Decoder; 2426 exports.Utf8Decoder = Utf8Decoder;
2419 })(convert || (convert = {})); 2427 })(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