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

Side by Side Diff: dart/pkg/compiler/lib/src/util/setlet.dart

Issue 730023002: Don't restrict type on Setlet.remove. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 | Annotate | Revision Log
« 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 library dart2js.util.setlet; 5 library dart2js.util.setlet;
6 6
7 import 'dart:collection' show IterableBase; 7 import 'dart:collection' show IterableBase;
8 8
9 class Setlet<E> extends IterableBase<E> implements Set<E> { 9 class Setlet<E> extends IterableBase<E> implements Set<E> {
10 static const _MARKER = const _SetletMarker(); 10 static const _MARKER = const _SetletMarker();
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 for (int remaining = _extra, i = 0; remaining > 0 && i < CAPACITY; i++) { 150 for (int remaining = _extra, i = 0; remaining > 0 && i < CAPACITY; i++) {
151 var candidate = _contents[i]; 151 var candidate = _contents[i];
152 if (_MARKER == candidate) continue; 152 if (_MARKER == candidate) continue;
153 if (candidate == element) return candidate; 153 if (candidate == element) return candidate;
154 remaining--; 154 remaining--;
155 } 155 }
156 return null; 156 return null;
157 } 157 }
158 } 158 }
159 159
160 bool remove(E element) { 160 bool remove(Object element) {
161 if (_extra == null) { 161 if (_extra == null) {
162 if (_contents == element) { 162 if (_contents == element) {
163 _contents = _MARKER; 163 _contents = _MARKER;
164 return true; 164 return true;
165 } else { 165 } else {
166 return false; 166 return false;
167 } 167 }
168 } else if (_MARKER == _extra) { 168 } else if (_MARKER == _extra) {
169 return _contents.remove(element); 169 return _contents.remove(element);
170 } else { 170 } else {
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 if (Setlet._MARKER != candidate) { 303 if (Setlet._MARKER != candidate) {
304 _current = candidate; 304 _current = candidate;
305 _remaining--; 305 _remaining--;
306 return true; 306 return true;
307 } 307 }
308 } 308 }
309 _current = null; 309 _current = null;
310 return false; 310 return false;
311 } 311 }
312 } 312 }
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