mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 00:39:49 +00:00
[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:
parent
0ee953d7c2
commit
01f3d27c1e
|
@ -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
|
/// Returns the string that is to be used as the result of a call to
|
||||||
/// [JS_GET_NAME] at [node] with argument [name].
|
/// [JS_GET_NAME] at [node] with argument [name].
|
||||||
|
@override
|
||||||
jsAst.Name getNameForJsGetName(Spannable spannable, JsGetName name) {
|
jsAst.Name getNameForJsGetName(Spannable spannable, JsGetName name) {
|
||||||
switch (name) {
|
switch (name) {
|
||||||
case JsGetName.GETTER_PREFIX:
|
case JsGetName.GETTER_PREFIX:
|
||||||
|
|
|
@ -2,11 +2,14 @@
|
||||||
// for details. All rights reserved. Use of this source code is governed by a
|
// 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.
|
// BSD-style license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
import '../common.dart';
|
||||||
import '../elements/entities.dart';
|
import '../elements/entities.dart';
|
||||||
import '../js/js.dart' as jsAst;
|
import '../js/js.dart' as jsAst;
|
||||||
import '../universe/selector.dart' show Selector;
|
import '../universe/selector.dart' show Selector;
|
||||||
|
import 'package:js_shared/synced/embedded_names.dart' show JsGetName;
|
||||||
|
|
||||||
abstract class ModularNamer {
|
abstract class ModularNamer {
|
||||||
jsAst.Name nameForOneShotInterceptor(
|
jsAst.Name nameForOneShotInterceptor(
|
||||||
Selector selector, Set<ClassEntity> classes);
|
Selector selector, Set<ClassEntity> classes);
|
||||||
|
jsAst.Name getNameForJsGetName(Spannable spannable, JsGetName name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ import '../js_backend/annotations.dart';
|
||||||
import '../js_backend/backend_impact.dart';
|
import '../js_backend/backend_impact.dart';
|
||||||
import '../js_backend/backend_usage.dart';
|
import '../js_backend/backend_usage.dart';
|
||||||
import '../js_backend/custom_elements_analysis.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/native_data.dart';
|
||||||
import '../js_backend/runtime_types_resolution.dart';
|
import '../js_backend/runtime_types_resolution.dart';
|
||||||
import '../js_model/locals.dart';
|
import '../js_model/locals.dart';
|
||||||
|
@ -55,9 +55,9 @@ import '../universe/call_structure.dart';
|
||||||
import '../universe/selector.dart';
|
import '../universe/selector.dart';
|
||||||
import '../universe/world_impact.dart';
|
import '../universe/world_impact.dart';
|
||||||
|
|
||||||
import 'element_map.dart';
|
|
||||||
import 'element_map_interfaces.dart' as interfaces
|
import 'element_map_interfaces.dart' as interfaces
|
||||||
show
|
show
|
||||||
|
ForeignKind,
|
||||||
KernelElementEnvironment,
|
KernelElementEnvironment,
|
||||||
KernelToElementMapForClassHierarchy,
|
KernelToElementMapForClassHierarchy,
|
||||||
KernelToElementMapForEnv,
|
KernelToElementMapForEnv,
|
||||||
|
@ -66,6 +66,7 @@ import 'element_map_interfaces.dart' as interfaces
|
||||||
KernelToElementMapForNativeData,
|
KernelToElementMapForNativeData,
|
||||||
KernelToElementMapForDeferredLoading,
|
KernelToElementMapForDeferredLoading,
|
||||||
KernelToElementMapForJsModel;
|
KernelToElementMapForJsModel;
|
||||||
|
import 'element_map_migrated.dart';
|
||||||
import 'env.dart';
|
import 'env.dart';
|
||||||
import 'kelements.dart';
|
import 'kelements.dart';
|
||||||
import 'kernel_impact.dart';
|
import 'kernel_impact.dart';
|
||||||
|
@ -1157,7 +1158,7 @@ class KernelToElementMap
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the [js.Name] for the `JsGetName` [constant] value.
|
/// 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(
|
int index = extractEnumIndexFromConstantValue(
|
||||||
constant, commonElements.jsGetNameEnum);
|
constant, commonElements.jsGetNameEnum);
|
||||||
if (index == null) return null;
|
if (index == null) return null;
|
||||||
|
@ -1648,20 +1649,20 @@ class KernelToElementMap
|
||||||
|
|
||||||
/// Compute the kind of foreign helper function called by [node], if any.
|
/// Compute the kind of foreign helper function called by [node], if any.
|
||||||
@override
|
@override
|
||||||
ForeignKind getForeignKind(ir.StaticInvocation node) {
|
interfaces.ForeignKind getForeignKind(ir.StaticInvocation node) {
|
||||||
if (commonElements.isForeignHelper(getMember(node.target))) {
|
if (commonElements.isForeignHelper(getMember(node.target))) {
|
||||||
switch (node.target.name.text) {
|
switch (node.target.name.text) {
|
||||||
case Identifiers.JS:
|
case Identifiers.JS:
|
||||||
return ForeignKind.JS;
|
return interfaces.ForeignKind.JS;
|
||||||
case Identifiers.JS_BUILTIN:
|
case Identifiers.JS_BUILTIN:
|
||||||
return ForeignKind.JS_BUILTIN;
|
return interfaces.ForeignKind.JS_BUILTIN;
|
||||||
case Identifiers.JS_EMBEDDED_GLOBAL:
|
case Identifiers.JS_EMBEDDED_GLOBAL:
|
||||||
return ForeignKind.JS_EMBEDDED_GLOBAL;
|
return interfaces.ForeignKind.JS_EMBEDDED_GLOBAL;
|
||||||
case Identifiers.JS_INTERCEPTOR_CONSTANT:
|
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
|
/// Computes the [InterfaceType] referenced by a call to the
|
||||||
|
|
Loading…
Reference in a new issue