Package com.google.dart.engine.element

Examples of com.google.dart.engine.element.PropertyAccessorElement


      Element element, Location location) {
    // we need accessor
    if (!(element instanceof PropertyAccessorElement)) {
      return location;
    }
    PropertyAccessorElement accessor = (PropertyAccessorElement) element;
    // should be setter
    if (!accessor.isSetter()) {
      return location;
    }
    // accessor should be synthetic, i.e. field normal
    if (!accessor.isSynthetic()) {
      return location;
    }
    // should be LHS of assignment
    AstNode parent;
    {
View Full Code Here


    return ConstructorMember.from(constructorElement, this);
  }

  @Override
  public PropertyAccessorElement lookUpGetter(String getterName, LibraryElement library) {
    PropertyAccessorElement element = getGetter(getterName);
    if (element != null && element.isAccessibleIn(library)) {
      return element;
    }
    return lookUpGetterInSuperclass(getterName, library);
  }
View Full Code Here

  }

  @Override
  public PropertyAccessorElement lookUpGetterInSuperclass(String getterName, LibraryElement library) {
    for (InterfaceType mixin : getMixins()) {
      PropertyAccessorElement element = mixin.getGetter(getterName);
      if (element != null && element.isAccessibleIn(library)) {
        return element;
      }
    }
    HashSet<ClassElement> visitedClasses = new HashSet<ClassElement>();
    InterfaceType supertype = getSuperclass();
    ClassElement supertypeElement = supertype == null ? null : supertype.getElement();
    while (supertype != null && !visitedClasses.contains(supertypeElement)) {
      visitedClasses.add(supertypeElement);
      PropertyAccessorElement element = supertype.getGetter(getterName);
      if (element != null && element.isAccessibleIn(library)) {
        return element;
      }
      for (InterfaceType mixin : supertype.getMixins()) {
        element = mixin.getGetter(getterName);
        if (element != null && element.isAccessibleIn(library)) {
          return element;
        }
      }
      supertype = supertype.getSuperclass();
      supertypeElement = supertype == null ? null : supertype.getElement();
View Full Code Here

    return null;
  }

  @Override
  public PropertyAccessorElement lookUpSetter(String setterName, LibraryElement library) {
    PropertyAccessorElement element = getSetter(setterName);
    if (element != null && element.isAccessibleIn(library)) {
      return element;
    }
    return lookUpSetterInSuperclass(setterName, library);
  }
View Full Code Here

  }

  @Override
  public PropertyAccessorElement lookUpSetterInSuperclass(String setterName, LibraryElement library) {
    for (InterfaceType mixin : getMixins()) {
      PropertyAccessorElement element = mixin.getSetter(setterName);
      if (element != null && element.isAccessibleIn(library)) {
        return element;
      }
    }
    HashSet<ClassElement> visitedClasses = new HashSet<ClassElement>();
    InterfaceType supertype = getSuperclass();
    ClassElement supertypeElement = supertype == null ? null : supertype.getElement();
    while (supertype != null && !visitedClasses.contains(supertypeElement)) {
      visitedClasses.add(supertypeElement);
      PropertyAccessorElement element = supertype.getSetter(setterName);
      if (element != null && element.isAccessibleIn(library)) {
        return element;
      }
      for (InterfaceType mixin : supertype.getMixins()) {
        element = mixin.getSetter(setterName);
        if (element != null && element.isAccessibleIn(library)) {
          return element;
        }
      }
      supertype = supertype.getSuperclass();
      supertypeElement = supertype == null ? null : supertype.getElement();
View Full Code Here

   */
  private boolean isStringLength(Element element) {
    if (!(element instanceof PropertyAccessorElement)) {
      return false;
    }
    PropertyAccessorElement accessor = (PropertyAccessorElement) element;
    if (!accessor.isGetter() || !accessor.getName().equals("length")) {
      return false;
    }
    Element parent = accessor.getEnclosingElement();
    return parent.equals(typeProvider.getStringType().getElement());
  }
View Full Code Here

    this.index = index;
  }

  @Override
  public Set<Type> searchAssignedTypes(PropertyInducingElement variable, SearchScope scope) {
    PropertyAccessorElement setter = variable.getSetter();
    int numRequests = (setter != null ? 2 : 0) + 2;
    // find locations
    final List<Location> locations = Lists.newArrayList();
    final CountDownLatch latch = new CountDownLatch(numRequests);
    class Callback implements RelationshipCallback {
View Full Code Here

  }

  private void searchReferences(PropertyInducingElement field, SearchScope scope,
      SearchFilter filter, SearchListener listener) {
    assert listener != null;
    PropertyAccessorElement getter = field.getGetter();
    PropertyAccessorElement setter = field.getSetter();
    int numRequests = (getter != null ? 4 : 0) + (setter != null ? 2 : 0) + 2;
    listener = applyFilter(filter, listener);
    listener = new CountingSearchListener(numRequests, listener);
    if (getter != null) {
      index.getRelationships(
View Full Code Here

      ExecutableElement overriddenExecutable, ParameterElement[] parameters,
      AstNode[] parameterLocations, SimpleIdentifier errorNameTarget) {
    boolean isGetter = false;
    boolean isSetter = false;
    if (executableElement instanceof PropertyAccessorElement) {
      PropertyAccessorElement accessorElement = (PropertyAccessorElement) executableElement;
      isGetter = accessorElement.isGetter();
      isSetter = accessorElement.isSetter();
    }
    String executableElementName = executableElement.getName();

    FunctionType overridingFT = executableElement.getType();
    FunctionType overriddenFT = overriddenExecutable.getType();
View Full Code Here

    for (VariableDeclaration field : fields.getVariables()) {
      FieldElement element = (FieldElement) field.getElement();
      if (element == null) {
        continue;
      }
      PropertyAccessorElement getter = element.getGetter();
      PropertyAccessorElement setter = element.getSetter();
      SimpleIdentifier fieldName = field.getName();
      if (getter != null) {
        hasProblems |= checkForAllInvalidOverrideErrorCodesForExecutable(
            getter,
            ParameterElementImpl.EMPTY_ARRAY,
            AstNode.EMPTY_ARRAY,
            fieldName);
      }
      if (setter != null) {
        hasProblems |= checkForAllInvalidOverrideErrorCodesForExecutable(
            setter,
            setter.getParameters(),
            new AstNode[] {fieldName},
            fieldName);
      }
    }
    return hasProblems;
View Full Code Here

TOP

Related Classes of com.google.dart.engine.element.PropertyAccessorElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.