Package com.google.dart.engine.ast

Examples of com.google.dart.engine.ast.Identifier


        }
      }
      // Extra work to map Constructor Declarations to their associated Constructor Elements
      if (parent instanceof ConstructorDeclaration) {
        ConstructorDeclaration decl = (ConstructorDeclaration) parent;
        Identifier returnType = decl.getReturnType();
        if (returnType == node) {
          SimpleIdentifier name = decl.getName();
          if (name != null) {
            return name.getBestElement();
          }
View Full Code Here


   * @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;
      element = propertyAccess.getPropertyName().getStaticElement();
    }
    if (element instanceof PropertyAccessorElement) {
View Full Code Here

    }

    currentHolder.addConstructor(element);
    node.setElement(element);
    if (constructorName == null) {
      Identifier returnType = node.getReturnType();
      if (returnType != null) {
        element.setNameOffset(returnType.getOffset());
      }
    } else {
      constructorName.setStaticElement(element);
    }
    holder.validate();
View Full Code Here

   * Records extends/implements relationships between given {@link ClassElement} and {@link Type} of
   * "superNode".
   */
  private void recordSuperType(TypeName superNode, Relationship relationship) {
    if (superNode != null) {
      Identifier superName = superNode.getName();
      if (superName != null) {
        Element superElement = superName.getStaticElement();
        recordRelationship(superElement, relationship, createLocationFromNode(superNode));
      }
    }
  }
View Full Code Here

  private boolean checkForConstWithTypeParameters(TypeName typeName) {
    // something wrong with AST
    if (typeName == null) {
      return false;
    }
    Identifier name = typeName.getName();
    if (name == null) {
      return false;
    }
    // should not be a type parameter
    if (name.getStaticElement() instanceof TypeParameterElement) {
      errorReporter.reportErrorForNode(CompileTimeErrorCode.CONST_WITH_TYPE_PARAMETERS, name);
    }
    // check type arguments
    TypeArgumentList typeArguments = typeName.getTypeArguments();
    if (typeArguments != null) {
View Full Code Here

      if (element != null && element.isEnum()) {
        // We have already reported the error.
        return false;
      }
    }
    Identifier className = typeName.getName();
    // report as named or default constructor absence
    SimpleIdentifier name = constructorName.getName();
    if (name != null) {
      errorReporter.reportErrorForNode(
          CompileTimeErrorCode.CONST_WITH_UNDEFINED_CONSTRUCTOR,
View Full Code Here

   * @param node the {@link Annotation}
   * @return {@code true} if and only if an error code is generated on the passed node
   * @see CompileTimeErrorCode.INVALID_ANNOTATION_FROM_DEFERRED_LIBRARY
   */
  private boolean checkForInvalidAnnotationFromDeferredLibrary(Annotation node) {
    Identifier nameIdentifier = node.getName();
    if (nameIdentifier instanceof PrefixedIdentifier) {
      if (((PrefixedIdentifier) nameIdentifier).isDeferred()) {
        errorReporter.reportErrorForNode(
            CompileTimeErrorCode.INVALID_ANNOTATION_FROM_DEFERRED_LIBRARY,
            node.getName());
View Full Code Here

        // We have already reported the error.
        return false;
      }
    }
    // prepare class name
    Identifier className = typeName.getName();
    // report as named or default constructor absence
    SimpleIdentifier name = constructorName.getName();
    if (name != null) {
      errorReporter.reportErrorForNode(
          StaticWarningCode.NEW_WITH_UNDEFINED_CONSTRUCTOR,
View Full Code Here

      }
      if (!superUnnamedConstructor.isDefaultConstructor()) {
        int offset;
        int length;
        {
          Identifier returnType = node.getReturnType();
          SimpleIdentifier name = node.getName();
          offset = returnType.getOffset();
          length = (name != null ? name.getEnd() : returnType.getEnd()) - offset;
        }
        errorReporter.reportErrorForOffset(
            CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT,
            offset,
            length,
View Full Code Here

    // case for all annotations in the ElementResolver. The reason we resolve this particular
    // element early is so that ClassElement.isProxy() returns the correct information during all
    // phases of the ElementResolver.
    //
    super.visitAnnotation(node);
    Identifier identifier = node.getName();
    if (identifier.getName().endsWith(ElementAnnotationImpl.PROXY_VARIABLE_NAME)
        && node.getParent() instanceof ClassDeclaration) {
      Element element = getNameScope().lookup(identifier, getDefiningLibrary());
      if (element != null && element.getLibrary().isDartCore()
          && element instanceof PropertyAccessorElement) {
        // This is the @proxy from dart.core
View Full Code Here

TOP

Related Classes of com.google.dart.engine.ast.Identifier

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.