Package com.google.dart.engine.element

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


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


      }

      private boolean isViewFactory(Expression target) {
        if (target instanceof SimpleIdentifier) {
          SimpleIdentifier identifier = (SimpleIdentifier) target;
          Element element = identifier.getStaticElement();
          if (element instanceof VariableElement) {
            VariableElement variable = (VariableElement) element;
            Type type = variable.getType();
            if (type instanceof InterfaceType) {
              InterfaceType interfaceType = (InterfaceType) type;
View Full Code Here

            // Initialize prefixElementMap
            //
            if (importDirective.getAsToken() != null) {
              SimpleIdentifier prefixIdentifier = importDirective.getPrefix();
              if (prefixIdentifier != null) {
                Element element = prefixIdentifier.getStaticElement();
                if (element instanceof PrefixElement) {
                  PrefixElement prefixElementKey = (PrefixElement) element;
                  ArrayList<ImportDirective> list = prefixElementMap.get(prefixElementKey);
                  if (list == null) {
                    list = new ArrayList<ImportDirective>(1);
View Full Code Here

    }
    // If the prefixed identifier references some A.B, where A is a library prefix, then we can
    // lookup the associated ImportDirective in prefixElementMap and remove it from the
    // unusedImports list.
    SimpleIdentifier prefixIdentifier = node.getPrefix();
    Element element = prefixIdentifier.getStaticElement();
    if (element instanceof PrefixElement) {
      ArrayList<ImportDirective> importDirectives = prefixElementMap.get(element);
      if (importDirectives != null) {
        for (ImportDirective importDirective : importDirectives) {
          unusedImports.remove(importDirective);
View Full Code Here

  }

  @Override
  @SuppressWarnings("unchecked")
  public <E extends Element> E getAncestor(Class<E> elementClass) {
    Element ancestor = enclosingElement;
    while (ancestor != null && !elementClass.isInstance(ancestor)) {
      ancestor = ancestor.getEnclosingElement();
    }
    return (E) ancestor;
  }
View Full Code Here

  public int hashCode() {
    // TODO: We might want to re-visit this optimization in the future.
    // We cache the hash code value as this is a very frequently called method.
    if (cachedHashCode == 0) {
      int hashIdentifier = getIdentifier().hashCode();
      Element enclosing = getEnclosingElement();
      if (enclosing != null) {
        cachedHashCode = hashIdentifier + enclosing.hashCode();
      } else {
        cachedHashCode = hashIdentifier;
      }
    }
    return cachedHashCode;
View Full Code Here

        // the is not case
        errorReporter.reportErrorForNode(HintCode.UNNECESSARY_TYPE_CHECK_FALSE, node);
      }
      return true;
    }
    Element rhsElement = rhsType.getElement();
    LibraryElement libraryElement = rhsElement != null ? rhsElement.getLibrary() : null;
    if (libraryElement != null && libraryElement.isDartCore()) {
      // if x is Object or null is Null
      if (rhsType.isObject()
          || (expression instanceof NullLiteral && rhsNameStr.equals(NULL_TYPE_NAME))) {
        if (node.getNotOperator() == null) {
View Full Code Here

   *
   * @param expression some conditional expression
   * @return {@code true} if and only if the passed expression is resolved to a constant variable
   */
  private boolean isDebugConstant(Expression expression) {
    Element element = null;
    if (expression instanceof Identifier) {
      Identifier identifier = (Identifier) expression;
      element = identifier.getStaticElement();
    } else if (expression instanceof PropertyAccess) {
      PropertyAccess propertyAccess = (PropertyAccess) expression;
View Full Code Here

    assertBoolNumStringOrNull(rightOperand);
    if (element == null) {
      return BoolState.UNKNOWN_VALUE;
    }
    if (rightOperand instanceof TypeState) {
      Element rightElement = ((TypeState) rightOperand).element;
      if (rightElement == null) {
        return BoolState.UNKNOWN_VALUE;
      }
      return BoolState.from(element.equals(rightElement));
    } else if (rightOperand instanceof DynamicState) {
View Full Code Here

    // prepare environment
    AstNode parent = prefixNode.getParent();
    CompilationUnit unit = prefixNode.getAncestor(CompilationUnit.class);
    LibraryElement libraryElement = unit.getElement().getLibrary();
    // prepare used element
    Element usedElement = null;
    if (parent instanceof PrefixedIdentifier) {
      PrefixedIdentifier prefixed = (PrefixedIdentifier) parent;
      if (prefixed.getPrefix() == prefixNode) {
        usedElement = prefixed.getStaticElement();
        info.periodEnd = prefixed.getPeriod().getEnd();
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.