| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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.enumset; | 5 library dart2js.util.enumset; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 /// A set of enum values based on a bit mask of the shifted enum indices. | 9 /// A set of enum values based on a bit mask of the shifted enum indices. |
| 10 abstract class EnumSet<E> { | 10 abstract class EnumSet<E> { |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 | 124 |
| 125 const _ConstEnumSet(this.value) : super._(); | 125 const _ConstEnumSet(this.value) : super._(); |
| 126 | 126 |
| 127 factory _ConstEnumSet.fromValues(Iterable<E> values) { | 127 factory _ConstEnumSet.fromValues(Iterable<E> values) { |
| 128 int value = 0; | 128 int value = 0; |
| 129 void add(E enumValue) { | 129 void add(E enumValue) { |
| 130 if (enumValue != null) { | 130 if (enumValue != null) { |
| 131 value |= 1 << (enumValue as dynamic).index; | 131 value |= 1 << (enumValue as dynamic).index; |
| 132 } | 132 } |
| 133 } | 133 } |
| 134 |
| 134 values.forEach(add); | 135 values.forEach(add); |
| 135 return new _ConstEnumSet(value); | 136 return new _ConstEnumSet(value); |
| 136 } | 137 } |
| 137 | 138 |
| 138 @override | 139 @override |
| 139 void add(E enumValue) { | 140 void add(E enumValue) { |
| 140 throw new UnsupportedError('EnumSet.add'); | 141 throw new UnsupportedError('EnumSet.add'); |
| 141 } | 142 } |
| 142 | 143 |
| 143 @override | 144 @override |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 _mask >>= 1; | 191 _mask >>= 1; |
| 191 _index--; | 192 _index--; |
| 192 if (_current != null) { | 193 if (_current != null) { |
| 193 break; | 194 break; |
| 194 } | 195 } |
| 195 } | 196 } |
| 196 return _current != null; | 197 return _current != null; |
| 197 } | 198 } |
| 198 } | 199 } |
| 199 } | 200 } |
| OLD | NEW |