[dart2js] Document/assert that enumset indices must be less than 64

Change-Id: I8b4b1c296fe11044e69221c020a7b1b3abbd9275
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384042
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Auto-Submit: Mayank Patke <fishythefish@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
diff --git a/pkg/compiler/lib/src/util/enumset.dart b/pkg/compiler/lib/src/util/enumset.dart
index 89b2c4f..efa2127 100644
--- a/pkg/compiler/lib/src/util/enumset.dart
+++ b/pkg/compiler/lib/src/util/enumset.dart
@@ -9,13 +9,17 @@
 import 'package:meta/meta.dart';
 
 extension<E extends Enum> on E {
-  int get mask => 1 << index;
+  int get mask {
+    assert(index < 64);
+    return 1 << index;
+  }
 }
 
 int _fold<E extends Enum>(Iterable<E> values) =>
     values.fold(0, (acc, e) => acc | e.mask);
 
-/// A set of enum values based on a bit mask of the shifted enum indices.
+/// A set of enum values based on a bit mask of the shifted enum indices. The
+/// enum indices used must be less than 64.
 extension type const EnumSet<E extends Enum>(int mask) {
   /// Creates an empty set.
   const EnumSet.empty() : mask = 0;