Package com.google.dart.engine.element

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


   * this expression.
   *
   * @return the element representing the parameter being named by this expression
   */
  public ParameterElement getElement() {
    Element element = name.getLabel().getStaticElement();
    if (element instanceof ParameterElement) {
      return (ParameterElement) element;
    }
    return null;
  }
View Full Code Here


   *
   * @param element the element whose location is being represented
   */
  public ElementLocationImpl(Element element) {
    ArrayList<String> components = new ArrayList<String>();
    Element ancestor = element;
    while (ancestor != null) {
      components.add(0, ((ElementImpl) ancestor).getIdentifier());
      ancestor = ancestor.getEnclosingElement();
    }
    this.components = components.toArray(new String[components.size()]);
  }
View Full Code Here

   */
  private boolean checkForIsDoubleHints(IsExpression node) {
    TypeName typeName = node.getType();
    Type type = typeName.getType();
    if (type != null && type.getElement() != null) {
      Element element = type.getElement();
      String typeNameStr = element.getName();
      LibraryElement libraryElement = element.getLibrary();
//      if (typeNameStr.equals(INT_TYPE_NAME) && libraryElement != null
//          && libraryElement.isDartCore()) {
//        if (node.getNotOperator() == null) {
//          errorReporter.reportError(HintCode.IS_INT, node);
//        } else {
View Full Code Here

      return null;
    }
    SimpleStringLiteral literal = (SimpleStringLiteral) node;
    // maybe has PolymerElement
    {
      Element element = literal.getToolkitElement();
      if (element instanceof PolymerElement) {
        return element;
      }
    }
    // no Element
View Full Code Here

  /**
   * Checks if given {@link Annotation} is an annotation with required name.
   */
  private boolean isAnnotation(Annotation annotation, String name) {
    Element element = annotation.getElement();
    if (element instanceof ConstructorElement) {
      ConstructorElement constructorElement = (ConstructorElement) element;
      return constructorElement.getReturnType().getDisplayName().equals(name);
    }
    return false;
View Full Code Here

      }
    }
    // read Element(s)
    int numElements = dis.readInt();
    for (int i = 0; i < numElements; i++) {
      Element element = readElement();
      Relationship relationship = readRelationship();
      // read Location(s)
      int numLocations = dis.readInt();
      for (int j = 0; j < numLocations; j++) {
        Location location = readLocation();
View Full Code Here

    ElementLocation elementLocation = new ElementLocationImpl(elementLocationEncoding);
    return context.getElement(elementLocation);
  }

  private Location readLocation() throws IOException {
    Element locationElement = readElement();
    int offset = dis.readInt();
    int length = dis.readInt();
    return new Location(locationElement, offset, length);
  }
View Full Code Here

  public void write() throws IOException {
    dos.writeInt(FILE_VERSION_NUMBER);
    // prepare Element(s) to write relations for
    List<ElementRelationKey> keysToWrite = Lists.newArrayList();
    for (ElementRelationKey key : impl.keyToLocations.keySet()) {
      Element element = key.element;
      if (!isElementOfContext(element)) {
        continue;
      }
      keysToWrite.add(key);
    }
View Full Code Here

    }

    @Override
    public boolean equals(Object obj) {
      ElementRelationKey other = (ElementRelationKey) obj;
      Element otherElement = other.element;
      return other.relationship == relationship
          && otherElement.getNameOffset() == element.getNameOffset()
          && otherElement.getKind() == element.getKind()
          && Objects.equal(otherElement.getDisplayName(), element.getDisplayName())
          && Objects.equal(otherElement.getSource(), element.getSource());
    }
View Full Code Here

   * {@link Reference} with this {@link Element}.
   */
  private Reference getReferenceAtNode(AstNode root, int offset) {
    AstNode node = new NodeLocator(offset).searchWithin(root);
    if (node != null) {
      Element element = ElementLocator.locate(node);
      return new Reference(element, node.getOffset(), node.getLength());
    }
    return null;
  }
View Full Code Here

TOP

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

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.