[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>
This commit is contained in:
Sigmund Cherem 2022-09-23 00:28:58 +00:00 committed by Commit Bot
parent 0ee953d7c2
commit 01f3d27c1e
3 changed files with 14 additions and 9 deletions

View file

@ -2345,6 +2345,7 @@ abstract class ModularNamer implements interfaces.ModularNamer {
/// 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:

View file

@ -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);
}

View file

@ -38,7 +38,7 @@ import '../js_backend/annotations.dart';
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/call_structure.dart';
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 @@ import 'element_map_interfaces.dart' as interfaces
KernelToElementMapForNativeData,
KernelToElementMapForDeferredLoading,
KernelToElementMapForJsModel;
import 'element_map_migrated.dart';
import 'env.dart';
import 'kelements.dart';
import 'kernel_impact.dart';
@ -1157,7 +1158,7 @@ class KernelToElementMap
}
/// 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 @@ class KernelToElementMap
/// 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