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

Side by Side Diff: pkg/collection/lib/src/unmodifiable_wrappers.dart

Issue 308653004: Fix analyzer hints in pkg/collection. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « pkg/collection/CHANGELOG.md ('k') | pkg/collection/pubspec.yaml » ('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 /** 5 /**
6 * Wrappers that prevent a List, Set, or Map object from being modified. 6 * Wrappers that prevent a List, Set, or Map object from being modified.
7 * 7 *
8 * The [Set] and [Map] wrappers allow reading from the wrapped collection, 8 * The [Set] and [Map] wrappers allow reading from the wrapped collection,
9 * but prohibit writing. 9 * but prohibit writing.
10 * 10 *
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 * operations that change the length of the list are disallowed. 46 * operations that change the length of the list are disallowed.
47 */ 47 */
48 void set length(int newLength) => _throw(); 48 void set length(int newLength) => _throw();
49 49
50 /** 50 /**
51 * Throws an [UnsupportedError]; 51 * Throws an [UnsupportedError];
52 * operations that change the length of the list are disallowed. 52 * operations that change the length of the list are disallowed.
53 */ 53 */
54 bool add(E value) { 54 bool add(E value) {
55 _throw(); 55 _throw();
56 throw 'unreachable';
Lasse Reichstein Nielsen 2014/05/29 21:55:06 Maybe change _throw to return dynamic and write th
nweiz 2014/05/30 00:49:41 Done.
56 } 57 }
57 58
58 /** 59 /**
59 * Throws an [UnsupportedError]; 60 * Throws an [UnsupportedError];
60 * operations that change the length of the list are disallowed. 61 * operations that change the length of the list are disallowed.
61 */ 62 */
62 void addAll(Iterable<E> iterable) => _throw(); 63 void addAll(Iterable<E> iterable) => _throw();
63 64
64 /** 65 /**
65 * Throws an [UnsupportedError]; 66 * Throws an [UnsupportedError];
66 * operations that change the length of the list are disallowed. 67 * operations that change the length of the list are disallowed.
67 */ 68 */
68 void insert(int index, E element) => _throw(); 69 void insert(int index, E element) => _throw();
69 70
70 /** 71 /**
71 * Throws an [UnsupportedError]; 72 * Throws an [UnsupportedError];
72 * operations that change the length of the list are disallowed. 73 * operations that change the length of the list are disallowed.
73 */ 74 */
74 void insertAll(int index, Iterable<E> iterable) => _throw(); 75 void insertAll(int index, Iterable<E> iterable) => _throw();
75 76
76 /** 77 /**
77 * Throws an [UnsupportedError]; 78 * Throws an [UnsupportedError];
78 * operations that change the length of the list are disallowed. 79 * operations that change the length of the list are disallowed.
79 */ 80 */
80 bool remove(Object value) { _throw(); } 81 bool remove(Object value) {
82 _throw();
83 throw 'unreachable';
84 }
81 85
82 /** 86 /**
83 * Throws an [UnsupportedError]; 87 * Throws an [UnsupportedError];
84 * operations that change the length of the list are disallowed. 88 * operations that change the length of the list are disallowed.
85 */ 89 */
86 E removeAt(int index) { _throw(); } 90 E removeAt(int index) {
91 _throw();
92 throw 'unreachable';
93 }
87 94
88 /** 95 /**
89 * Throws an [UnsupportedError]; 96 * Throws an [UnsupportedError];
90 * operations that change the length of the list are disallowed. 97 * operations that change the length of the list are disallowed.
91 */ 98 */
92 E removeLast() { _throw(); } 99 E removeLast() {
100 _throw();
101 throw 'unreachable';
102 }
93 103
94 /** 104 /**
95 * Throws an [UnsupportedError]; 105 * Throws an [UnsupportedError];
96 * operations that change the length of the list are disallowed. 106 * operations that change the length of the list are disallowed.
97 */ 107 */
98 void removeWhere(bool test(E element)) => _throw(); 108 void removeWhere(bool test(E element)) => _throw();
99 109
100 /** 110 /**
101 * Throws an [UnsupportedError]; 111 * Throws an [UnsupportedError];
102 * operations that change the length of the list are disallowed. 112 * operations that change the length of the list are disallowed.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 void _throw() { 154 void _throw() {
145 throw new UnsupportedError("Cannot modify an unmodifiable Set"); 155 throw new UnsupportedError("Cannot modify an unmodifiable Set");
146 } 156 }
147 157
148 /** 158 /**
149 * Throws an [UnsupportedError]; 159 * Throws an [UnsupportedError];
150 * operations that change the set are disallowed. 160 * operations that change the set are disallowed.
151 */ 161 */
152 bool add(E value) { 162 bool add(E value) {
153 _throw(); 163 _throw();
164 throw 'unreachable';
154 } 165 }
155 166
156 /** 167 /**
157 * Throws an [UnsupportedError]; 168 * Throws an [UnsupportedError];
158 * operations that change the set are disallowed. 169 * operations that change the set are disallowed.
159 */ 170 */
160 void addAll(Iterable<E> elements) => _throw(); 171 void addAll(Iterable<E> elements) => _throw();
161 172
162 /** 173 /**
163 * Throws an [UnsupportedError]; 174 * Throws an [UnsupportedError];
164 * operations that change the set are disallowed. 175 * operations that change the set are disallowed.
165 */ 176 */
166 bool remove(Object value) { _throw(); } 177 bool remove(Object value) {
178 _throw();
179 throw 'unreachable';
180 }
167 181
168 /** 182 /**
169 * Throws an [UnsupportedError]; 183 * Throws an [UnsupportedError];
170 * operations that change the set are disallowed. 184 * operations that change the set are disallowed.
171 */ 185 */
172 void removeAll(Iterable elements) => _throw(); 186 void removeAll(Iterable elements) => _throw();
173 187
174 /** 188 /**
175 * Throws an [UnsupportedError]; 189 * Throws an [UnsupportedError];
176 * operations that change the set are disallowed. 190 * operations that change the set are disallowed.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 /** 236 /**
223 * Throws an [UnsupportedError]; 237 * Throws an [UnsupportedError];
224 * operations that change the map are disallowed. 238 * operations that change the map are disallowed.
225 */ 239 */
226 void operator []=(K key, V value) => _throw(); 240 void operator []=(K key, V value) => _throw();
227 241
228 /** 242 /**
229 * Throws an [UnsupportedError]; 243 * Throws an [UnsupportedError];
230 * operations that change the map are disallowed. 244 * operations that change the map are disallowed.
231 */ 245 */
232 V putIfAbsent(K key, V ifAbsent()) { _throw(); } 246 V putIfAbsent(K key, V ifAbsent()) {
247 _throw();
248 throw 'unreachable';
249 }
233 250
234 /** 251 /**
235 * Throws an [UnsupportedError]; 252 * Throws an [UnsupportedError];
236 * operations that change the map are disallowed. 253 * operations that change the map are disallowed.
237 */ 254 */
238 void addAll(Map<K, V> other) => _throw(); 255 void addAll(Map<K, V> other) => _throw();
239 256
240 /** 257 /**
241 * Throws an [UnsupportedError]; 258 * Throws an [UnsupportedError];
242 * operations that change the map are disallowed. 259 * operations that change the map are disallowed.
243 */ 260 */
244 V remove(K key) { _throw(); } 261 V remove(K key) {
262 _throw();
263 throw 'unreachable';
264 }
245 265
246 /** 266 /**
247 * Throws an [UnsupportedError]; 267 * Throws an [UnsupportedError];
248 * operations that change the map are disallowed. 268 * operations that change the map are disallowed.
249 */ 269 */
250 void clear() => _throw(); 270 void clear() => _throw();
251 } 271 }
OLDNEW
« no previous file with comments | « pkg/collection/CHANGELOG.md ('k') | pkg/collection/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698