| Index: sdk/lib/_internal/compiler/implementation/js_backend/namer.dart
|
| diff --git a/sdk/lib/_internal/compiler/implementation/js_backend/namer.dart b/sdk/lib/_internal/compiler/implementation/js_backend/namer.dart
|
| index c8a58b21897c747bfc5c11055e621c2d9252ac1d..0c4289e8dadd094dad54ea82aea7ac127db23dad 100644
|
| --- a/sdk/lib/_internal/compiler/implementation/js_backend/namer.dart
|
| +++ b/sdk/lib/_internal/compiler/implementation/js_backend/namer.dart
|
| @@ -380,8 +380,8 @@ class Namer implements ClosureNamer {
|
| String name = operatorNameToIdentifier(elementName);
|
| if (name != elementName) return getMappedOperatorName(name);
|
|
|
| - LibraryElement library = element.getLibrary();
|
| - if (element.isGenerativeConstructorBody()) {
|
| + LibraryElement library = element.library;
|
| + if (element.isGenerativeConstructorBody) {
|
| name = Elements.reconstructConstructorNameSourceString(element);
|
| }
|
| FunctionSignature signature = element.functionSignature;
|
| @@ -421,10 +421,10 @@ class Namer implements ClosureNamer {
|
| }
|
|
|
| String invocationName(Selector selector) {
|
| - if (selector.isGetter()) {
|
| + if (selector.isGetter) {
|
| String proposedName = privateName(selector.library, selector.name);
|
| return '$getterPrefix${getMappedInstanceName(proposedName)}';
|
| - } else if (selector.isSetter()) {
|
| + } else if (selector.isSetter) {
|
| String proposedName = privateName(selector.library, selector.name);
|
| return '$setterPrefix${getMappedInstanceName(proposedName)}';
|
| } else {
|
| @@ -444,7 +444,7 @@ class Namer implements ClosureNamer {
|
| // We don't mangle the closure invoking function name because it
|
| // is generated by string concatenation in applyFunction from
|
| // js_helper.dart. We potentially shorten the prefix though.
|
| - if (selector.isClosureCall()) {
|
| + if (selector.isClosureCall) {
|
| return "$callPrefix$suffix";
|
| } else {
|
| String proposedName = privateName(selector.library, name);
|
| @@ -464,7 +464,7 @@ class Namer implements ClosureNamer {
|
| * instance field.
|
| */
|
| String fieldAccessorName(Element element) {
|
| - return element.isInstanceMember()
|
| + return element.isInstanceMember
|
| ? instanceFieldAccessorName(element)
|
| : getNameOfField(element);
|
| }
|
| @@ -474,7 +474,7 @@ class Namer implements ClosureNamer {
|
| * field.
|
| */
|
| String fieldPropertyName(Element element) {
|
| - return element.isInstanceMember()
|
| + return element.isInstanceMember
|
| ? instanceFieldPropertyName(element)
|
| : getNameOfField(element);
|
| }
|
| @@ -483,7 +483,7 @@ class Namer implements ClosureNamer {
|
| * Returns name of accessor (root to getter and setter) for an instance field.
|
| */
|
| String instanceFieldAccessorName(Element element) {
|
| - String proposedName = privateName(element.getLibrary(), element.name);
|
| + String proposedName = privateName(element.library, element.name);
|
| return getMappedInstanceName(proposedName);
|
| }
|
|
|
| @@ -495,38 +495,38 @@ class Namer implements ClosureNamer {
|
| * Returns name of the JavaScript property used to store an instance field.
|
| */
|
| String instanceFieldPropertyName(Element element) {
|
| - if (element.hasFixedBackendName()) {
|
| - return element.fixedBackendName();
|
| + if (element.hasFixedBackendName) {
|
| + return element.fixedBackendName;
|
| }
|
| // If a class is used anywhere as a mixin, we must make the name unique so
|
| // that it does not accidentally shadow. Also, the mixin name must be
|
| // constant over all mixins.
|
| - if (compiler.world.isUsedAsMixin(element.getEnclosingClass()) ||
|
| + if (compiler.world.isUsedAsMixin(element.enclosingClass) ||
|
| shadowingAnotherField(element)) {
|
| // Construct a new name for the element based on the library and class it
|
| // is in. The name here is not important, we just need to make sure it is
|
| // unique. If we are minifying, we actually construct the name from the
|
| // minified version of the class name, but the result is minified once
|
| // again, so that is not visible in the end result.
|
| - String libraryName = getNameOfLibrary(element.getLibrary());
|
| - String className = getNameOfClass(element.getEnclosingClass());
|
| - String instanceName = privateName(element.getLibrary(), element.name);
|
| + String libraryName = getNameOfLibrary(element.library);
|
| + String className = getNameOfClass(element.enclosingClass);
|
| + String instanceName = privateName(element.library, element.name);
|
| return getMappedInstanceName('$libraryName\$$className\$$instanceName');
|
| }
|
|
|
| - String proposedName = privateName(element.getLibrary(), element.name);
|
| + String proposedName = privateName(element.library, element.name);
|
| return getMappedInstanceName(proposedName);
|
| }
|
|
|
|
|
| bool shadowingAnotherField(Element element) {
|
| - return element.getEnclosingClass().hasFieldShadowedBy(element);
|
| + return element.enclosingClass.hasFieldShadowedBy(element);
|
| }
|
|
|
| String setterName(Element element) {
|
| // We dynamically create setters from the field-name. The setter name must
|
| // therefore be derived from the instance field-name.
|
| - LibraryElement library = element.getLibrary();
|
| + LibraryElement library = element.library;
|
| String name = getMappedInstanceName(privateName(library, element.name));
|
| return '$setterPrefix$name';
|
| }
|
| @@ -546,7 +546,7 @@ class Namer implements ClosureNamer {
|
| String getterName(Element element) {
|
| // We dynamically create getters from the field-name. The getter name must
|
| // therefore be derived from the instance field-name.
|
| - LibraryElement library = element.getLibrary();
|
| + LibraryElement library = element.library;
|
| String name = getMappedInstanceName(privateName(library, element.name));
|
| return '$getterPrefix$name';
|
| }
|
| @@ -614,25 +614,25 @@ class Namer implements ClosureNamer {
|
| * The returned id is guaranteed to be a valid JS-id.
|
| */
|
| String _computeGuess(Element element) {
|
| - assert(!element.isInstanceMember());
|
| + assert(!element.isInstanceMember);
|
| String name;
|
| - if (element.isGenerativeConstructor()) {
|
| - name = "${element.getEnclosingClass().name}\$"
|
| + if (element.isGenerativeConstructor) {
|
| + name = "${element.enclosingClass.name}\$"
|
| "${element.name}";
|
| - } else if (element.isFactoryConstructor()) {
|
| + } else if (element.isFactoryConstructor) {
|
| // TODO(johnniwinther): Change factory name encoding as to not include
|
| // the class-name twice.
|
| - String className = element.getEnclosingClass().name;
|
| + String className = element.enclosingClass.name;
|
| name = '${className}_${Elements.reconstructConstructorName(element)}';
|
| } else if (Elements.isStaticOrTopLevel(element)) {
|
| - if (element.isMember()) {
|
| - ClassElement enclosingClass = element.getEnclosingClass();
|
| + if (element.isMember) {
|
| + ClassElement enclosingClass = element.enclosingClass;
|
| name = "${enclosingClass.name}_"
|
| "${element.name}";
|
| } else {
|
| name = element.name.replaceAll('+', '_');
|
| }
|
| - } else if (element.isLibrary()) {
|
| + } else if (element.isLibrary) {
|
| LibraryElement library = element;
|
| name = library.getLibraryOrScriptName();
|
| if (name.contains('.')) {
|
| @@ -715,7 +715,7 @@ class Namer implements ClosureNamer {
|
| // clash.
|
| // TODO(sra): Find a way to get the simple name when Object is not in the
|
| // set of classes for most general variant, e.g. "$lt$n" could be "$lt".
|
| - if (selector.isGetter() || selector.isSetter()) root = '$root\$';
|
| + if (selector.isGetter || selector.isSetter) root = '$root\$';
|
| return getMappedGlobalName(root, ensureSafe: false);
|
| } else {
|
| String suffix = getInterceptorSuffix(classes);
|
| @@ -740,7 +740,7 @@ class Namer implements ClosureNamer {
|
| // TODO(ahe): This is an internal method to the Namer (and its subclasses)
|
| // and should not be call from outside.
|
| String getNameX(Element element) {
|
| - if (element.isInstanceMember()) {
|
| + if (element.isInstanceMember) {
|
| if (element.kind == ElementKind.GENERATIVE_CONSTRUCTOR_BODY
|
| || element.kind == ElementKind.FUNCTION) {
|
| return instanceMethodName(element);
|
| @@ -781,7 +781,7 @@ class Namer implements ClosureNamer {
|
| kind == ElementKind.LIBRARY) {
|
| bool fixedName = false;
|
| if (Elements.isInstanceField(element)) {
|
| - fixedName = element.hasFixedBackendName();
|
| + fixedName = element.hasFixedBackendName;
|
| }
|
| String result = fixedName
|
| ? guess
|
| @@ -822,17 +822,17 @@ class Namer implements ClosureNamer {
|
| // TODO(ahe): Re-write these tests to be positive (so it only returns
|
| // true for static/top-level mutable fields). Right now, a number of
|
| // other elements, such as bound closures also live in [currentIsolate].
|
| - !element.isAccessor() &&
|
| - !element.isClass() &&
|
| - !element.isConstructor() &&
|
| - !element.isFunction() &&
|
| - !element.isLibrary();
|
| + !element.isAccessor &&
|
| + !element.isClass &&
|
| + !element.isConstructor &&
|
| + !element.isFunction &&
|
| + !element.isLibrary;
|
| }
|
|
|
| /// Returns [currentIsolate] or one of [reservedGlobalObjectNames].
|
| String globalObjectFor(Element element) {
|
| if (isPropertyOfCurrentIsolate(element)) return currentIsolate;
|
| - LibraryElement library = element.getLibrary();
|
| + LibraryElement library = element.library;
|
| if (library == compiler.interceptorsLibrary) return 'J';
|
| if (library.isInternalLibrary) return 'H';
|
| if (library.isPlatformLibrary) {
|
|
|