Package com.google.dart.engine.index

Examples of com.google.dart.engine.index.Location


        int offset = property.getFieldNameOffset();
        if (offset == -1) {
          continue;
        }
        int length = field.getName().length();
        Location location = new Location(property, offset, length);
        // getter reference
        if (property.getPropertyKind().callsGetter()) {
          PropertyAccessorElement getter = field.getGetter();
          if (getter != null) {
            store.recordRelationship(getter, IndexConstants.IS_REFERENCED_BY_QUALIFIED, location);
View Full Code Here


  @VisibleForTesting
  public static Location createLocation(Element element) {
    if (element != null) {
      int offset = element.getNameOffset();
      int length = element.getDisplayName().length();
      return new Location(element, offset, length);
    }
    return null;
  }
View Full Code Here

  @Override
  public Void visitConstructorDeclaration(ConstructorDeclaration node) {
    ConstructorElement element = node.getElement();
    // define
    {
      Location location;
      if (node.getName() != null) {
        int start = node.getPeriod().getOffset();
        int end = node.getName().getEnd();
        location = createLocationFromOffset(start, end - start);
      } else {
View Full Code Here

    // in 'class B = A;' actually A constructors are invoked
    if (element != null && element.isSynthetic() && element.getRedirectedConstructor() != null) {
      element = element.getRedirectedConstructor();
    }
    // prepare location
    Location location;
    if (node.getName() != null) {
      int start = node.getPeriod().getOffset();
      int end = node.getName().getEnd();
      location = createLocationFromOffset(start, end - start);
    } else {
View Full Code Here

  @Override
  public Void visitIndexExpression(IndexExpression node) {
    MethodElement element = node.getBestElement();
    if (element instanceof MethodElement) {
      Token operator = node.getLeftBracket();
      Location location = createLocationFromToken(operator);
      recordRelationship(element, IndexConstants.IS_INVOKED_BY_QUALIFIED, location);
    }
    return super.visitIndexExpression(node);
  }
View Full Code Here

  @Override
  public Void visitMethodInvocation(MethodInvocation node) {
    SimpleIdentifier name = node.getMethodName();
    Element element = name.getBestElement();
    if (element instanceof MethodElement || element instanceof PropertyAccessorElement) {
      Location location = createLocationFromNode(name);
      Relationship relationship;
      if (node.getTarget() != null) {
        relationship = IndexConstants.IS_INVOKED_BY_QUALIFIED;
      } else {
        relationship = IndexConstants.IS_INVOKED_BY_UNQUALIFIED;
      }
      recordRelationship(element, relationship, location);
    }
    if (element instanceof FunctionElement || element instanceof VariableElement) {
      Location location = createLocationFromNode(name);
      recordRelationship(element, IndexConstants.IS_INVOKED_BY, location);
    }
    // name invocation
    {
      Element nameElement = new NameElementImpl(name.getName());
      Location location = createLocationFromNode(name);
      Relationship kind = element != null ? IndexConstants.NAME_IS_INVOKED_BY_RESOLVED
          : IndexConstants.NAME_IS_INVOKED_BY_UNRESOLVED;
      store.recordRelationship(nameElement, kind, location);
    }
    recordImportElementReferenceWithoutPrefix(name);
View Full Code Here

  }

  @Override
  public Void visitPartDirective(PartDirective node) {
    Element element = node.getElement();
    Location location = createLocationFromNode(node.getUri());
    recordRelationship(element, IndexConstants.IS_REFERENCED_BY, location);
    return super.visitPartDirective(node);
  }
View Full Code Here

    return super.visitPartDirective(node);
  }

  @Override
  public Void visitPartOfDirective(PartOfDirective node) {
    Location location = createLocationFromNode(node.getLibraryName());
    recordRelationship(node.getElement(), IndexConstants.IS_REFERENCED_BY, location);
    return null;
  }
View Full Code Here

  }

  @Override
  public Void visitSimpleIdentifier(SimpleIdentifier node) {
    Element nameElement = new NameElementImpl(node.getName());
    Location location = createLocationFromNode(node);
    // name in declaration
    if (node.inDeclarationContext()) {
      recordRelationship(nameElement, IndexConstants.IS_DEFINED_BY, location);
      return null;
    }
View Full Code Here

  }

  @Override
  public Void visitSuperConstructorInvocation(SuperConstructorInvocation node) {
    ConstructorElement element = node.getStaticElement();
    Location location;
    if (node.getConstructorName() != null) {
      int start = node.getPeriod().getOffset();
      int end = node.getConstructorName().getEnd();
      location = createLocationFromOffset(start, end - start);
    } else {
View Full Code Here

TOP

Related Classes of com.google.dart.engine.index.Location

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.