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

Side by Side Diff: sdk/lib/convert/ascii.dart

Issue 2764943002: Fix some strong mode issues in the core libraries. (Closed)
Patch Set: Rebase Created 3 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 | « sdk/lib/async/stream.dart ('k') | sdk/lib/convert/base64.dart » ('j') | 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 * An instance of the default implementation of the [AsciiCodec]. 8 * An instance of the default implementation of the [AsciiCodec].
9 * 9 *
10 * This instance provides a convenient access to the most common ASCII 10 * This instance provides a convenient access to the most common ASCII
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 62
63 AsciiEncoder get encoder => const AsciiEncoder(); 63 AsciiEncoder get encoder => const AsciiEncoder();
64 64
65 AsciiDecoder get decoder => _allowInvalid 65 AsciiDecoder get decoder => _allowInvalid
66 ? const AsciiDecoder(allowInvalid: true) 66 ? const AsciiDecoder(allowInvalid: true)
67 : const AsciiDecoder(allowInvalid: false); 67 : const AsciiDecoder(allowInvalid: false);
68 } 68 }
69 69
70 // Superclass for [AsciiEncoder] and [Latin1Encoder]. 70 // Superclass for [AsciiEncoder] and [Latin1Encoder].
71 // Generalizes common operations that only differ by a mask; 71 // Generalizes common operations that only differ by a mask;
72 class _UnicodeSubsetEncoder extends Converter<String, List<int>> 72 class _UnicodeSubsetEncoder extends Converter<String, List<int>> {
73 implements ChunkedConverter<String, List<int>, String, List<int>> {
74 final int _subsetMask; 73 final int _subsetMask;
75 74
76 const _UnicodeSubsetEncoder(this._subsetMask); 75 const _UnicodeSubsetEncoder(this._subsetMask);
77 76
78 /** 77 /**
79 * Converts the [String] into a list of its code units. 78 * Converts the [String] into a list of its code units.
80 * 79 *
81 * If [start] and [end] are provided, only the substring 80 * If [start] and [end] are provided, only the substring
82 * `string.substring(start, end)` is used as input to the conversion. 81 * `string.substring(start, end)` is used as input to the conversion.
83 */ 82 */
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 if (isLast) { 147 if (isLast) {
149 close(); 148 close();
150 } 149 }
151 } 150 }
152 } 151 }
153 152
154 /** 153 /**
155 * This class converts Latin-1 bytes (lists of unsigned 8-bit integers) 154 * This class converts Latin-1 bytes (lists of unsigned 8-bit integers)
156 * to a string. 155 * to a string.
157 */ 156 */
158 abstract class _UnicodeSubsetDecoder extends Converter<List<int>, String> 157 abstract class _UnicodeSubsetDecoder extends Converter<List<int>, String> {
159 implements ChunkedConverter<List<int>, String, List<int>, String> {
160 final bool _allowInvalid; 158 final bool _allowInvalid;
161 final int _subsetMask; 159 final int _subsetMask;
162 160
163 /** 161 /**
164 * Instantiates a new decoder. 162 * Instantiates a new decoder.
165 * 163 *
166 * The [_allowInvalid] argument defines how [convert] deals 164 * The [_allowInvalid] argument defines how [convert] deals
167 * with invalid bytes. 165 * with invalid bytes.
168 * 166 *
169 * The [_subsetMask] argument is a bit mask used to define the subset 167 * The [_subsetMask] argument is a bit mask used to define the subset
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 RangeError.checkValidRange(start, end, length); 301 RangeError.checkValidRange(start, end, length);
304 if (start < end) { 302 if (start < end) {
305 if (start != 0 || end != length) { 303 if (start != 0 || end != length) {
306 source = source.sublist(start, end); 304 source = source.sublist(start, end);
307 } 305 }
308 add(source); 306 add(source);
309 } 307 }
310 if (isLast) close(); 308 if (isLast) close();
311 } 309 }
312 } 310 }
OLDNEW
« no previous file with comments | « sdk/lib/async/stream.dart ('k') | sdk/lib/convert/base64.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698