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

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

Issue 2938823002: Starting making dart2js strong mode clean. (Closed)
Patch Set: Address some comments. Created 3 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
« no previous file with comments | « pkg/compiler/lib/src/util/maplet.dart ('k') | pkg/compiler/testing_strong.json » ('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 _SetletMarker _MARKER = const _SetletMarker();
11 static const CAPACITY = 8; 11 static const int CAPACITY = 8;
12 12
13 // The setlet can be in one of four states: 13 // The setlet can be in one of four states:
14 // 14 //
15 // * Empty (extra: null, contents: marker) 15 // * Empty (extra: null, contents: marker)
16 // * Single element (extra: null, contents: element) 16 // * Single element (extra: null, contents: element)
17 // * List-backed (extra: length, contents: list) 17 // * List-backed (extra: length, contents: list)
18 // * Set-backed (extra: marker, contents: set) 18 // * Set-backed (extra: marker, contents: set)
19 // 19 //
20 // When the setlet is list-backed, the list in the contents field 20 // When the setlet is list-backed, the list in the contents field
21 // may have empty slots filled with the marker value. 21 // may have empty slots filled with the marker value.
22 var _contents = _MARKER; 22 dynamic _contents = _MARKER;
23 var _extra; 23 var _extra;
24 24
25 Setlet(); 25 Setlet();
26 Setlet.from(Iterable<E> elements) { 26 Setlet.from(Iterable<E> elements) {
27 addAll(elements); 27 addAll(elements);
28 } 28 }
29 29
30 Iterator<E> get iterator { 30 Iterator<E> get iterator {
31 if (_extra == null) { 31 if (_extra == null) {
32 return new _SetletSingleIterator<E>(_contents); 32 return new _SetletSingleIterator<E>(_contents);
(...skipping 273 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/maplet.dart ('k') | pkg/compiler/testing_strong.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698