Remove unused parts of NativeDataBuilder

Change-Id: I449e0906f098f5d72f82894c6c24f5975da49e6c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96656
Reviewed-by: Sigmund Cherem <sigmund@google.com>
diff --git a/pkg/compiler/lib/src/js_backend/native_data.dart b/pkg/compiler/lib/src/js_backend/native_data.dart
index a491286..1c72d9c 100644
--- a/pkg/compiler/lib/src/js_backend/native_data.dart
+++ b/pkg/compiler/lib/src/js_backend/native_data.dart
@@ -158,26 +158,10 @@
   /// Registers the [behavior] for writing to the native [field].
   void setNativeFieldStoreBehavior(FieldEntity field, NativeBehavior behavior);
 
-  /// Marks [element] as an explicit part of JsInterop. The js interop name is
-  /// expected to be computed later.
-  void markAsJsInteropMember(MemberEntity element);
-
   /// Sets the native [name] for the member [element]. This name is used for
   /// [element] in the generated JavaScript.
   void setNativeMemberName(MemberEntity element, String name);
 
-  /// Sets the explicit js interop [name] for the library [element].
-  void setJsInteropLibraryName(LibraryEntity element, String name);
-
-  /// Marks [element] as having an `@Anonymous` annotation.
-  void markJsInteropClassAsAnonymous(ClassEntity element);
-
-  /// Sets the explicit js interop [name] for the class [element].
-  void setJsInteropClassName(ClassEntity element, String name);
-
-  /// Sets the explicit js interop [name] for the member [element].
-  void setJsInteropMemberName(MemberEntity element, String name);
-
   /// Closes this builder and creates the resulting [NativeData] object.
   NativeData close();
 }
@@ -438,26 +422,7 @@
   Map<MemberEntity, NativeBehavior> nativeFieldStoreBehavior =
       <FieldEntity, NativeBehavior>{};
 
-  /// The JavaScript names for libraries implemented via typed JavaScript
-  /// interop.
-  final Map<LibraryEntity, String> jsInteropLibraries;
-
-  /// JavaScript interop classes annotated with `@anonymous`
-  final Set<ClassEntity> anonymousJsInteropClasses;
-
-  /// The JavaScript names for classes implemented via typed JavaScript
-  /// interop.
-  final Map<ClassEntity, String> jsInteropClasses;
-
-  /// The JavaScript names for members implemented via typed JavaScript
-  /// interop.
-  final Map<MemberEntity, String> jsInteropMembers;
-
-  NativeDataBuilderImpl(this._nativeBasicData)
-      : jsInteropLibraries = _nativeBasicData.jsInteropLibraries,
-        jsInteropClasses = _nativeBasicData.jsInteropClasses,
-        anonymousJsInteropClasses = _nativeBasicData.anonymousJsInteropClasses,
-        jsInteropMembers = _nativeBasicData.jsInteropMembers;
+  NativeDataBuilderImpl(this._nativeBasicData);
 
   /// Sets the native [name] for the member [element]. This name is used for
   /// [element] in the generated JavaScript.
@@ -490,54 +455,9 @@
     nativeFieldStoreBehavior[field] = behavior;
   }
 
-  /// Sets the explicit js interop [name] for the library [element].
-  void setJsInteropLibraryName(LibraryEntity element, String name) {
-    assert(
-        _nativeBasicData.isJsInteropLibrary(element),
-        failedAt(element,
-            'Library $element is not js interop but given a js interop name.'));
-    jsInteropLibraries[element] = name;
-  }
-
   @override
-  void markJsInteropClassAsAnonymous(ClassEntity element) {
-    anonymousJsInteropClasses.add(element);
-  }
-
-  /// Sets the explicit js interop [name] for the class [element].
-  void setJsInteropClassName(ClassEntity element, String name) {
-    assert(
-        _nativeBasicData.isJsInteropClass(element),
-        failedAt(element,
-            'Class $element is not js interop but given a js interop name.'));
-    jsInteropClasses[element] = name;
-  }
-
-  @override
-  void markAsJsInteropMember(MemberEntity element) {
-    jsInteropMembers[element] = null;
-  }
-
-  /// Sets the explicit js interop [name] for the member [element].
-  void setJsInteropMemberName(MemberEntity element, String name) {
-    assert(
-        jsInteropMembers.containsKey(element),
-        failedAt(element,
-            'Member $element is not js interop but given a js interop name.'));
-    jsInteropMembers[element] = name;
-  }
-
-  @override
-  NativeData close() => new NativeDataImpl(
-      _nativeBasicData,
-      nativeMemberName,
-      nativeMethodBehavior,
-      nativeFieldLoadBehavior,
-      nativeFieldStoreBehavior,
-      jsInteropLibraries,
-      anonymousJsInteropClasses,
-      jsInteropClasses,
-      jsInteropMembers);
+  NativeData close() => new NativeDataImpl(_nativeBasicData, nativeMemberName,
+      nativeMethodBehavior, nativeFieldLoadBehavior, nativeFieldStoreBehavior);
 }
 
 // TODO(johnniwinther): Remove fields that overlap with [NativeBasicData], like
@@ -565,31 +485,12 @@
   /// Cache for [NativeBehavior]s for writing to native fields.
   final Map<MemberEntity, NativeBehavior> nativeFieldStoreBehavior;
 
-  /// The JavaScript names for libraries implemented via typed JavaScript
-  /// interop.
-  final Map<LibraryEntity, String> jsInteropLibraries;
-
-  /// JavaScript interop classes annotated with `@anonymous`
-  final Set<ClassEntity> anonymousJsInteropClasses;
-
-  /// The JavaScript names for classes implemented via typed JavaScript
-  /// interop.
-  final Map<ClassEntity, String> jsInteropClasses;
-
-  /// The JavaScript names for members implemented via typed JavaScript
-  /// interop.
-  final Map<MemberEntity, String> jsInteropMembers;
-
   NativeDataImpl(
       this._nativeBasicData,
       this.nativeMemberName,
       this.nativeMethodBehavior,
       this.nativeFieldLoadBehavior,
-      this.nativeFieldStoreBehavior,
-      this.jsInteropLibraries,
-      this.anonymousJsInteropClasses,
-      this.jsInteropClasses,
-      this.jsInteropMembers);
+      this.nativeFieldStoreBehavior);
 
   factory NativeDataImpl.readFromDataSource(
       DataSource source, ElementEnvironment elementEnvironment) {
@@ -604,24 +505,13 @@
         .readMemberMap(() => new NativeBehavior.readFromDataSource(source));
     Map<MemberEntity, NativeBehavior> nativeFieldStoreBehavior = source
         .readMemberMap(() => new NativeBehavior.readFromDataSource(source));
-    Map<LibraryEntity, String> jsInteropLibraries =
-        source.readLibraryMap(source.readString);
-    Set<ClassEntity> anonymousJsInteropClasses = source.readClasses().toSet();
-    Map<ClassEntity, String> jsInteropClasses =
-        source.readClassMap(source.readString);
-    Map<MemberEntity, String> jsInteropMembers =
-        source.readMemberMap(source.readString);
     source.end(tag);
     return new NativeDataImpl(
         nativeBasicData,
         nativeMemberName,
         nativeMethodBehavior,
         nativeFieldLoadBehavior,
-        nativeFieldStoreBehavior,
-        jsInteropLibraries,
-        anonymousJsInteropClasses,
-        jsInteropClasses,
-        jsInteropMembers);
+        nativeFieldStoreBehavior);
   }
 
   void writeToDataSink(DataSink sink) {
@@ -641,13 +531,28 @@
       behavior.writeToDataSink(sink);
     });
 
-    sink.writeLibraryMap(jsInteropLibraries, sink.writeString);
-    sink.writeClasses(anonymousJsInteropClasses);
-    sink.writeClassMap(jsInteropClasses, sink.writeString);
-    sink.writeMemberMap(jsInteropMembers, sink.writeString);
     sink.end(tag);
   }
 
+  /// The JavaScript names for libraries implemented via typed JavaScript
+  /// interop.
+  Map<LibraryEntity, String> get jsInteropLibraries =>
+      _nativeBasicData.jsInteropLibraries;
+
+  /// JavaScript interop classes annotated with `@anonymous`
+  Set<ClassEntity> get anonymousJsInteropClasses =>
+      _nativeBasicData.anonymousJsInteropClasses;
+
+  /// The JavaScript names for classes implemented via typed JavaScript
+  /// interop.
+  Map<ClassEntity, String> get jsInteropClasses =>
+      _nativeBasicData.jsInteropClasses;
+
+  /// The JavaScript names for members implemented via typed JavaScript
+  /// interop.
+  Map<MemberEntity, String> get jsInteropMembers =>
+      _nativeBasicData.jsInteropMembers;
+
   @override
   bool isAnonymousJsInteropClass(ClassEntity element) {
     return anonymousJsInteropClasses.contains(element);
diff --git a/pkg/compiler/lib/src/js_model/js_world_builder.dart b/pkg/compiler/lib/src/js_model/js_world_builder.dart
index baff70c..3e33991 100644
--- a/pkg/compiler/lib/src/js_model/js_world_builder.dart
+++ b/pkg/compiler/lib/src/js_model/js_world_builder.dart
@@ -340,25 +340,12 @@
     Map<MemberEntity, NativeBehavior> nativeFieldStoreBehavior =
         map.toBackendMemberMap(
             nativeData.nativeFieldStoreBehavior, convertNativeBehavior);
-    Map<LibraryEntity, String> jsInteropLibraryNames =
-        map.toBackendLibraryMap(nativeData.jsInteropLibraries, identity);
-    Set<ClassEntity> anonymousJsInteropClasses =
-        map.toBackendClassSet(nativeData.anonymousJsInteropClasses);
-    Map<ClassEntity, String> jsInteropClassNames =
-        map.toBackendClassMap(nativeData.jsInteropClasses, identity);
-    Map<MemberEntity, String> jsInteropMemberNames =
-        map.toBackendMemberMap(nativeData.jsInteropMembers, identity);
-
     return new NativeDataImpl(
         nativeBasicData,
         nativeMemberName,
         nativeMethodBehavior,
         nativeFieldLoadBehavior,
-        nativeFieldStoreBehavior,
-        jsInteropLibraryNames,
-        anonymousJsInteropClasses,
-        jsInteropClassNames,
-        jsInteropMemberNames);
+        nativeFieldStoreBehavior);
   }
 
   InterceptorData _convertInterceptorData(JsToFrontendMap map,