| 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 119cccfb4ee5031505f7f24636000c2c5578ff1c..d8572f2c5edb65147fdae25c9392b1f00aab88d4 100644
|
| --- a/pkg/compiler/lib/src/js_backend/namer.dart
|
| +++ b/pkg/compiler/lib/src/js_backend/namer.dart
|
| @@ -772,8 +772,10 @@ class Namer {
|
| }
|
|
|
| /// Annotated name for [method] encoding arity and named parameters.
|
| - jsAst.Name instanceMethodName(MethodElement method) {
|
| - if (method.isGenerativeConstructorBody) {
|
| + jsAst.Name instanceMethodName(FunctionEntity method) {
|
| + // TODO(johnniwinther): Avoid the use of [ConstructorBodyElement]. The
|
| + // codegen model should be explicit about its constructor body elements.
|
| + if (method is ConstructorBodyElement) {
|
| return constructorBodyName(method);
|
| }
|
| return invocationName(new Selector.fromElement(method));
|
| @@ -1293,13 +1295,7 @@ class Namer {
|
| } else {
|
| // TODO(johnniwinther): Change factory name encoding as to not include
|
| // the class-name twice.
|
| - String constructorName;
|
| - if (element.name == '') {
|
| - constructorName = className;
|
| - } else {
|
| - constructorName = '${className}\$${element.name}';
|
| - }
|
| - return '${className}_${constructorName}';
|
| + return '${className}_${Elements.reconstructConstructorName(element)}';
|
| }
|
| }
|
|
|
| @@ -1421,7 +1417,7 @@ class Namer {
|
| /// [operatorIsPrefix] or [operatorAsPrefix]. If this is a function type,
|
| /// then by convention, an underscore must also separate [operatorIsPrefix]
|
| /// from the type name.
|
| - jsAst.Name runtimeTypeName(TypeDeclarationElement element) {
|
| + jsAst.Name runtimeTypeName(Entity element) {
|
| if (element == null) return _literalDynamic;
|
| // The returned name affects both the global and instance member namespaces:
|
| //
|
| @@ -1441,7 +1437,7 @@ class Namer {
|
| ///
|
| /// This is both the *runtime type* of the class (see [runtimeTypeName])
|
| /// and a global property name in which to store its JS constructor.
|
| - jsAst.Name className(ClassElement class_) => _disambiguateGlobalType(class_);
|
| + jsAst.Name className(ClassEntity class_) => _disambiguateGlobalType(class_);
|
|
|
| /// Property name on which [member] can be accessed directly,
|
| /// without clashing with another JS property name.
|
| @@ -1477,7 +1473,7 @@ class Namer {
|
| ///
|
| /// The name is not necessarily unique to [method], since a static method
|
| /// may share its name with an instance method.
|
| - jsAst.Name methodPropertyName(MethodElement method) {
|
| + jsAst.Name methodPropertyName(FunctionEntity method) {
|
| return method.isInstanceMember
|
| ? instanceMethodName(method)
|
| : globalPropertyNameForMember(method);
|
| @@ -1510,12 +1506,6 @@ class Namer {
|
| }
|
|
|
| /// Returns [staticStateHolder] or one of [reservedGlobalObjectNames].
|
| - // TODO(johnniwinther): Verify that the implementation can be changed to
|
| - // `globalObjectForLibrary(element.library)`.
|
| - String globalObjectForMethod(MethodElement element) =>
|
| - globalObjectForMember(element);
|
| -
|
| - /// Returns [staticStateHolder] or one of [reservedGlobalObjectNames].
|
| String globalObjectForMember(MemberEntity element) {
|
| if (_isPropertyOfStaticStateHolder(element)) return staticStateHolder;
|
| return globalObjectForLibrary(element.library);
|
| @@ -1556,8 +1546,8 @@ class Namer {
|
| return deriveLazyInitializerName(name);
|
| }
|
|
|
| - jsAst.Name staticClosureName(Element element) {
|
| - assert(Elements.isStaticOrTopLevelFunction(element));
|
| + jsAst.Name staticClosureName(FunctionEntity element) {
|
| + assert(element.isTopLevel || element.isStatic);
|
| String enclosing =
|
| element.enclosingClass == null ? "" : element.enclosingClass.name;
|
| String library = _proposeNameForLibrary(element.library);
|
| @@ -1622,7 +1612,7 @@ class Namer {
|
| return operatorIs(interfaceType.element);
|
| }
|
|
|
| - jsAst.Name operatorIs(ClassElement element) {
|
| + jsAst.Name operatorIs(ClassEntity element) {
|
| // TODO(erikcorry): Reduce from $isx to ix when we are minifying.
|
| return new CompoundName(
|
| [new StringBackedName(operatorIsPrefix), runtimeTypeName(element)]);
|
| @@ -1637,7 +1627,7 @@ class Namer {
|
| return name;
|
| }
|
|
|
| - jsAst.Name substitutionName(ClassElement element) {
|
| + jsAst.Name substitutionName(ClassEntity element) {
|
| return new CompoundName(
|
| [new StringBackedName(operatorAsPrefix), runtimeTypeName(element)]);
|
| }
|
|
|