[dart2js] prepare element_map_impl for migration
Change-Id: I7faec717a427638fc04194fac2c0c63f21f1d07c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260284
Reviewed-by: Nate Biggs <natebiggs@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
diff --git a/pkg/compiler/lib/src/js_backend/namer.dart b/pkg/compiler/lib/src/js_backend/namer.dart
index acfc631..877a64b 100644
--- a/pkg/compiler/lib/src/js_backend/namer.dart
+++ b/pkg/compiler/lib/src/js_backend/namer.dart
@@ -2345,6 +2345,7 @@
/// Returns the string that is to be used as the result of a call to
/// [JS_GET_NAME] at [node] with argument [name].
+ @override
jsAst.Name getNameForJsGetName(Spannable spannable, JsGetName name) {
switch (name) {
case JsGetName.GETTER_PREFIX:
diff --git a/pkg/compiler/lib/src/js_backend/namer_interfaces.dart b/pkg/compiler/lib/src/js_backend/namer_interfaces.dart
index 37bda8a..41b211d 100644
--- a/pkg/compiler/lib/src/js_backend/namer_interfaces.dart
+++ b/pkg/compiler/lib/src/js_backend/namer_interfaces.dart
@@ -2,11 +2,14 @@
// 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 '../common.dart';
import '../elements/entities.dart';
import '../js/js.dart' as jsAst;
import '../universe/selector.dart' show Selector;
+import 'package:js_shared/synced/embedded_names.dart' show JsGetName;
abstract class ModularNamer {
jsAst.Name nameForOneShotInterceptor(
Selector selector, Set<ClassEntity> classes);
+ jsAst.Name getNameForJsGetName(Spannable spannable, JsGetName name);
}
diff --git a/pkg/compiler/lib/src/kernel/element_map_impl.dart b/pkg/compiler/lib/src/kernel/element_map_impl.dart
index 38426db..230596d 100644
--- a/pkg/compiler/lib/src/kernel/element_map_impl.dart
+++ b/pkg/compiler/lib/src/kernel/element_map_impl.dart
@@ -38,7 +38,7 @@
import '../js_backend/backend_impact.dart';
import '../js_backend/backend_usage.dart';
import '../js_backend/custom_elements_analysis.dart';
-import '../js_backend/namer.dart';
+import '../js_backend/namer_interfaces.dart';
import '../js_backend/native_data.dart';
import '../js_backend/runtime_types_resolution.dart';
import '../js_model/locals.dart';
@@ -55,9 +55,9 @@
import '../universe/selector.dart';
import '../universe/world_impact.dart';
-import 'element_map.dart';
import 'element_map_interfaces.dart' as interfaces
show
+ ForeignKind,
KernelElementEnvironment,
KernelToElementMapForClassHierarchy,
KernelToElementMapForEnv,
@@ -66,6 +66,7 @@
KernelToElementMapForNativeData,
KernelToElementMapForDeferredLoading,
KernelToElementMapForJsModel;
+import 'element_map_migrated.dart';
import 'env.dart';
import 'kelements.dart';
import 'kernel_impact.dart';
@@ -1157,7 +1158,7 @@
}
/// Returns the [js.Name] for the `JsGetName` [constant] value.
- js.Name getNameForJsGetName(ConstantValue constant, Namer namer) {
+ js.Name getNameForJsGetName(ConstantValue constant, ModularNamer namer) {
int index = extractEnumIndexFromConstantValue(
constant, commonElements.jsGetNameEnum);
if (index == null) return null;
@@ -1648,20 +1649,20 @@
/// Compute the kind of foreign helper function called by [node], if any.
@override
- ForeignKind getForeignKind(ir.StaticInvocation node) {
+ interfaces.ForeignKind getForeignKind(ir.StaticInvocation node) {
if (commonElements.isForeignHelper(getMember(node.target))) {
switch (node.target.name.text) {
case Identifiers.JS:
- return ForeignKind.JS;
+ return interfaces.ForeignKind.JS;
case Identifiers.JS_BUILTIN:
- return ForeignKind.JS_BUILTIN;
+ return interfaces.ForeignKind.JS_BUILTIN;
case Identifiers.JS_EMBEDDED_GLOBAL:
- return ForeignKind.JS_EMBEDDED_GLOBAL;
+ return interfaces.ForeignKind.JS_EMBEDDED_GLOBAL;
case Identifiers.JS_INTERCEPTOR_CONSTANT:
- return ForeignKind.JS_INTERCEPTOR_CONSTANT;
+ return interfaces.ForeignKind.JS_INTERCEPTOR_CONSTANT;
}
}
- return ForeignKind.NONE;
+ return interfaces.ForeignKind.NONE;
}
/// Computes the [InterfaceType] referenced by a call to the