Version 2.17.0-75.0.dev

Merge commit 'ae4529a450fc687513d93395b2ce19272e0d0308' into 'dev'
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f525e29..8ea983b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -17,13 +17,6 @@
 - `IdbFactory.supportsDatabaseNames` has been deprecated. It will always return
   `false`.
 
-#### `dart:io`
-
-- **Breaking Change** [#45410](https://github.com/dart-lang/sdk/issues/45410):
-  `HttpClient` no longer transmits some headers (i.e. `authorization`,
-  `www-authenticate`, `cookie`, `cookie2`) when processing redirects to
-  a different domain.
-
 ### Tools
 
 #### Dart command line
@@ -60,13 +53,16 @@
 
 #### `dart:io`
 
+- **Breaking Change** [#45410](https://github.com/dart-lang/sdk/issues/45410):
+  `HttpClient` no longer transmits some headers (i.e. `authorization`,
+  `www-authenticate`, `cookie`, `cookie2`) when processing redirects to a
+  different domain.
 - **Breaking Change** [#47653](https://github.com/dart-lang/sdk/issues/47653):
-On Windows, `Directory.rename` will no longer delete a directory if
-`newPath` specifies one. Instead, a `FileSystemException` will be thrown.
-
+  On Windows, `Directory.rename` will no longer delete a directory if
+  `newPath` specifies one. Instead, a `FileSystemException` will be thrown.
 - **Breaking Change** [#47769](https://github.com/dart-lang/sdk/issues/47769):
-The `Platform.packageRoot` API has been removed. It had been marked deprecated
-in 2018, as it doesn't work with any Dart 2.x release.
+  The `Platform.packageRoot` API has been removed. It had been marked deprecated
+  in 2018, as it doesn't work with any Dart 2.x release.
 - Add optional `sourcePort` parameter to `Socket.connect`, `Socket.startConnect`, `RawSocket.connect` and `RawSocket.startConnect`
 
 #### `dart:isolate`
diff --git a/pkg/analyzer/lib/error/error.dart b/pkg/analyzer/lib/error/error.dart
index 3555ef1..4dcc569 100644
--- a/pkg/analyzer/lib/error/error.dart
+++ b/pkg/analyzer/lib/error/error.dart
@@ -323,6 +323,7 @@
   CompileTimeErrorCode.NON_BOOL_EXPRESSION,
   CompileTimeErrorCode.NON_BOOL_NEGATION_EXPRESSION,
   CompileTimeErrorCode.NON_BOOL_OPERAND,
+  CompileTimeErrorCode.NON_CONST_GENERATIVE_ENUM_CONSTRUCTOR,
   CompileTimeErrorCode.NON_CONST_MAP_AS_EXPRESSION_STATEMENT,
   CompileTimeErrorCode.NON_CONSTANT_ANNOTATION_CONSTRUCTOR,
   CompileTimeErrorCode.NON_CONSTANT_CASE_EXPRESSION,
@@ -408,6 +409,7 @@
   CompileTimeErrorCode.SUPER_FORMAL_PARAMETER_TYPE_IS_NOT_SUBTYPE_OF_ASSOCIATED,
   CompileTimeErrorCode.SUPER_FORMAL_PARAMETER_WITHOUT_ASSOCIATED_NAMED,
   CompileTimeErrorCode.SUPER_FORMAL_PARAMETER_WITHOUT_ASSOCIATED_POSITIONAL,
+  CompileTimeErrorCode.SUPER_IN_ENUM_CONSTRUCTOR,
   CompileTimeErrorCode.SUPER_IN_EXTENSION,
   CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT,
   CompileTimeErrorCode.SUPER_IN_REDIRECTING_CONSTRUCTOR,
diff --git a/pkg/analyzer/lib/src/error/codes.g.dart b/pkg/analyzer/lib/src/error/codes.g.dart
index edeba68..8291121 100644
--- a/pkg/analyzer/lib/src/error/codes.g.dart
+++ b/pkg/analyzer/lib/src/error/codes.g.dart
@@ -10285,6 +10285,13 @@
     hasPublishedDocs: true,
   );
 
+  static const CompileTimeErrorCode NON_CONST_GENERATIVE_ENUM_CONSTRUCTOR =
+      CompileTimeErrorCode(
+    'NON_CONST_GENERATIVE_ENUM_CONSTRUCTOR',
+    "Generative enum constructors must be 'const'.",
+    correctionMessage: "Try adding the keyword 'const'.",
+  );
+
   /**
    * 13.2 Expression Statements: It is a compile-time error if a non-constant
    * map literal that has no explicit type arguments appears in a place where a
@@ -13190,6 +13197,13 @@
     hasPublishedDocs: true,
   );
 
+  static const CompileTimeErrorCode SUPER_IN_ENUM_CONSTRUCTOR =
+      CompileTimeErrorCode(
+    'SUPER_IN_ENUM_CONSTRUCTOR',
+    "The enum constructor can't have a 'super' initializer.",
+    correctionMessage: "Try removing the 'super' invocation.",
+  );
+
   /**
    * No parameters.
    */
diff --git a/pkg/analyzer/lib/src/generated/error_verifier.dart b/pkg/analyzer/lib/src/generated/error_verifier.dart
index 6746259..8b4fd62 100644
--- a/pkg/analyzer/lib/src/generated/error_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/error_verifier.dart
@@ -495,6 +495,7 @@
   void visitConstructorDeclaration(ConstructorDeclaration node) {
     var element = node.declaredElement!;
     _withEnclosingExecutable(element, () {
+      _checkForNonConstGenerativeEnumConstructor(node);
       _checkForInvalidModifierOnBody(
           node.body, CompileTimeErrorCode.INVALID_MODIFIER_ON_CONSTRUCTOR);
       if (!_checkForConstConstructorWithNonConstSuper(node)) {
@@ -1877,6 +1878,10 @@
   /// field initializers, and assert initializers.
   void _checkForConflictingInitializerErrorCodes(
       ConstructorDeclaration declaration) {
+    var enclosingClass = _enclosingClass;
+    if (enclosingClass == null) {
+      return;
+    }
     // Count and check each redirecting initializer.
     var redirectingInitializerCount = 0;
     var superInitializerCount = 0;
@@ -1892,7 +1897,7 @@
           RedirectingConstructorInvocation invocation = initializer;
           var redirectingElement = invocation.staticElement;
           if (redirectingElement == null) {
-            String enclosingNamedType = _enclosingClass!.displayName;
+            String enclosingNamedType = enclosingClass.displayName;
             String constructorStrName = enclosingNamedType;
             if (invocation.constructorName != null) {
               constructorStrName += ".${invocation.constructorName!.name}";
@@ -1919,7 +1924,12 @@
         );
         redirectingInitializerCount++;
       } else if (initializer is SuperConstructorInvocation) {
-        if (superInitializerCount == 1) {
+        if (enclosingClass.isEnum) {
+          errorReporter.reportErrorForToken(
+            CompileTimeErrorCode.SUPER_IN_ENUM_CONSTRUCTOR,
+            initializer.superKeyword,
+          );
+        } else if (superInitializerCount == 1) {
           // Only report the second (first illegal) superinitializer.
           errorReporter.reportErrorForNode(
               CompileTimeErrorCode.MULTIPLE_SUPER_INITIALIZERS, initializer);
@@ -1933,9 +1943,11 @@
     if (redirectingInitializerCount > 0) {
       for (ConstructorInitializer initializer in declaration.initializers) {
         if (initializer is SuperConstructorInvocation) {
-          errorReporter.reportErrorForNode(
-              CompileTimeErrorCode.SUPER_IN_REDIRECTING_CONSTRUCTOR,
-              initializer);
+          if (!enclosingClass.isEnum) {
+            errorReporter.reportErrorForNode(
+                CompileTimeErrorCode.SUPER_IN_REDIRECTING_CONSTRUCTOR,
+                initializer);
+          }
         }
         if (initializer is ConstructorFieldInitializer) {
           errorReporter.reportErrorForNode(
@@ -1949,10 +1961,11 @@
         }
       }
     }
-    if (redirectingInitializerCount == 0 &&
+    if (!enclosingClass.isEnum &&
+        redirectingInitializerCount == 0 &&
         superInitializerCount == 1 &&
         superInitializer != declaration.initializers.last) {
-      var superNamedType = _enclosingClass!.supertype!.element.displayName;
+      var superNamedType = enclosingClass.supertype!.element.displayName;
       var constructorStrName = superNamedType;
       var constructorName = superInitializer.constructorName;
       if (constructorName != null) {
@@ -3537,6 +3550,17 @@
     return false;
   }
 
+  void _checkForNonConstGenerativeEnumConstructor(ConstructorDeclaration node) {
+    if (_enclosingClass?.isEnum == true &&
+        node.constKeyword == null &&
+        node.factoryKeyword == null) {
+      errorReporter.reportErrorForName(
+        CompileTimeErrorCode.NON_CONST_GENERATIVE_ENUM_CONSTRUCTOR,
+        node,
+      );
+    }
+  }
+
   /// Verify the given map [literal] either:
   /// * has `const modifier`
   /// * has explicit type arguments
diff --git a/pkg/analyzer/lib/src/summary2/element_builder.dart b/pkg/analyzer/lib/src/summary2/element_builder.dart
index 971a7f1..5764311 100644
--- a/pkg/analyzer/lib/src/summary2/element_builder.dart
+++ b/pkg/analyzer/lib/src/summary2/element_builder.dart
@@ -384,7 +384,7 @@
     element.methods = holder.methods;
     element.typeParameters = holder.typeParameters;
 
-    // TODO(scheglov) resolve field formals
+    _resolveConstructorFieldFormals(element);
   }
 
   @override
@@ -1115,9 +1115,6 @@
     _withEnclosing(holder, () {
       _visitPropertyFirst<FieldDeclaration>(node.members);
     });
-    element.accessors = holder.propertyAccessors;
-    element.fields = holder.properties.whereType<FieldElement>().toList();
-    element.methods = holder.methods;
 
     if (holder.constructors.isEmpty) {
       holder.addConstructor(
@@ -1125,18 +1122,12 @@
       );
     }
 
-    var constructors = holder.constructors;
-    element.constructors = constructors;
+    element.accessors = holder.propertyAccessors;
+    element.constructors = holder.constructors;
+    element.fields = holder.properties.whereType<FieldElement>().toList();
+    element.methods = holder.methods;
 
-    // We have all fields and constructors.
-    // Now we can resolve field formal parameters.
-    for (var constructor in constructors) {
-      for (var parameter in constructor.parameters) {
-        if (parameter is FieldFormalParameterElementImpl) {
-          parameter.field = element.getField(parameter.name);
-        }
-      }
-    }
+    _resolveConstructorFieldFormals(element);
   }
 
   void _buildExecutableElementChildren({
@@ -1202,6 +1193,16 @@
     node?.accept(this);
   }
 
+  void _resolveConstructorFieldFormals(AbstractClassElementImpl element) {
+    for (var constructor in element.constructors) {
+      for (var parameter in constructor.parameters) {
+        if (parameter is FieldFormalParameterElementImpl) {
+          parameter.field = element.getField(parameter.name);
+        }
+      }
+    }
+  }
+
   Uri? _selectAbsoluteUri(NamespaceDirective directive) {
     var relativeUriStr = _selectRelativeUri(
       directive.configurations,
diff --git a/pkg/analyzer/lib/src/summary2/top_level_inference.dart b/pkg/analyzer/lib/src/summary2/top_level_inference.dart
index 004c65b..993aa69 100644
--- a/pkg/analyzer/lib/src/summary2/top_level_inference.dart
+++ b/pkg/analyzer/lib/src/summary2/top_level_inference.dart
@@ -351,6 +351,7 @@
         _unitElement = unit as CompilationUnitElementImpl;
         unit.classes.forEach(_addClassConstructorFieldFormals);
         unit.classes.forEach(_addClassElementFields);
+        unit.enums.forEach(_addClassConstructorFieldFormals);
         unit.enums.forEach(_addClassElementFields);
         unit.extensions.forEach(_addExtensionElementFields);
         unit.mixins.forEach(_addClassElementFields);
diff --git a/pkg/analyzer/messages.yaml b/pkg/analyzer/messages.yaml
index d791d4c..c45122e 100644
--- a/pkg/analyzer/messages.yaml
+++ b/pkg/analyzer/messages.yaml
@@ -1551,6 +1551,9 @@
     comment: |-
       Parameters:
       0: the name of the member
+  NON_CONST_GENERATIVE_ENUM_CONSTRUCTOR:
+    problemMessage: Generative enum constructors must be 'const'.
+    correctionMessage: Try adding the keyword 'const'.
   NON_CONSTANT_MAP_KEY_FROM_DEFERRED_LIBRARY:
     sharedName: COLLECTION_ELEMENT_FROM_DEFERRED_LIBRARY
     problemMessage: "Constant values from a deferred library can't be used as keys in a 'const' map literal."
@@ -11371,6 +11374,9 @@
         B(int x) : assert(x >= 0), super(x);
       }
       ```
+  SUPER_IN_ENUM_CONSTRUCTOR:
+    problemMessage: The enum constructor can't have a 'super' initializer.
+    correctionMessage: Try removing the 'super' invocation.
   SUPER_IN_EXTENSION:
     problemMessage: "The 'super' keyword can't be used in an extension because an extension doesn't have a superclass."
     hasPublishedDocs: true
diff --git a/pkg/analyzer/test/src/dart/resolution/field_formal_parameter_test.dart b/pkg/analyzer/test/src/dart/resolution/field_formal_parameter_test.dart
index b0070ea..0adbdc7 100644
--- a/pkg/analyzer/test/src/dart/resolution/field_formal_parameter_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/field_formal_parameter_test.dart
@@ -16,7 +16,7 @@
 class FieldFormalParameterResolutionTest extends PubPackageResolutionTest {
   /// There was a crash.
   /// https://github.com/dart-lang/sdk/issues/46968
-  test_hasTypeParameters() async {
+  test_class_hasTypeParameters() async {
     await assertNoErrorsInCode(r'''
 class A {
   T Function<T>(T) f;
@@ -24,4 +24,19 @@
 }
 ''');
   }
+
+  test_enum() async {
+    await assertNoErrorsInCode(r'''
+enum E {
+  v;
+  final int f;
+  const E(this.f);
+}
+''');
+
+    assertFieldFormalParameter(
+      findNode.fieldFormalParameter('this.f'),
+      element: findElement.fieldFormalParameter('f'),
+    );
+  }
 }
diff --git a/pkg/analyzer/test/src/dart/resolution/resolution.dart b/pkg/analyzer/test/src/dart/resolution/resolution.dart
index 71d4a5a..ee209b2 100644
--- a/pkg/analyzer/test/src/dart/resolution/resolution.dart
+++ b/pkg/analyzer/test/src/dart/resolution/resolution.dart
@@ -370,6 +370,13 @@
     assertElementTypes(node.typeArgumentTypes, typeArgumentTypes);
   }
 
+  void assertFieldFormalParameter(
+    FieldFormalParameter node, {
+    required FieldFormalParameterElement element,
+  }) {
+    assertElement(node.declaredElement, element);
+  }
+
   void assertFunctionExpressionInvocation(
     FunctionExpressionInvocation node, {
     required ExecutableElement? element,
diff --git a/pkg/analyzer/test/src/diagnostics/assert_in_redirecting_constructor_test.dart b/pkg/analyzer/test/src/diagnostics/assert_in_redirecting_constructor_test.dart
index 9b3c6ea..a41afd4 100644
--- a/pkg/analyzer/test/src/diagnostics/assert_in_redirecting_constructor_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/assert_in_redirecting_constructor_test.dart
@@ -15,7 +15,7 @@
 
 @reflectiveTest
 class AssertInRedirectingConstructorTest extends PubPackageResolutionTest {
-  test_assertBeforeRedirection() async {
+  test_class_assertBeforeRedirection() async {
     await assertErrorsInCode(r'''
 class A {}
 class B {
@@ -25,7 +25,7 @@
 ''', [error(CompileTimeErrorCode.ASSERT_IN_REDIRECTING_CONSTRUCTOR, 34, 13)]);
   }
 
-  test_justAssert() async {
+  test_class_justAssert() async {
     await assertNoErrorsInCode(r'''
 class A {}
 class B {
@@ -35,7 +35,7 @@
 ''');
   }
 
-  test_justRedirection() async {
+  test_class_justRedirection() async {
     await assertNoErrorsInCode(r'''
 class A {}
 class B {
@@ -45,7 +45,7 @@
 ''');
   }
 
-  test_redirectionBeforeAssert() async {
+  test_class_redirectionBeforeAssert() async {
     await assertErrorsInCode(r'''
 class A {}
 class B {
@@ -54,4 +54,43 @@
 }
 ''', [error(CompileTimeErrorCode.ASSERT_IN_REDIRECTING_CONSTRUCTOR, 47, 13)]);
   }
+
+  test_enum_assertBeforeRedirection() async {
+    await assertErrorsInCode(r'''
+enum E {
+  v;
+  const E(int x) : assert(x > 0), this.name();
+  const E.name();
+}
+''', [error(CompileTimeErrorCode.ASSERT_IN_REDIRECTING_CONSTRUCTOR, 33, 13)]);
+  }
+
+  test_enum_justAssert() async {
+    await assertNoErrorsInCode(r'''
+enum E {
+  v;
+  const E(int x) : assert(x > 0);
+}
+''');
+  }
+
+  test_enum_justRedirection() async {
+    await assertNoErrorsInCode(r'''
+enum E {
+  v;
+  const E(int x) : this.name();
+  const E.name();
+}
+''');
+  }
+
+  test_enum_redirectionBeforeAssert() async {
+    await assertErrorsInCode(r'''
+enum E {
+  v;
+  const E(int x) : this.name(), assert(x > 0);
+  const E.name();
+}
+''', [error(CompileTimeErrorCode.ASSERT_IN_REDIRECTING_CONSTRUCTOR, 46, 13)]);
+  }
 }
diff --git a/pkg/analyzer/test/src/diagnostics/field_initializer_redirecting_constructor_test.dart b/pkg/analyzer/test/src/diagnostics/field_initializer_redirecting_constructor_test.dart
index 0ac15d2..7610d43 100644
--- a/pkg/analyzer/test/src/diagnostics/field_initializer_redirecting_constructor_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/field_initializer_redirecting_constructor_test.dart
@@ -16,7 +16,7 @@
 @reflectiveTest
 class FieldInitializerRedirectingConstructorTest
     extends PubPackageResolutionTest {
-  test_afterRedirection() async {
+  test_class_afterRedirection() async {
     await assertErrorsInCode(r'''
 class A {
   int x = 0;
@@ -29,7 +29,7 @@
     ]);
   }
 
-  test_beforeRedirection() async {
+  test_class_beforeRedirection() async {
     await assertErrorsInCode(r'''
 class A {
   int x = 0;
@@ -42,7 +42,7 @@
     ]);
   }
 
-  test_redirectionOnly() async {
+  test_class_redirectionOnly() async {
     await assertErrorsInCode(r'''
 class A {
   int x = 0;
@@ -54,4 +54,46 @@
           6),
     ]);
   }
+
+  test_enum_afterRedirection() async {
+    await assertErrorsInCode(r'''
+enum E {
+  v;
+  final int x;
+  const E.named();
+  const E() : this.named(), x = 42;
+}
+''', [
+      error(CompileTimeErrorCode.FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR, 76,
+          6),
+    ]);
+  }
+
+  test_enum_beforeRedirection() async {
+    await assertErrorsInCode(r'''
+enum E {
+  v;
+  final int x;
+  const E.named();
+  const E() : x = 42, this.named();
+}
+''', [
+      error(CompileTimeErrorCode.FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR, 62,
+          6),
+    ]);
+  }
+
+  test_enum_redirectionOnly() async {
+    await assertErrorsInCode(r'''
+enum E {
+  v;
+  final int x;
+  const E.named();
+  const E(this.x) : this.named();
+}
+''', [
+      error(CompileTimeErrorCode.FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR, 58,
+          6),
+    ]);
+  }
 }
diff --git a/pkg/analyzer/test/src/diagnostics/initializing_formal_for_non_existent_field_test.dart b/pkg/analyzer/test/src/diagnostics/initializing_formal_for_non_existent_field_test.dart
index 755e118..78509a6 100644
--- a/pkg/analyzer/test/src/diagnostics/initializing_formal_for_non_existent_field_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/initializing_formal_for_non_existent_field_test.dart
@@ -16,7 +16,7 @@
 @reflectiveTest
 class InitializingFormalForNonExistentFieldTest
     extends PubPackageResolutionTest {
-  test_nonExistent() async {
+  test_class_nonExistent() async {
     await assertErrorsInCode(r'''
 class A {
   A(this.x) {}
@@ -27,7 +27,7 @@
     ]);
   }
 
-  test_notInEnclosingClass() async {
+  test_class_notInEnclosingClass() async {
     await assertErrorsInCode(r'''
 class A {
   int x = 1;
@@ -41,7 +41,7 @@
     ]);
   }
 
-  test_optional() async {
+  test_class_optional() async {
     await assertErrorsInCode(r'''
 class A {
   A([this.x]) {}
@@ -52,7 +52,7 @@
     ]);
   }
 
-  test_synthetic() async {
+  test_class_synthetic() async {
     await assertErrorsInCode(r'''
 class A {
   int get x => 1;
@@ -63,4 +63,51 @@
           6),
     ]);
   }
+
+  test_enum_existing() async {
+    await assertNoErrorsInCode(r'''
+enum E {
+  v(0);
+  final int x;
+  const E(this.x);
+}
+''');
+  }
+
+  test_enum_optional() async {
+    await assertErrorsInCode(r'''
+enum E {
+  v;
+  const E([this.x]);
+}
+''', [
+      error(CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD, 25,
+          6),
+    ]);
+  }
+
+  test_enum_required() async {
+    await assertErrorsInCode(r'''
+enum E {
+  v(0);
+  const E(this.x);
+}
+''', [
+      error(CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD, 27,
+          6),
+    ]);
+  }
+
+  test_enum_synthetic() async {
+    await assertErrorsInCode(r'''
+enum E {
+  v;
+  const E(this.x);
+  int get x => 1;
+}
+''', [
+      error(CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD, 24,
+          6),
+    ]);
+  }
 }
diff --git a/pkg/analyzer/test/src/diagnostics/multiple_redirecting_constructor_invocations_test.dart b/pkg/analyzer/test/src/diagnostics/multiple_redirecting_constructor_invocations_test.dart
index 293caf5..7bc51a3 100644
--- a/pkg/analyzer/test/src/diagnostics/multiple_redirecting_constructor_invocations_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/multiple_redirecting_constructor_invocations_test.dart
@@ -16,7 +16,7 @@
 @reflectiveTest
 class MultipleRedirectingConstructorInvocationsTest
     extends PubPackageResolutionTest {
-  test_twoNamedConstructorInvocations() async {
+  test_class_twoNamed() async {
     await assertErrorsInCode(r'''
 class A {
   A() : this.a(), this.b();
@@ -28,4 +28,18 @@
           28, 8),
     ]);
   }
+
+  test_enum_twoNamed() async {
+    await assertErrorsInCode(r'''
+enum E {
+  v;
+  const E() : this.foo(), this.bar();
+  const E.foo();
+  const E.bar();
+}
+''', [
+      error(CompileTimeErrorCode.MULTIPLE_REDIRECTING_CONSTRUCTOR_INVOCATIONS,
+          40, 10),
+    ]);
+  }
 }
diff --git a/pkg/analyzer/test/src/diagnostics/non_const_generative_enum_constructor_test.dart b/pkg/analyzer/test/src/diagnostics/non_const_generative_enum_constructor_test.dart
new file mode 100644
index 0000000..0494484
--- /dev/null
+++ b/pkg/analyzer/test/src/diagnostics/non_const_generative_enum_constructor_test.dart
@@ -0,0 +1,57 @@
+// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:analyzer/src/error/codes.dart';
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+import '../dart/resolution/context_collection_resolution.dart';
+
+main() {
+  defineReflectiveSuite(() {
+    defineReflectiveTests(NonConstGenerativeEnumConstructorTest);
+  });
+}
+
+@reflectiveTest
+class NonConstGenerativeEnumConstructorTest extends PubPackageResolutionTest {
+  test_factory() async {
+    await assertNoErrorsInCode(r'''
+enum E {
+  v;
+  factory E(int i) => values[i];
+}
+''');
+  }
+
+  test_generative_const() async {
+    await assertNoErrorsInCode(r'''
+enum E {
+  v;
+  const E();
+}
+''');
+  }
+
+  test_generative_nonConst_named() async {
+    await assertErrorsInCode(r'''
+enum E {
+  v;
+  E.named();
+}
+''', [
+      error(CompileTimeErrorCode.NON_CONST_GENERATIVE_ENUM_CONSTRUCTOR, 16, 7),
+    ]);
+  }
+
+  test_generative_nonConst_unnamed() async {
+    await assertErrorsInCode(r'''
+enum E {
+  v;
+  E();
+}
+''', [
+      error(CompileTimeErrorCode.NON_CONST_GENERATIVE_ENUM_CONSTRUCTOR, 16, 1),
+    ]);
+  }
+}
diff --git a/pkg/analyzer/test/src/diagnostics/redirect_generative_to_missing_constructor_test.dart b/pkg/analyzer/test/src/diagnostics/redirect_generative_to_missing_constructor_test.dart
index 14a4018..75e2fc7 100644
--- a/pkg/analyzer/test/src/diagnostics/redirect_generative_to_missing_constructor_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/redirect_generative_to_missing_constructor_test.dart
@@ -16,7 +16,7 @@
 @reflectiveTest
 class RedirectGenerativeToNonGenerativeConstructorTest
     extends PubPackageResolutionTest {
-  test_missing() async {
+  test_class_missing() async {
     await assertErrorsInCode(r'''
 class A {
   A() : this.noSuchConstructor();
@@ -26,4 +26,16 @@
           24),
     ]);
   }
+
+  test_enum_missing() async {
+    await assertErrorsInCode(r'''
+enum E {
+  v;
+  const E() : this.noSuchConstructor();
+}
+''', [
+      error(CompileTimeErrorCode.REDIRECT_GENERATIVE_TO_MISSING_CONSTRUCTOR, 28,
+          24),
+    ]);
+  }
 }
diff --git a/pkg/analyzer/test/src/diagnostics/super_in_enum_constructor_test.dart b/pkg/analyzer/test/src/diagnostics/super_in_enum_constructor_test.dart
new file mode 100644
index 0000000..6823298
--- /dev/null
+++ b/pkg/analyzer/test/src/diagnostics/super_in_enum_constructor_test.dart
@@ -0,0 +1,52 @@
+// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:analyzer/src/error/codes.dart';
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+import '../dart/resolution/context_collection_resolution.dart';
+
+main() {
+  defineReflectiveSuite(() {
+    defineReflectiveTests(SuperInEnumConstructorTest);
+  });
+}
+
+@reflectiveTest
+class SuperInEnumConstructorTest extends PubPackageResolutionTest {
+  test_hasRedirect() async {
+    await assertErrorsInCode(r'''
+enum E {
+  v;
+  const E.named();
+  const E() : this.named(), super();
+}
+''', [
+      error(CompileTimeErrorCode.SUPER_IN_ENUM_CONSTRUCTOR, 61, 5),
+    ]);
+  }
+
+  test_one() async {
+    await assertErrorsInCode(r'''
+enum E {
+  v;
+  const E() : super();
+}
+''', [
+      error(CompileTimeErrorCode.SUPER_IN_ENUM_CONSTRUCTOR, 28, 5),
+    ]);
+  }
+
+  test_two() async {
+    await assertErrorsInCode(r'''
+enum E {
+  v;
+  const E() : super(), super();
+}
+''', [
+      error(CompileTimeErrorCode.SUPER_IN_ENUM_CONSTRUCTOR, 28, 5),
+      error(CompileTimeErrorCode.SUPER_IN_ENUM_CONSTRUCTOR, 37, 5),
+    ]);
+  }
+}
diff --git a/pkg/analyzer/test/src/diagnostics/test_all.dart b/pkg/analyzer/test/src/diagnostics/test_all.dart
index 40513d8..21cd92f 100644
--- a/pkg/analyzer/test/src/diagnostics/test_all.dart
+++ b/pkg/analyzer/test/src/diagnostics/test_all.dart
@@ -473,6 +473,8 @@
 import 'non_bool_operand_test.dart' as non_bool_operand;
 import 'non_const_call_to_literal_constructor_test.dart'
     as non_const_call_to_literal_constructor;
+import 'non_const_generative_enum_constructor_test.dart'
+    as non_const_generative_enum_constructor;
 import 'non_const_map_as_expression_statement_test.dart'
     as non_const_map_as_expression_statement;
 import 'non_constant_annotation_constructor_test.dart'
@@ -643,6 +645,7 @@
     as super_formal_parameter_without_associated_named;
 import 'super_formal_parameter_without_associated_positional_test.dart'
     as super_formal_parameter_without_associated_positional;
+import 'super_in_enum_constructor_test.dart' as super_in_enum_constructor;
 import 'super_in_extension_test.dart' as super_in_extension;
 import 'super_in_invalid_context_test.dart' as super_in_invalid_context;
 import 'super_in_redirecting_constructor_test.dart'
@@ -1054,6 +1057,7 @@
     non_bool_negation_expression.main();
     non_bool_operand.main();
     non_const_call_to_literal_constructor.main();
+    non_const_generative_enum_constructor.main();
     non_const_map_as_expression_statement.main();
     non_constant_annotation_constructor.main();
     non_constant_list_element.main();
@@ -1166,6 +1170,7 @@
     super_formal_parameter_type_is_not_subtype_of_associated.main();
     super_formal_parameter_without_associated_named.main();
     super_formal_parameter_without_associated_positional.main();
+    super_in_enum_constructor.main();
     super_in_extension.main();
     super_in_invalid_context.main();
     super_in_redirecting_constructor.main();
diff --git a/pkg/analyzer/test/src/summary/resynthesize_common.dart b/pkg/analyzer/test/src/summary/resynthesize_common.dart
index d171c1a..84c2a4a 100644
--- a/pkg/analyzer/test/src/summary/resynthesize_common.dart
+++ b/pkg/analyzer/test/src/summary/resynthesize_common.dart
@@ -17702,6 +17702,447 @@
 ''');
   }
 
+  test_enum_constructor_fieldFormal_functionTyped_withReturnType() async {
+    var library = await checkLibrary(r'''
+enum E {
+  v;
+  final x;
+  const E(int this.x(double a));
+}
+''');
+    checkElementText(library, r'''
+library
+  definingUnit
+    enums
+      enum E @5
+        supertype: Enum
+        fields
+          static const enumConstant v @11
+            type: E
+            constantInitializer
+              InstanceCreationExpression
+                argumentList: ArgumentList
+                  leftParenthesis: ( @0
+                  rightParenthesis: ) @0
+                constructorName: ConstructorName
+                  name: SimpleIdentifier
+                    staticElement: self::@enum::E::@constructor::•
+                    staticType: null
+                    token:  @-1
+                  period: . @0
+                  staticElement: self::@enum::E::@constructor::•
+                  type: NamedType
+                    name: SimpleIdentifier
+                      staticElement: self::@enum::E
+                      staticType: null
+                      token: E @-1
+                    type: E
+                staticType: E
+          synthetic static const values @-1
+            type: List<E>
+            constantInitializer
+              ListLiteral
+                elements
+                  SimpleIdentifier
+                    staticElement: self::@enum::E::@getter::v
+                    staticType: E
+                    token: v @-1
+                leftBracket: [ @0
+                rightBracket: ] @0
+                staticType: List<E>
+          synthetic final index @-1
+            type: int
+          final x @22
+            type: dynamic
+        constructors
+          const @33
+            parameters
+              requiredPositional final this.x @44
+                type: int Function(double)
+                parameters
+                  requiredPositional a @53
+                    type: double
+                field: self::@enum::E::@field::x
+        accessors
+          synthetic static get v @-1
+            returnType: E
+          synthetic static get values @-1
+            returnType: List<E>
+          synthetic get index @-1
+            returnType: int
+          synthetic get x @-1
+            returnType: dynamic
+        methods
+          synthetic toString @-1
+            returnType: String
+''');
+  }
+
+  test_enum_constructor_fieldFormal_multiple_matching_fields() async {
+    var library = await checkLibrary('''
+enum E {
+  v;
+  final int x;
+  final String x;
+  const E(this.x);
+}
+''');
+    checkElementText(library, r'''
+library
+  definingUnit
+    enums
+      enum E @5
+        supertype: Enum
+        fields
+          static const enumConstant v @11
+            type: E
+            constantInitializer
+              InstanceCreationExpression
+                argumentList: ArgumentList
+                  leftParenthesis: ( @0
+                  rightParenthesis: ) @0
+                constructorName: ConstructorName
+                  name: SimpleIdentifier
+                    staticElement: self::@enum::E::@constructor::•
+                    staticType: null
+                    token:  @-1
+                  period: . @0
+                  staticElement: self::@enum::E::@constructor::•
+                  type: NamedType
+                    name: SimpleIdentifier
+                      staticElement: self::@enum::E
+                      staticType: null
+                      token: E @-1
+                    type: E
+                staticType: E
+          synthetic static const values @-1
+            type: List<E>
+            constantInitializer
+              ListLiteral
+                elements
+                  SimpleIdentifier
+                    staticElement: self::@enum::E::@getter::v
+                    staticType: E
+                    token: v @-1
+                leftBracket: [ @0
+                rightBracket: ] @0
+                staticType: List<E>
+          synthetic final index @-1
+            type: int
+          final x @26
+            type: int
+          final x @44
+            type: String
+        constructors
+          const @55
+            parameters
+              requiredPositional final this.x @62
+                type: int
+                field: self::@enum::E::@field::x
+        accessors
+          synthetic static get v @-1
+            returnType: E
+          synthetic static get values @-1
+            returnType: List<E>
+          synthetic get index @-1
+            returnType: int
+          synthetic get x @-1
+            returnType: int
+          synthetic get x @-1
+            returnType: String
+        methods
+          synthetic toString @-1
+            returnType: String
+''');
+  }
+
+  test_enum_constructor_fieldFormal_no_matching_field() async {
+    var library = await checkLibrary('''
+enum E {
+  v;
+  const E(this.x);
+}
+''');
+    checkElementText(library, r'''
+library
+  definingUnit
+    enums
+      enum E @5
+        supertype: Enum
+        fields
+          static const enumConstant v @11
+            type: E
+            constantInitializer
+              InstanceCreationExpression
+                argumentList: ArgumentList
+                  leftParenthesis: ( @0
+                  rightParenthesis: ) @0
+                constructorName: ConstructorName
+                  name: SimpleIdentifier
+                    staticElement: self::@enum::E::@constructor::•
+                    staticType: null
+                    token:  @-1
+                  period: . @0
+                  staticElement: self::@enum::E::@constructor::•
+                  type: NamedType
+                    name: SimpleIdentifier
+                      staticElement: self::@enum::E
+                      staticType: null
+                      token: E @-1
+                    type: E
+                staticType: E
+          synthetic static const values @-1
+            type: List<E>
+            constantInitializer
+              ListLiteral
+                elements
+                  SimpleIdentifier
+                    staticElement: self::@enum::E::@getter::v
+                    staticType: E
+                    token: v @-1
+                leftBracket: [ @0
+                rightBracket: ] @0
+                staticType: List<E>
+          synthetic final index @-1
+            type: int
+        constructors
+          const @22
+            parameters
+              requiredPositional final this.x @29
+                type: dynamic
+                field: <null>
+        accessors
+          synthetic static get v @-1
+            returnType: E
+          synthetic static get values @-1
+            returnType: List<E>
+          synthetic get index @-1
+            returnType: int
+        methods
+          synthetic toString @-1
+            returnType: String
+''');
+  }
+
+  test_enum_constructor_fieldFormal_typed_typed() async {
+    var library = await checkLibrary('''
+enum E {
+  v;
+  final num x;
+  const E(int this.x);
+}
+''');
+    checkElementText(library, r'''
+library
+  definingUnit
+    enums
+      enum E @5
+        supertype: Enum
+        fields
+          static const enumConstant v @11
+            type: E
+            constantInitializer
+              InstanceCreationExpression
+                argumentList: ArgumentList
+                  leftParenthesis: ( @0
+                  rightParenthesis: ) @0
+                constructorName: ConstructorName
+                  name: SimpleIdentifier
+                    staticElement: self::@enum::E::@constructor::•
+                    staticType: null
+                    token:  @-1
+                  period: . @0
+                  staticElement: self::@enum::E::@constructor::•
+                  type: NamedType
+                    name: SimpleIdentifier
+                      staticElement: self::@enum::E
+                      staticType: null
+                      token: E @-1
+                    type: E
+                staticType: E
+          synthetic static const values @-1
+            type: List<E>
+            constantInitializer
+              ListLiteral
+                elements
+                  SimpleIdentifier
+                    staticElement: self::@enum::E::@getter::v
+                    staticType: E
+                    token: v @-1
+                leftBracket: [ @0
+                rightBracket: ] @0
+                staticType: List<E>
+          synthetic final index @-1
+            type: int
+          final x @26
+            type: num
+        constructors
+          const @37
+            parameters
+              requiredPositional final this.x @48
+                type: int
+                field: self::@enum::E::@field::x
+        accessors
+          synthetic static get v @-1
+            returnType: E
+          synthetic static get values @-1
+            returnType: List<E>
+          synthetic get index @-1
+            returnType: int
+          synthetic get x @-1
+            returnType: num
+        methods
+          synthetic toString @-1
+            returnType: String
+''');
+  }
+
+  test_enum_constructor_fieldFormal_untyped_typed() async {
+    var library = await checkLibrary(r'''
+enum E {
+  v;
+  final x;
+  E(int this.x);
+}
+''');
+    checkElementText(library, r'''
+library
+  definingUnit
+    enums
+      enum E @5
+        supertype: Enum
+        fields
+          static const enumConstant v @11
+            type: E
+            constantInitializer
+              InstanceCreationExpression
+                argumentList: ArgumentList
+                  leftParenthesis: ( @0
+                  rightParenthesis: ) @0
+                constructorName: ConstructorName
+                  name: SimpleIdentifier
+                    staticElement: self::@enum::E::@constructor::•
+                    staticType: null
+                    token:  @-1
+                  period: . @0
+                  staticElement: self::@enum::E::@constructor::•
+                  type: NamedType
+                    name: SimpleIdentifier
+                      staticElement: self::@enum::E
+                      staticType: null
+                      token: E @-1
+                    type: E
+                staticType: E
+          synthetic static const values @-1
+            type: List<E>
+            constantInitializer
+              ListLiteral
+                elements
+                  SimpleIdentifier
+                    staticElement: self::@enum::E::@getter::v
+                    staticType: E
+                    token: v @-1
+                leftBracket: [ @0
+                rightBracket: ] @0
+                staticType: List<E>
+          synthetic final index @-1
+            type: int
+          final x @22
+            type: dynamic
+        constructors
+          @27
+            parameters
+              requiredPositional final this.x @38
+                type: int
+                field: self::@enum::E::@field::x
+        accessors
+          synthetic static get v @-1
+            returnType: E
+          synthetic static get values @-1
+            returnType: List<E>
+          synthetic get index @-1
+            returnType: int
+          synthetic get x @-1
+            returnType: dynamic
+        methods
+          synthetic toString @-1
+            returnType: String
+''');
+  }
+
+  test_enum_constructor_fieldFormal_untyped_untyped() async {
+    var library = await checkLibrary(r'''
+enum E {
+  v;
+  final x;
+  E(this.x);
+}
+''');
+    checkElementText(library, r'''
+library
+  definingUnit
+    enums
+      enum E @5
+        supertype: Enum
+        fields
+          static const enumConstant v @11
+            type: E
+            constantInitializer
+              InstanceCreationExpression
+                argumentList: ArgumentList
+                  leftParenthesis: ( @0
+                  rightParenthesis: ) @0
+                constructorName: ConstructorName
+                  name: SimpleIdentifier
+                    staticElement: self::@enum::E::@constructor::•
+                    staticType: null
+                    token:  @-1
+                  period: . @0
+                  staticElement: self::@enum::E::@constructor::•
+                  type: NamedType
+                    name: SimpleIdentifier
+                      staticElement: self::@enum::E
+                      staticType: null
+                      token: E @-1
+                    type: E
+                staticType: E
+          synthetic static const values @-1
+            type: List<E>
+            constantInitializer
+              ListLiteral
+                elements
+                  SimpleIdentifier
+                    staticElement: self::@enum::E::@getter::v
+                    staticType: E
+                    token: v @-1
+                leftBracket: [ @0
+                rightBracket: ] @0
+                staticType: List<E>
+          synthetic final index @-1
+            type: int
+          final x @22
+            type: dynamic
+        constructors
+          @27
+            parameters
+              requiredPositional final this.x @34
+                type: dynamic
+                field: self::@enum::E::@field::x
+        accessors
+          synthetic static get v @-1
+            returnType: E
+          synthetic static get values @-1
+            returnType: List<E>
+          synthetic get index @-1
+            returnType: int
+          synthetic get x @-1
+            returnType: dynamic
+        methods
+          synthetic toString @-1
+            returnType: String
+''');
+  }
+
   test_enum_constructor_named() async {
     var library = await checkLibrary(r'''
 enum E {
diff --git a/pkg/front_end/test/spell_checking_list_common.txt b/pkg/front_end/test/spell_checking_list_common.txt
index 6e70064..e442d51 100644
--- a/pkg/front_end/test/spell_checking_list_common.txt
+++ b/pkg/front_end/test/spell_checking_list_common.txt
@@ -2154,6 +2154,7 @@
 parsed
 parser
 parser's
+parsers
 parses
 parsing
 part
diff --git a/pkg/kernel/lib/target/targets.dart b/pkg/kernel/lib/target/targets.dart
index ea7721a..678cc33 100644
--- a/pkg/kernel/lib/target/targets.dart
+++ b/pkg/kernel/lib/target/targets.dart
@@ -557,6 +557,9 @@
   /// in JIT.
   DartLibrarySupport get dartLibrarySupport =>
       const DefaultDartLibrarySupport();
+
+  /// Should this target-specific pragma be recognized by annotation parsers?
+  bool isSupportedPragma(String pragmaName) => false;
 }
 
 class NoneConstantsBackend extends ConstantsBackend {
diff --git a/pkg/vm/lib/kernel_front_end.dart b/pkg/vm/lib/kernel_front_end.dart
index 74c8888..76a0f85 100644
--- a/pkg/vm/lib/kernel_front_end.dart
+++ b/pkg/vm/lib/kernel_front_end.dart
@@ -495,7 +495,7 @@
 
   // We don't know yet whether gen_snapshot will want to do obfuscation, but if
   // it does it will need the obfuscation prohibitions.
-  obfuscationProhibitions.transformComponent(component, coreTypes);
+  obfuscationProhibitions.transformComponent(component, coreTypes, target);
 
   deferred_loading.transformComponent(component);
 }
diff --git a/pkg/vm/lib/target/vm.dart b/pkg/vm/lib/target/vm.dart
index b1a60d8..79d5d64 100644
--- a/pkg/vm/lib/target/vm.dart
+++ b/pkg/vm/lib/target/vm.dart
@@ -508,4 +508,7 @@
   DartLibrarySupport get dartLibrarySupport => flags.supportMirrors
       ? const DefaultDartLibrarySupport()
       : const CustomizedDartLibrarySupport(unsupported: {'mirrors'});
+
+  @override
+  bool isSupportedPragma(String pragmaName) => pragmaName.startsWith("vm:");
 }
diff --git a/pkg/vm/lib/transformations/obfuscation_prohibitions_annotator.dart b/pkg/vm/lib/transformations/obfuscation_prohibitions_annotator.dart
index b4eeab7..6b5f9b2 100644
--- a/pkg/vm/lib/transformations/obfuscation_prohibitions_annotator.dart
+++ b/pkg/vm/lib/transformations/obfuscation_prohibitions_annotator.dart
@@ -6,15 +6,17 @@
 
 import 'package:kernel/ast.dart';
 import 'package:kernel/core_types.dart' show CoreTypes;
+import 'package:kernel/target/targets.dart' show Target;
 
 import '../metadata/obfuscation_prohibitions.dart';
 import 'pragma.dart';
 
-void transformComponent(Component component, CoreTypes coreTypes) {
+void transformComponent(
+    Component component, CoreTypes coreTypes, Target target) {
   final repo = new ObfuscationProhibitionsMetadataRepository();
   component.addMetadataRepository(repo);
-  final visitor =
-      ObfuscationProhibitionsVisitor(ConstantPragmaAnnotationParser(coreTypes));
+  final visitor = ObfuscationProhibitionsVisitor(
+      ConstantPragmaAnnotationParser(coreTypes, target));
   visitor.visitComponent(component);
   repo.mapping[component] = visitor.metadata;
 }
diff --git a/pkg/vm/lib/transformations/pragma.dart b/pkg/vm/lib/transformations/pragma.dart
index 2fabcf4..2b127e7 100644
--- a/pkg/vm/lib/transformations/pragma.dart
+++ b/pkg/vm/lib/transformations/pragma.dart
@@ -4,14 +4,20 @@
 
 import 'package:kernel/ast.dart';
 import 'package:kernel/core_types.dart' show CoreTypes;
+import 'package:kernel/target/targets.dart' show Target;
 
-const kEntryPointPragmaName = "vm:entry-point";
-const kExactResultTypePragmaName = "vm:exact-result-type";
-const kNonNullableResultType = "vm:non-nullable-result-type";
+// Pragmas recognized by the VM
+const kVmEntryPointPragmaName = "vm:entry-point";
+const kVmExactResultTypePragmaName = "vm:exact-result-type";
+const kVmNonNullableResultType = "vm:non-nullable-result-type";
 const kResultTypeUsesPassedTypeArguments =
     "result-type-uses-passed-type-arguments";
-const kRecognizedPragmaName = "vm:recognized";
-const kDisableUnboxedParametetersPragmaName = "vm:disable-unboxed-parameters";
+const kVmRecognizedPragmaName = "vm:recognized";
+const kVmDisableUnboxedParametetersPragmaName = "vm:disable-unboxed-parameters";
+
+// Pragmas recognized by dart2wasm
+const kWasmEntryPointPragmaName = "wasm:entry-point";
+const kWasmExportPragmaName = "wasm:export";
 
 abstract class ParsedPragma {}
 
@@ -57,8 +63,9 @@
 
 class ConstantPragmaAnnotationParser extends PragmaAnnotationParser {
   final CoreTypes coreTypes;
+  final Target target;
 
-  ConstantPragmaAnnotationParser(this.coreTypes);
+  ConstantPragmaAnnotationParser(this.coreTypes, this.target);
 
   ParsedPragma? parsePragma(Expression annotation) {
     InstanceConstant? pragmaConstant;
@@ -85,11 +92,13 @@
       return null;
     }
 
+    if (!target.isSupportedPragma(pragmaName)) return null;
+
     Constant options =
         pragmaConstant.fieldValues[coreTypes.pragmaOptions.fieldReference]!;
 
     switch (pragmaName) {
-      case kEntryPointPragmaName:
+      case kVmEntryPointPragmaName:
         PragmaEntryPointType? type;
         if (options is NullConstant) {
           type = PragmaEntryPointType.Default;
@@ -103,13 +112,14 @@
           } else if (options.value == "call") {
             type = PragmaEntryPointType.CallOnly;
           } else {
-            throw "Error: string directive to @pragma('$kEntryPointPragmaName', ...) "
+            throw "Error: string directive to "
+                "@pragma('$kVmEntryPointPragmaName', ...) "
                 "must be either 'get' or 'set' for fields "
                 "or 'get' or 'call' for procedures.";
           }
         }
         return type != null ? new ParsedEntryPointPragma(type) : null;
-      case kExactResultTypePragmaName:
+      case kVmExactResultTypePragmaName:
         if (options is TypeLiteralConstant) {
           return new ParsedResultTypeByTypePragma(options.type, false);
         } else if (options is StringConstant) {
@@ -123,11 +133,11 @@
           return new ParsedResultTypeByTypePragma(
               (options.entries[0] as TypeLiteralConstant).type, true);
         }
-        throw "ERROR: Unsupported option to '$kExactResultTypePragmaName' "
+        throw "ERROR: Unsupported option to '$kVmExactResultTypePragmaName' "
             "pragma: $options";
-      case kNonNullableResultType:
+      case kVmNonNullableResultType:
         return new ParsedNonNullableResultType();
-      case kRecognizedPragmaName:
+      case kVmRecognizedPragmaName:
         PragmaRecognizedType? type;
         if (options is StringConstant) {
           if (options.value == "asm-intrinsic") {
@@ -139,12 +149,17 @@
           }
         }
         if (type == null) {
-          throw "ERROR: Unsupported option to '$kRecognizedPragmaName' "
+          throw "ERROR: Unsupported option to '$kVmRecognizedPragmaName' "
               "pragma: $options";
         }
         return new ParsedRecognized(type);
-      case kDisableUnboxedParametetersPragmaName:
+      case kVmDisableUnboxedParametetersPragmaName:
         return new ParsedDisableUnboxedParameters();
+      case kWasmEntryPointPragmaName:
+        return ParsedEntryPointPragma(PragmaEntryPointType.Default);
+      case kWasmExportPragmaName:
+        // Exports are treated as called entry points.
+        return ParsedEntryPointPragma(PragmaEntryPointType.CallOnly);
       default:
         return null;
     }
diff --git a/pkg/vm/lib/transformations/type_flow/analysis.dart b/pkg/vm/lib/transformations/type_flow/analysis.dart
index 7cdec21..835dd32 100644
--- a/pkg/vm/lib/transformations/type_flow/analysis.dart
+++ b/pkg/vm/lib/transformations/type_flow/analysis.dart
@@ -1550,7 +1550,7 @@
       this.protobufHandler,
       PragmaAnnotationParser? matcher)
       : annotationMatcher =
-            matcher ?? new ConstantPragmaAnnotationParser(coreTypes) {
+            matcher ?? new ConstantPragmaAnnotationParser(coreTypes, target) {
     nativeCodeOracle = new NativeCodeOracle(libraryIndex, annotationMatcher);
     hierarchyCache = new _ClassHierarchyCache(this, hierarchy,
         _genericInterfacesInfo, environment, target.flags.enableNullSafety);
diff --git a/pkg/vm/lib/transformations/type_flow/native_code.dart b/pkg/vm/lib/transformations/type_flow/native_code.dart
index d41fa98..8b96b9a 100644
--- a/pkg/vm/lib/transformations/type_flow/native_code.dart
+++ b/pkg/vm/lib/transformations/type_flow/native_code.dart
@@ -237,7 +237,7 @@
         // libraries for safety reasons. See 'result_type_pragma.md', detail 1.2
         // for explanation.
         if (member.enclosingLibrary.importUri.scheme != "dart") {
-          throw "ERROR: Cannot use $kExactResultTypePragmaName "
+          throw "ERROR: Cannot use $kVmExactResultTypePragmaName "
               "outside core libraries.";
         }
       }
@@ -275,8 +275,9 @@
     }
 
     if (returnType != null && nullable != null) {
-      throw 'ERROR: Cannot have both, @pragma("$kExactResultTypePragmaName") '
-          'and @pragma("$kNonNullableResultType"), annotating the same member.';
+      throw 'ERROR: Cannot have both, @pragma("$kVmExactResultTypePragmaName") '
+          'and @pragma("$kVmNonNullableResultType"), '
+          'annotating the same member.';
     }
 
     if (returnType != null) {
diff --git a/pkg/vm/lib/transformations/type_flow/rta.dart b/pkg/vm/lib/transformations/type_flow/rta.dart
index df987e1..b6adfe4 100644
--- a/pkg/vm/lib/transformations/type_flow/rta.dart
+++ b/pkg/vm/lib/transformations/type_flow/rta.dart
@@ -10,6 +10,7 @@
 import 'package:kernel/class_hierarchy.dart' show ClassHierarchy;
 import 'package:kernel/library_index.dart' show LibraryIndex;
 import 'package:kernel/core_types.dart' show CoreTypes;
+import 'package:kernel/target/targets.dart' show Target;
 
 import 'calls.dart' as calls
     show Selector, DirectSelector, InterfaceSelector, VirtualSelector;
@@ -184,13 +185,13 @@
   final Set<Member> visited = {};
   final List<Member> workList = [];
 
-  RapidTypeAnalysis(Component component, this.coreTypes, this.hierarchy,
-      LibraryIndex libraryIndex, this.protobufHandler) {
+  RapidTypeAnalysis(Component component, this.coreTypes, Target target,
+      this.hierarchy, LibraryIndex libraryIndex, this.protobufHandler) {
     Procedure? main = component.mainMethod;
     if (main != null) {
       addMember(main);
     }
-    final annotationMatcher = ConstantPragmaAnnotationParser(coreTypes);
+    final annotationMatcher = ConstantPragmaAnnotationParser(coreTypes, target);
     final nativeCodeOracle = NativeCodeOracle(libraryIndex, annotationMatcher);
     component.accept(PragmaEntryPointsVisitor(
         _EntryPointsListenerImpl(this), nativeCodeOracle, annotationMatcher));
diff --git a/pkg/vm/lib/transformations/type_flow/signature_shaking.dart b/pkg/vm/lib/transformations/type_flow/signature_shaking.dart
index 7ec6ff9..b4d7687 100644
--- a/pkg/vm/lib/transformations/type_flow/signature_shaking.dart
+++ b/pkg/vm/lib/transformations/type_flow/signature_shaking.dart
@@ -4,7 +4,6 @@
 
 import 'package:kernel/ast.dart';
 import 'package:kernel/core_types.dart';
-import 'package:kernel/external_name.dart';
 import 'package:kernel/type_environment.dart';
 
 import 'analysis.dart';
@@ -236,7 +235,7 @@
         shaker.typeFlowAnalysis.nativeCodeOracle
             .isMemberReferencedFromNativeCode(member) ||
         shaker.typeFlowAnalysis.nativeCodeOracle.isRecognized(member) ||
-        getExternalName(coreTypes, member) != null ||
+        member.isExternal ||
         member.name.text == '==') {
       info.eligible = false;
     }
diff --git a/pkg/vm/lib/transformations/type_flow/transformer.dart b/pkg/vm/lib/transformations/type_flow/transformer.dart
index 6533e54..02cab5e 100644
--- a/pkg/vm/lib/transformations/type_flow/transformer.dart
+++ b/pkg/vm/lib/transformations/type_flow/transformer.dart
@@ -74,8 +74,8 @@
     final protobufHandlerRta = treeShakeProtobufs
         ? ProtobufHandler.forComponent(component, coreTypes)
         : null;
-    rta = RapidTypeAnalysis(
-        component, coreTypes, hierarchy, libraryIndex, protobufHandlerRta);
+    rta = RapidTypeAnalysis(component, coreTypes, target, hierarchy,
+        libraryIndex, protobufHandlerRta);
     rtaStopWatch.stop();
   }
 
diff --git a/pkg/vm/test/transformations/type_flow/summary_collector_test.dart b/pkg/vm/test/transformations/type_flow/summary_collector_test.dart
index 09831bd8..7c96cf3 100644
--- a/pkg/vm/test/transformations/type_flow/summary_collector_test.dart
+++ b/pkg/vm/test/transformations/type_flow/summary_collector_test.dart
@@ -74,8 +74,8 @@
         hierarchy,
         new FakeEntryPointsListener(typesBuilder),
         typesBuilder,
-        new NativeCodeOracle(
-            coreTypes.index, new ConstantPragmaAnnotationParser(coreTypes)),
+        new NativeCodeOracle(coreTypes.index,
+            new ConstantPragmaAnnotationParser(coreTypes, target)),
         new GenericInterfacesInfoImpl(coreTypes, hierarchy),
         /*_protobufHandler=*/ null);
   }
diff --git a/pkg/vm/test/transformations/type_flow/transformer_test.dart b/pkg/vm/test/transformations/type_flow/transformer_test.dart
index f52fb1f..a719a03 100644
--- a/pkg/vm/test/transformations/type_flow/transformer_test.dart
+++ b/pkg/vm/test/transformations/type_flow/transformer_test.dart
@@ -29,7 +29,7 @@
   final coreTypes = new CoreTypes(component);
 
   component = transformComponent(target, coreTypes, component,
-      matcher: new ConstantPragmaAnnotationParser(coreTypes),
+      matcher: new ConstantPragmaAnnotationParser(coreTypes, target),
       treeShakeProtobufs: true);
 
   String actual = kernelLibraryToString(component.mainMethod!.enclosingLibrary);
diff --git a/sdk/lib/_internal/js_dev_runtime/patch/collection_patch.dart b/sdk/lib/_internal/js_dev_runtime/patch/collection_patch.dart
index 41ac9d6..2464057 100644
--- a/sdk/lib/_internal/js_dev_runtime/patch/collection_patch.dart
+++ b/sdk/lib/_internal/js_dev_runtime/patch/collection_patch.dart
@@ -181,7 +181,7 @@
         dart.identityEquals)) {
       @notNull
       Object? k = key;
-      var buckets = JS('', '#.get(# & 0x3ffffff)', _keyMap, k.hashCode);
+      var buckets = JS('', '#.get(# & 0x3fffffff)', _keyMap, k.hashCode);
       if (buckets != null) {
         for (int i = 0, n = JS('!', '#.length', buckets); i < n; i++) {
           k = JS('', '#[#]', buckets, i);
@@ -199,7 +199,7 @@
         dart.identityEquals)) {
       @notNull
       Object? k = key;
-      var buckets = JS('', '#.get(# & 0x3ffffff)', _keyMap, k.hashCode);
+      var buckets = JS('', '#.get(# & 0x3fffffff)', _keyMap, k.hashCode);
       if (buckets != null) {
         for (int i = 0, n = JS('!', '#.length', buckets); i < n; i++) {
           k = JS('', '#[#]', buckets, i);
@@ -222,7 +222,7 @@
       var keyMap = _keyMap;
       @notNull
       var k = key;
-      int hash = JS('!', '# & 0x3ffffff', k.hashCode);
+      int hash = JS('!', '# & 0x3fffffff', k.hashCode);
       var buckets = JS('', '#.get(#)', keyMap, hash);
       if (buckets == null) {
         JS('', '#.set(#, [#])', keyMap, hash, key);
@@ -237,7 +237,7 @@
       return false;
     }
     JS('', '#.add(#)', map, key);
-    _modifications = (_modifications + 1) & 0x3ffffff;
+    _modifications = (_modifications + 1) & 0x3fffffff;
     return true;
   }
 
@@ -255,7 +255,7 @@
       JS('', '#.add(#)', map, key);
     }
     if (length != JS<int>('!', '#.size', map)) {
-      _modifications = (_modifications + 1) & 0x3ffffff;
+      _modifications = (_modifications + 1) & 0x3fffffff;
     }
   }
 
@@ -267,7 +267,7 @@
         dart.identityEquals)) {
       @notNull
       Object? k = key;
-      int hash = JS('!', '# & 0x3ffffff', k.hashCode);
+      int hash = JS('!', '# & 0x3fffffff', k.hashCode);
       var buckets = JS('', '#.get(#)', _keyMap, hash);
       if (buckets == null) return false; // not found
       for (int i = 0, n = JS('!', '#.length', buckets);;) {
@@ -286,7 +286,7 @@
     }
     var map = _map;
     if (JS<bool>('!', '#.delete(#)', map, key)) {
-      _modifications = (_modifications + 1) & 0x3ffffff;
+      _modifications = (_modifications + 1) & 0x3fffffff;
       return true;
     }
     return false;
@@ -297,7 +297,7 @@
     if (JS<int>('!', '#.size', map) > 0) {
       JS('', '#.clear()', map);
       JS('', '#.clear()', _keyMap);
-      _modifications = (_modifications + 1) & 0x3ffffff;
+      _modifications = (_modifications + 1) & 0x3fffffff;
     }
   }
 }
@@ -356,7 +356,7 @@
     var map = _map;
     if (JS<bool>('!', '#.has(#)', map, element)) return false;
     JS('', '#.add(#)', map, element);
-    _modifications = (_modifications + 1) & 0x3ffffff;
+    _modifications = (_modifications + 1) & 0x3fffffff;
     return true;
   }
 
@@ -367,13 +367,13 @@
       JS('', '#.add(#)', map, key);
     }
     if (length != JS<int>('!', '#.size', map)) {
-      _modifications = (_modifications + 1) & 0x3ffffff;
+      _modifications = (_modifications + 1) & 0x3fffffff;
     }
   }
 
   bool remove(Object? element) {
     if (JS<bool>('!', '#.delete(#)', _map, element)) {
-      _modifications = (_modifications + 1) & 0x3ffffff;
+      _modifications = (_modifications + 1) & 0x3fffffff;
       return true;
     }
     return false;
@@ -383,7 +383,7 @@
     var map = _map;
     if (JS<int>('!', '#.size', map) > 0) {
       JS('', '#.clear()', map);
-      _modifications = (_modifications + 1) & 0x3ffffff;
+      _modifications = (_modifications + 1) & 0x3fffffff;
     }
   }
 }
@@ -449,7 +449,7 @@
 
   bool contains(Object? key) {
     if (key is E) {
-      var buckets = JS('', '#.get(# & 0x3ffffff)', _keyMap, _hashCode(key));
+      var buckets = JS('', '#.get(# & 0x3fffffff)', _keyMap, _hashCode(key));
       if (buckets != null) {
         var equals = _equals;
         for (int i = 0, n = JS('!', '#.length', buckets); i < n; i++) {
@@ -463,7 +463,7 @@
 
   E? lookup(Object? key) {
     if (key is E) {
-      var buckets = JS('', '#.get(# & 0x3ffffff)', _keyMap, _hashCode(key));
+      var buckets = JS('', '#.get(# & 0x3fffffff)', _keyMap, _hashCode(key));
       if (buckets != null) {
         var equals = _equals;
         for (int i = 0, n = JS('!', '#.length', buckets); i < n; i++) {
@@ -477,7 +477,7 @@
 
   bool add(E key) {
     var keyMap = _keyMap;
-    var hash = JS<int>('!', '# & 0x3ffffff', _hashCode(key));
+    var hash = JS<int>('!', '# & 0x3fffffff', _hashCode(key));
     var buckets = JS('', '#.get(#)', keyMap, hash);
     if (buckets == null) {
       JS('', '#.set(#, [#])', keyMap, hash, key);
@@ -490,7 +490,7 @@
       JS('', '#.push(#)', buckets, key);
     }
     JS('', '#.add(#)', _map, key);
-    _modifications = (_modifications + 1) & 0x3ffffff;
+    _modifications = (_modifications + 1) & 0x3fffffff;
     return true;
   }
 
@@ -501,7 +501,7 @@
 
   bool remove(Object? key) {
     if (key is E) {
-      var hash = JS<int>('!', '# & 0x3ffffff', _hashCode(key));
+      var hash = JS<int>('!', '# & 0x3fffffff', _hashCode(key));
       var keyMap = _keyMap;
       var buckets = JS('', '#.get(#)', keyMap, hash);
       if (buckets == null) return false; // not found
@@ -515,7 +515,7 @@
             JS('', '#.splice(#, 1)', buckets, i);
           }
           JS('', '#.delete(#)', _map, k);
-          _modifications = (_modifications + 1) & 0x3ffffff;
+          _modifications = (_modifications + 1) & 0x3fffffff;
           return true;
         }
       }
@@ -528,7 +528,7 @@
     if (JS<int>('!', '#.size', map) > 0) {
       JS('', '#.clear()', map);
       JS('', '#.clear()', _keyMap);
-      _modifications = (_modifications + 1) & 0x3ffffff;
+      _modifications = (_modifications + 1) & 0x3fffffff;
     }
   }
 }
diff --git a/sdk/lib/_internal/js_dev_runtime/private/custom_hash_map.dart b/sdk/lib/_internal/js_dev_runtime/private/custom_hash_map.dart
index 14444e3..bcbf5b6 100644
--- a/sdk/lib/_internal/js_dev_runtime/private/custom_hash_map.dart
+++ b/sdk/lib/_internal/js_dev_runtime/private/custom_hash_map.dart
@@ -69,7 +69,7 @@
   @notNull
   bool containsKey(Object? key) {
     if (key is K) {
-      var buckets = JS('', '#.get(# & 0x3ffffff)', _keyMap, _hashCode(key));
+      var buckets = JS('', '#.get(# & 0x3fffffff)', _keyMap, _hashCode(key));
       if (buckets != null) {
         var equals = _equals;
         for (int i = 0, n = JS<int>('!', '#.length', buckets); i < n; i++) {
@@ -96,7 +96,7 @@
 
   V? operator [](Object? key) {
     if (key is K) {
-      var buckets = JS('', '#.get(# & 0x3ffffff)', _keyMap, _hashCode(key));
+      var buckets = JS('', '#.get(# & 0x3fffffff)', _keyMap, _hashCode(key));
       if (buckets != null) {
         var equals = _equals;
         for (int i = 0, n = JS<int>('!', '#.length', buckets); i < n; i++) {
@@ -113,7 +113,7 @@
 
   void operator []=(K key, V value) {
     var keyMap = _keyMap;
-    int hash = JS('!', '# & 0x3ffffff', _hashCode(key));
+    int hash = JS('!', '# & 0x3fffffff', _hashCode(key));
     var buckets = JS('', '#.get(#)', keyMap, hash);
     if (buckets == null) {
       JS('', '#.set(#, [#])', keyMap, hash, key);
@@ -132,12 +132,12 @@
       }
     }
     JS('', '#.set(#, #)', _map, key, value);
-    _modifications = (_modifications + 1) & 0x3ffffff;
+    _modifications = (_modifications + 1) & 0x3fffffff;
   }
 
   V putIfAbsent(K key, V ifAbsent()) {
     var keyMap = _keyMap;
-    int hash = JS('!', '# & 0x3ffffff', _hashCode(key));
+    int hash = JS('!', '# & 0x3fffffff', _hashCode(key));
     var buckets = JS('', '#.get(#)', keyMap, hash);
     if (buckets == null) {
       JS('', '#.set(#, [#])', keyMap, hash, key);
@@ -152,13 +152,13 @@
     V value = ifAbsent();
     if (value == null) JS('', '# = null', value); // coerce undefined to null.
     JS('', '#.set(#, #)', _map, key, value);
-    _modifications = (_modifications + 1) & 0x3ffffff;
+    _modifications = (_modifications + 1) & 0x3fffffff;
     return value;
   }
 
   V? remove(Object? key) {
     if (key is K) {
-      int hash = JS('!', '# & 0x3ffffff', _hashCode(key));
+      int hash = JS('!', '# & 0x3fffffff', _hashCode(key));
       var keyMap = _keyMap;
       var buckets = JS('', '#.get(#)', keyMap, hash);
       if (buckets == null) return null; // not found
@@ -174,7 +174,7 @@
           var map = _map;
           V value = JS('', '#.get(#)', map, k);
           JS('', '#.delete(#)', map, k);
-          _modifications = (_modifications + 1) & 0x3ffffff;
+          _modifications = (_modifications + 1) & 0x3fffffff;
           return value == null ? null : value; // coerce undefined to null.
         }
       }
@@ -187,7 +187,7 @@
     if (JS<int>('!', '#.size', map) > 0) {
       JS('', '#.clear()', map);
       JS('', '#.clear()', _keyMap);
-      _modifications = (_modifications + 1) & 0x3ffffff;
+      _modifications = (_modifications + 1) & 0x3fffffff;
     }
   }
 }
diff --git a/sdk/lib/_internal/js_dev_runtime/private/identity_hash_map.dart b/sdk/lib/_internal/js_dev_runtime/private/identity_hash_map.dart
index eda6c44..3f3d1dd 100644
--- a/sdk/lib/_internal/js_dev_runtime/private/identity_hash_map.dart
+++ b/sdk/lib/_internal/js_dev_runtime/private/identity_hash_map.dart
@@ -50,7 +50,7 @@
       other.forEach((key, value) {
         JS('', '#.set(#, #)', map, key, value);
       });
-      _modifications = (_modifications + 1) & 0x3ffffff;
+      _modifications = (_modifications + 1) & 0x3fffffff;
     }
   }
 
@@ -64,7 +64,7 @@
     int length = JS('!', '#.size', map);
     JS('', '#.set(#, #)', map, key, value);
     if (length != JS<int>('!', '#.size', map)) {
-      _modifications = (_modifications + 1) & 0x3ffffff;
+      _modifications = (_modifications + 1) & 0x3fffffff;
     }
   }
 
@@ -75,14 +75,14 @@
     V value = ifAbsent();
     if (value == null) JS('', '# = null', value);
     JS('', '#.set(#, #)', _map, key, value);
-    _modifications = (_modifications + 1) & 0x3ffffff;
+    _modifications = (_modifications + 1) & 0x3fffffff;
     return value;
   }
 
   V? remove(Object? key) {
     V value = JS('', '#.get(#)', _map, key);
     if (JS<bool>('!', '#.delete(#)', _map, key)) {
-      _modifications = (_modifications + 1) & 0x3ffffff;
+      _modifications = (_modifications + 1) & 0x3fffffff;
     }
     return value == null ? null : value; // coerce undefined to null.
   }
@@ -90,7 +90,7 @@
   void clear() {
     if (JS<int>('!', '#.size', _map) > 0) {
       JS('', '#.clear()', _map);
-      _modifications = (_modifications + 1) & 0x3ffffff;
+      _modifications = (_modifications + 1) & 0x3fffffff;
     }
   }
 }
diff --git a/sdk/lib/_internal/js_dev_runtime/private/linked_hash_map.dart b/sdk/lib/_internal/js_dev_runtime/private/linked_hash_map.dart
index f797ea4..3b226b2 100644
--- a/sdk/lib/_internal/js_dev_runtime/private/linked_hash_map.dart
+++ b/sdk/lib/_internal/js_dev_runtime/private/linked_hash_map.dart
@@ -99,7 +99,7 @@
       key = JS('', 'null');
     } else if (JS<bool>('!', '#[#] !== #', key, dart.extensionSymbol('_equals'),
         dart.identityEquals)) {
-      var buckets = JS('', '#.get(# & 0x3ffffff)', _keyMap, key.hashCode);
+      var buckets = JS('', '#.get(# & 0x3fffffff)', _keyMap, key.hashCode);
       if (buckets != null) {
         for (int i = 0, n = JS('!', '#.length', buckets); i < n; i++) {
           K k = JS('', '#[#]', buckets, i);
@@ -131,7 +131,7 @@
       JS('', '#.set(#, #)', _map, key, value);
     });
     if (length != JS<int>('!', '#.size', map)) {
-      _modifications = (_modifications + 1) & 0x3ffffff;
+      _modifications = (_modifications + 1) & 0x3fffffff;
     }
   }
 
@@ -140,7 +140,7 @@
       key = JS('', 'null');
     } else if (JS<bool>('!', '#[#] !== #', key, dart.extensionSymbol('_equals'),
         dart.identityEquals)) {
-      var buckets = JS('', '#.get(# & 0x3ffffff)', _keyMap, key.hashCode);
+      var buckets = JS('', '#.get(# & 0x3fffffff)', _keyMap, key.hashCode);
       if (buckets != null) {
         for (int i = 0, n = JS('!', '#.length', buckets); i < n; i++) {
           K k = JS('', '#[#]', buckets, i);
@@ -164,7 +164,7 @@
     int length = JS('', '#.size', map);
     JS('', '#.set(#, #)', map, key, value);
     if (length != JS<int>('!', '#.size', map)) {
-      _modifications = (_modifications + 1) & 0x3ffffff;
+      _modifications = (_modifications + 1) & 0x3fffffff;
     }
   }
 
@@ -177,7 +177,7 @@
         dart.identityEquals)) {
       @notNull
       K k = key;
-      var hash = JS<int>('!', '# & 0x3ffffff', k.hashCode);
+      var hash = JS<int>('!', '# & 0x3fffffff', k.hashCode);
       var buckets = JS('', '#.get(#)', _keyMap, hash);
       if (buckets == null) {
         JS('', '#.set(#, [#])', _keyMap, hash, key);
@@ -196,7 +196,7 @@
       value = JS('', 'null');
     }
     JS('', '#.set(#, #)', map, key, value);
-    _modifications = (_modifications + 1) & 0x3ffffff;
+    _modifications = (_modifications + 1) & 0x3fffffff;
     return value;
   }
 
@@ -206,7 +206,7 @@
     } else if (JS<bool>('!', '#[#] !== #', key, dart.extensionSymbol('_equals'),
         dart.identityEquals)) {
       @notNull
-      var hash = JS<int>('!', '# & 0x3ffffff', key.hashCode);
+      var hash = JS<int>('!', '# & 0x3fffffff', key.hashCode);
       var buckets = JS('', '#.get(#)', _keyMap, hash);
       if (buckets == null) return null; // not found
       for (int i = 0, n = JS('!', '#.length', buckets);;) {
@@ -226,7 +226,7 @@
     var map = _map;
     V value = JS('', '#.get(#)', map, key);
     if (JS<bool>('!', '#.delete(#)', map, key)) {
-      _modifications = (_modifications + 1) & 0x3ffffff;
+      _modifications = (_modifications + 1) & 0x3fffffff;
     }
     return value == null ? null : value; // coerce undefined to null.
   }
@@ -236,14 +236,14 @@
     if (JS<int>('!', '#.size', map) > 0) {
       JS('', '#.clear()', map);
       JS('', '#.clear()', _keyMap);
-      _modifications = (_modifications + 1) & 0x3ffffff;
+      _modifications = (_modifications + 1) & 0x3fffffff;
     }
   }
 }
 
 @NoReifyGeneric()
 K putLinkedMapKey<K>(@notNull K key, keyMap) {
-  var hash = JS<int>('!', '# & 0x3ffffff', key.hashCode);
+  var hash = JS<int>('!', '# & 0x3fffffff', key.hashCode);
   var buckets = JS('', '#.get(#)', keyMap, hash);
   if (buckets == null) {
     JS('', '#.set(#, [#])', keyMap, hash, key);
diff --git a/tools/VERSION b/tools/VERSION
index e4b83ee..93db02d 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
 MAJOR 2
 MINOR 17
 PATCH 0
-PRERELEASE 74
+PRERELEASE 75
 PRERELEASE_PATCH 0
\ No newline at end of file