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

Side by Side Diff: pkg/dev_compiler/tool/input_sdk/lib/convert/codec.dart

Issue 2481703003: Apply codec change from fb968553 to DDC copy (Closed)
Patch Set: Created 4 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of dart.convert; 5 part of dart.convert;
6 6
7 /** 7 /**
8 * A [Codec] encodes and (if supported) decodes data. 8 * A [Codec] encodes and (if supported) decodes data.
9 * 9 *
10 * Codecs can be fused. For example fusing [JSON] and [UTF8] produces 10 * Codecs can be fused. For example fusing [JSON] and [UTF8] produces
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 * var decoded = JSON_TO_BYTES.decode(bytes); 55 * var decoded = JSON_TO_BYTES.decode(bytes);
56 * assert(decoded is List && decoded[0] == "json-object"); 56 * assert(decoded is List && decoded[0] == "json-object");
57 * 57 *
58 * var inverted = JSON.inverted; 58 * var inverted = JSON.inverted;
59 * var jsonIdentity = JSON.fuse(inverted); 59 * var jsonIdentity = JSON.fuse(inverted);
60 * var jsonObject = jsonIdentity.encode(["1", 2]); 60 * var jsonObject = jsonIdentity.encode(["1", 2]);
61 * assert(jsonObject is List && jsonObject[0] == "1" && jsonObject[1] == 2 ); 61 * assert(jsonObject is List && jsonObject[0] == "1" && jsonObject[1] == 2 );
62 */ 62 */
63 // TODO(floitsch): use better example with line-splitter once that one is 63 // TODO(floitsch): use better example with line-splitter once that one is
64 // in this library. 64 // in this library.
65 Codec<S, dynamic> fuse(Codec<T, dynamic> other) { 65 Codec<S, dynamic/*=R*/> fuse/*<R>*/(Codec<T, dynamic/*=R*/> other) {
66 return new _FusedCodec<S, T, dynamic>(this, other); 66 return new _FusedCodec<S, T, dynamic/*=R*/>(this, other);
67 } 67 }
68 68
69 /** 69 /**
70 * Inverts `this`. 70 * Inverts `this`.
71 * 71 *
72 * The [encoder] and [decoder] of the resulting codec are swapped. 72 * The [encoder] and [decoder] of the resulting codec are swapped.
73 */ 73 */
74 Codec<T, S> get inverted => new _InvertedCodec<T, S>(this); 74 Codec<T, S> get inverted => new _InvertedCodec<T, S>(this);
75 } 75 }
76 76
(...skipping 16 matching lines...) Expand all
93 class _InvertedCodec<T, S> extends Codec<T, S> { 93 class _InvertedCodec<T, S> extends Codec<T, S> {
94 final Codec<S, T> _codec; 94 final Codec<S, T> _codec;
95 95
96 _InvertedCodec(Codec<S, T> codec) : _codec = codec; 96 _InvertedCodec(Codec<S, T> codec) : _codec = codec;
97 97
98 Converter<T, S> get encoder => _codec.decoder; 98 Converter<T, S> get encoder => _codec.decoder;
99 Converter<S, T> get decoder => _codec.encoder; 99 Converter<S, T> get decoder => _codec.encoder;
100 100
101 Codec<S, T> get inverted => _codec; 101 Codec<S, T> get inverted => _codec;
102 } 102 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698