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

Side by Side Diff: test/dart_codegen/expect/convert/codec.dart

Issue 1038583004: Rationalize coercions (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Rebase 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 part of dart.convert; 1 part of dart.convert;
2 abstract class Codec<S, T> {const Codec(); 2 abstract class Codec<S, T> {const Codec();
3 T encode(S input) => encoder.convert(input); 3 T encode(S input) => encoder.convert(input);
4 S decode(T encoded) => decoder.convert(encoded); 4 S decode(T encoded) => decoder.convert(encoded);
5 Converter<S, T> get encoder; 5 Converter<S, T> get encoder;
6 Converter<T, S> get decoder; 6 Converter<T, S> get decoder;
7 Codec<S, dynamic> fuse(Codec<T, dynamic> other) { 7 Codec<S, dynamic> fuse(Codec<T, dynamic> other) {
8 return new _FusedCodec<S, T, dynamic>(this, other); 8 return new _FusedCodec<S, T, dynamic>(this, other);
9 } 9 }
10 Codec<T, S> get inverted => new _InvertedCodec<T, S>(this); 10 Codec<T, S> get inverted => new _InvertedCodec<T, S>(this);
11 } 11 }
12 class _FusedCodec<S, M, T> extends Codec<S, T> {final Codec<S, M> _first; 12 class _FusedCodec<S, M, T> extends Codec<S, T> {final Codec<S, M> _first;
13 final Codec<M, T> _second; 13 final Codec<M, T> _second;
14 Converter<S, T> get encoder => ((__x2) => DEVC$RT.cast(__x2, DEVC$RT.type((Conv erter<S, dynamic> _) { 14 Converter<S, T> get encoder => ((__x2) => DEVC$RT.cast(__x2, DEVC$RT.type((Conv erter<S, dynamic> _) {
15 } 15 }
16 ), DEVC$RT.type((Converter<S, T> _) { 16 ), DEVC$RT.type((Converter<S, T> _) {
17 } 17 }
18 ), "CastDynamic", """line 87, column 34 of dart:convert/codec.dart: """, __x2 is Converter<S, T>, false))(_first.encoder.fuse(_second.encoder)); 18 ), "CompositeCast", """line 87, column 34 of dart:convert/codec.dart: """, __x2 is Converter<S, T>, false))(_first.encoder.fuse(_second.encoder));
19 Converter<T, S> get decoder => ((__x3) => DEVC$RT.cast(__x3, DEVC$RT.type((Conv erter<T, dynamic> _) { 19 Converter<T, S> get decoder => ((__x3) => DEVC$RT.cast(__x3, DEVC$RT.type((Conv erter<T, dynamic> _) {
20 } 20 }
21 ), DEVC$RT.type((Converter<T, S> _) { 21 ), DEVC$RT.type((Converter<T, S> _) {
22 } 22 }
23 ), "CastDynamic", """line 88, column 34 of dart:convert/codec.dart: """, __x3 is Converter<T, S>, false))(_second.decoder.fuse(_first.decoder)); 23 ), "CompositeCast", """line 88, column 34 of dart:convert/codec.dart: """, __x3 is Converter<T, S>, false))(_second.decoder.fuse(_first.decoder));
24 _FusedCodec(this._first, this._second); 24 _FusedCodec(this._first, this._second);
25 } 25 }
26 class _InvertedCodec<T, S> extends Codec<T, S> {final Codec<S, T> _codec; 26 class _InvertedCodec<T, S> extends Codec<T, S> {final Codec<S, T> _codec;
27 _InvertedCodec(Codec<S, T> codec) : _codec = codec; 27 _InvertedCodec(Codec<S, T> codec) : _codec = codec;
28 Converter<T, S> get encoder => _codec.decoder; 28 Converter<T, S> get encoder => _codec.decoder;
29 Converter<S, T> get decoder => _codec.encoder; 29 Converter<S, T> get decoder => _codec.encoder;
30 Codec<S, T> get inverted => _codec; 30 Codec<S, T> get inverted => _codec;
31 } 31 }
OLDNEW
« no previous file with comments | « test/dart_codegen/expect/convert/ascii.dart ('k') | test/dart_codegen/expect/convert/converter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698