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

Unified Diff: pkg/analyzer/lib/src/generated/utilities_collection.dart

Issue 189043003: Improved 'has' properties translation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer/lib/src/generated/utilities_collection.dart
diff --git a/pkg/analyzer/lib/src/generated/utilities_collection.dart b/pkg/analyzer/lib/src/generated/utilities_collection.dart
index dd0779263b982dcfc227436281264facab30e14c..6a74d97ce78a9278df248c2499b3d6e1462c2486 100644
--- a/pkg/analyzer/lib/src/generated/utilities_collection.dart
+++ b/pkg/analyzer/lib/src/generated/utilities_collection.dart
@@ -23,7 +23,10 @@ class BooleanArray {
* @return the value of the element at the given index
* @throws IndexOutOfBoundsException if the index is not between zero (0) and 31, inclusive
*/
- static bool get(int array, Enum index) => get2(array, index.ordinal);
+ static bool get(int array, int index) {
+ checkIndex(index);
+ return (array & (1 << index)) > 0;
+ }
/**
* Return the value of the element at the given index.
@@ -33,10 +36,7 @@ class BooleanArray {
* @return the value of the element at the given index
* @throws IndexOutOfBoundsException if the index is not between zero (0) and 31, inclusive
*/
- static bool get2(int array, int index) {
- checkIndex(index);
- return (array & (1 << index)) > 0;
- }
+ static bool getEnum(int array, Enum index) => get(array, index.ordinal);
/**
* Set the value of the element at the given index to the given value.
@@ -47,7 +47,14 @@ class BooleanArray {
* @return the updated value of the array
* @throws IndexOutOfBoundsException if the index is not between zero (0) and 31, inclusive
*/
- static int set(int array, Enum index, bool value) => set2(array, index.ordinal, value);
+ static int set(int array, int index, bool value) {
+ checkIndex(index);
+ if (value) {
+ return array | (1 << index);
+ } else {
+ return array & ~(1 << index);
+ }
+ }
/**
* Set the value of the element at the given index to the given value.
@@ -58,14 +65,7 @@ class BooleanArray {
* @return the updated value of the array
* @throws IndexOutOfBoundsException if the index is not between zero (0) and 31, inclusive
*/
- static int set2(int array, int index, bool value) {
- checkIndex(index);
- if (value) {
- return array | (1 << index);
- } else {
- return array & ~(1 << index);
- }
- }
+ static int setEnum(int array, Enum index, bool value) => set(array, index.ordinal, value);
/**
* Throw an exception if the index is not within the bounds allowed for an integer-encoded array

Powered by Google App Engine
This is Rietveld 408576698