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

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

Issue 2413233002: Change Set.difference API to accept Set<Object>. (Closed)
Patch Set: Also update a few subclasses. Created 4 years, 2 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 | « pkg/compiler/lib/src/util/emptyset.dart ('k') | sdk/lib/core/set.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 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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 clear() { 243 clear() {
244 _contents = _MARKER; 244 _contents = _MARKER;
245 _extra = null; 245 _extra = null;
246 } 246 }
247 247
248 Set<E> union(Set<E> other) => new Set<E>.from(this)..addAll(other); 248 Set<E> union(Set<E> other) => new Set<E>.from(this)..addAll(other);
249 249
250 Setlet<E> intersection(Set<E> other) => 250 Setlet<E> intersection(Set<E> other) =>
251 new Setlet<E>.from(this.where((e) => other.contains(e))); 251 new Setlet<E>.from(this.where((e) => other.contains(e)));
252 252
253 Setlet<E> difference(Set<E> other) => 253 Setlet<E> difference(Set<Object> other) =>
254 new Setlet<E>.from(this.where((e) => !other.contains(e))); 254 new Setlet<E>.from(this.where((e) => !other.contains(e)));
255 255
256 Setlet<E> toSet() { 256 Setlet<E> toSet() {
257 Setlet<E> result = new Setlet<E>(); 257 Setlet<E> result = new Setlet<E>();
258 if (_extra == null) { 258 if (_extra == null) {
259 result._contents = _contents; 259 result._contents = _contents;
260 } else if (_extra == _MARKER) { 260 } else if (_extra == _MARKER) {
261 result._extra = _MARKER; 261 result._extra = _MARKER;
262 result._contents = _contents.toSet(); 262 result._contents = _contents.toSet();
263 } else { 263 } else {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 if (Setlet._MARKER != candidate) { 306 if (Setlet._MARKER != candidate) {
307 _current = candidate; 307 _current = candidate;
308 _remaining--; 308 _remaining--;
309 return true; 309 return true;
310 } 310 }
311 } 311 }
312 _current = null; 312 _current = null;
313 return false; 313 return false;
314 } 314 }
315 } 315 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/util/emptyset.dart ('k') | sdk/lib/core/set.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698