[dart2wasm] Remove externref and use the new value for anyref.

This matches the spec after anyref and externref were merged, and it's
necessary in order to use the latest Binaryen, which has removed support
for the old value.

Change-Id: I7f1bb5cb08637dd79fe975603d8e236d73ca4fdc
Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/245375
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
diff --git a/pkg/wasm_builder/lib/src/types.dart b/pkg/wasm_builder/lib/src/types.dart
index ecc8b1e..84494d3 100644
--- a/pkg/wasm_builder/lib/src/types.dart
+++ b/pkg/wasm_builder/lib/src/types.dart
@@ -201,10 +201,6 @@
   const RefType.i31({bool nullable = I31HeapType.defaultNullability})
       : this._(HeapType.i31, nullable);
 
-  /// A (possibly nullable) reference to the `extern` heap type.
-  const RefType.extern({bool nullable = ExternHeapType.defaultNullability})
-      : this._(HeapType.extern, nullable);
-
   /// A (possibly nullable) reference to a custom heap type.
   RefType.def(DefType defType, {required bool nullable})
       : this(defType, nullable: nullable);
@@ -266,9 +262,6 @@
   /// The `i31` heap type.
   static const i31 = I31HeapType._();
 
-  /// The `extern` heap type.
-  static const extern = ExternHeapType._();
-
   /// Whether this heap type is nullable by default, i.e. when written with the
   /// -`ref` shorthand. A `null` value here means the heap type has no default
   /// nullability, so the nullability of a reference has to be specified
@@ -295,7 +288,7 @@
   bool isSubtypeOf(HeapType other) => other == HeapType.any;
 
   @override
-  void serialize(Serializer s) => s.writeByte(0x6E);
+  void serialize(Serializer s) => s.writeByte(0x6F);
 
   @override
   String toString() => "any";
@@ -381,26 +374,6 @@
   String toString() => "i31";
 }
 
-/// The `extern` heap type.
-class ExternHeapType extends HeapType {
-  const ExternHeapType._();
-
-  static const defaultNullability = true;
-
-  @override
-  bool? get nullableByDefault => defaultNullability;
-
-  @override
-  bool isSubtypeOf(HeapType other) =>
-      other == HeapType.any || other == HeapType.extern;
-
-  @override
-  void serialize(Serializer s) => s.writeByte(0x6F);
-
-  @override
-  String toString() => "extern";
-}
-
 /// A custom heap type.
 abstract class DefType extends HeapType {
   int? _index;