| Index: pkg/compiler/lib/src/js_backend/namer.dart
|
| diff --git a/pkg/compiler/lib/src/js_backend/namer.dart b/pkg/compiler/lib/src/js_backend/namer.dart
|
| index e0b2a7f717ff56c0a2761d6e6f948abc5bf26286..15751cfe3a2151b13cfdc64b33968b6d889e757c 100644
|
| --- a/pkg/compiler/lib/src/js_backend/namer.dart
|
| +++ b/pkg/compiler/lib/src/js_backend/namer.dart
|
| @@ -14,20 +14,7 @@ import '../common/names.dart' show Identifiers, Selectors;
|
| import '../constants/values.dart';
|
| import '../common_elements.dart' show CommonElements;
|
| import '../diagnostics/invariant.dart' show DEBUG_MODE;
|
| -import '../elements/elements.dart'
|
| - show
|
| - ClassElement,
|
| - ConstructorBodyElement,
|
| - Element,
|
| - Elements,
|
| - FieldElement,
|
| - FormalElement,
|
| - FunctionElement,
|
| - FunctionSignature,
|
| - MemberElement,
|
| - TypeDeclarationElement,
|
| - MixinApplicationElement,
|
| - TypedefElement;
|
| +import '../elements/elements.dart';
|
| import '../elements/entities.dart';
|
| import '../elements/entity_utils.dart' as utils;
|
| import '../elements/jumps.dart';
|
| @@ -35,6 +22,7 @@ import '../elements/names.dart';
|
| import '../elements/resolution_types.dart';
|
| import '../elements/types.dart';
|
| import '../js/js.dart' as jsAst;
|
| +import '../tree/tree.dart';
|
| import '../universe/call_structure.dart' show CallStructure;
|
| import '../universe/selector.dart' show Selector, SelectorKind;
|
| import '../universe/world_builder.dart' show CodegenWorldBuilder;
|
| @@ -554,8 +542,8 @@ class Namer {
|
|
|
| final Map<String, int> popularNameCounters = <String, int>{};
|
|
|
| - final Map<LibraryEntity, String> libraryLongNames =
|
| - new HashMap<LibraryEntity, String>();
|
| + final Map<LibraryElement, String> libraryLongNames =
|
| + new HashMap<LibraryElement, String>();
|
|
|
| final Map<ConstantValue, jsAst.Name> constantNames =
|
| new HashMap<ConstantValue, jsAst.Name>();
|
| @@ -565,8 +553,8 @@ class Namer {
|
|
|
| /// Maps private names to a library that may use that name without prefixing
|
| /// itself. Used for building proposed names.
|
| - final Map<String, LibraryEntity> shortPrivateNameOwners =
|
| - <String, LibraryEntity>{};
|
| + final Map<String, LibraryElement> shortPrivateNameOwners =
|
| + <String, LibraryElement>{};
|
|
|
| final Map<String, String> suggestedGlobalNames = <String, String>{};
|
| final Map<String, String> suggestedInstanceNames = <String, String>{};
|
| @@ -574,8 +562,8 @@ class Namer {
|
| /// Used to store unique keys for library names. Keys are not used as names,
|
| /// nor are they visible in the output. The only serve as an internal
|
| /// key into maps.
|
| - final Map<LibraryEntity, String> _libraryKeys =
|
| - new HashMap<LibraryEntity, String>();
|
| + final Map<LibraryElement, String> _libraryKeys =
|
| + new HashMap<LibraryElement, String>();
|
|
|
| Namer(this._closedWorld, this._codegenWorldBuilder) {
|
| _literalAsyncPrefix = new StringBackedName(asyncPrefix);
|
| @@ -608,7 +596,7 @@ class Namer {
|
|
|
| /// Returns the string that is to be used as the result of a call to
|
| /// [JS_GET_NAME] at [node] with argument [name].
|
| - jsAst.Name getNameForJsGetName(Spannable spannable, JsGetName name) {
|
| + jsAst.Name getNameForJsGetName(Node node, JsGetName name) {
|
| switch (name) {
|
| case JsGetName.GETTER_PREFIX:
|
| return asName(getterPrefix);
|
| @@ -665,14 +653,17 @@ class Namer {
|
| case JsGetName.IS_INDEXABLE_FIELD_NAME:
|
| return operatorIs(_commonElements.jsIndexingBehaviorInterface);
|
| case JsGetName.NULL_CLASS_TYPE_NAME:
|
| - return runtimeTypeName(_commonElements.nullClass);
|
| + ClassElement nullClass = _commonElements.nullClass;
|
| + return runtimeTypeName(nullClass);
|
| case JsGetName.OBJECT_CLASS_TYPE_NAME:
|
| - return runtimeTypeName(_commonElements.objectClass);
|
| + ClassElement objectClass = _commonElements.objectClass;
|
| + return runtimeTypeName(objectClass);
|
| case JsGetName.FUNCTION_CLASS_TYPE_NAME:
|
| - return runtimeTypeName(_commonElements.functionClass);
|
| + ClassElement functionClass = _commonElements.functionClass;
|
| + return runtimeTypeName(functionClass);
|
| default:
|
| throw new SpannableAssertionFailure(
|
| - spannable, 'Error: Namer has no name for "$name".');
|
| + node, 'Error: Namer has no name for "$name".');
|
| }
|
| }
|
|
|
| @@ -750,10 +741,10 @@ class Namer {
|
| // Public names are easy.
|
| if (!originalName.isPrivate) return text;
|
|
|
| - LibraryEntity library = originalName.library;
|
| + LibraryElement library = originalName.library;
|
|
|
| // The first library asking for a short private name wins.
|
| - LibraryEntity owner =
|
| + LibraryElement owner =
|
| shortPrivateNameOwners.putIfAbsent(text, () => library);
|
|
|
| if (owner == library) {
|
| @@ -1045,7 +1036,7 @@ class Namer {
|
| /// Generates a unique key for [library].
|
| ///
|
| /// Keys are meant to be used in maps and should not be visible in the output.
|
| - String _generateLibraryKey(LibraryEntity library) {
|
| + String _generateLibraryKey(LibraryElement library) {
|
| return _libraryKeys.putIfAbsent(library, () {
|
| String keyBase = library.name;
|
| int counter = 0;
|
|
|