Package com.google.dart.engine.ast

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


    @Override
    public Element visitIdentifier(Identifier node) {
      AstNode parent = node.getParent();
      // Type name in Annotation
      if (parent instanceof Annotation) {
        Annotation annotation = (Annotation) parent;
        if (annotation.getName() == node && annotation.getConstructorName() == null) {
          return annotation.getElement();
        }
      }
      // Extra work to map Constructor Declarations to their associated Constructor Elements
      if (parent instanceof ConstructorDeclaration) {
        ConstructorDeclaration decl = (ConstructorDeclaration) parent;
View Full Code Here


              StaticWarningCode.UNDEFINED_SETTER,
              identifier,
              identifier.getName(),
              prefixElement.getName());
        } else if (node.getParent() instanceof Annotation) {
          Annotation annotation = (Annotation) node.getParent();
          resolver.reportErrorForNode(CompileTimeErrorCode.INVALID_ANNOTATION, annotation);
          return null;
        } else {
          resolver.reportErrorForNode(
              StaticWarningCode.UNDEFINED_GETTER,
              identifier,
              identifier.getName(),
              prefixElement.getName());
        }
        return null;
      }
      if (element instanceof PropertyAccessorElement && identifier.inSetterContext()) {
        PropertyInducingElement variable = ((PropertyAccessorElement) element).getVariable();
        if (variable != null) {
          PropertyAccessorElement setter = variable.getSetter();
          if (setter != null) {
            element = setter;
          }
        }
      }
      // TODO(brianwilkerson) The prefix needs to be resolved to the element for the import that
      // defines the prefix, not the prefix's element.
      identifier.setStaticElement(element);
      // Validate annotation element.
      if (node.getParent() instanceof Annotation) {
        Annotation annotation = (Annotation) node.getParent();
        resolveAnnotationElement(annotation);
        return null;
      }
      return null;
    }

    // May be annotation, resolve invocation of "const" constructor.
    if (node.getParent() instanceof Annotation) {
      Annotation annotation = (Annotation) node.getParent();
      resolveAnnotationElement(annotation);
    }

    //
    // Otherwise, the prefix is really an expression that happens to be a simple identifier and this
View Full Code Here

    } else if (element == null || (element instanceof PrefixElement && !isValidAsPrefix(node))) {
      // TODO(brianwilkerson) Recover from this error.
      if (isConstructorReturnType(node)) {
        resolver.reportErrorForNode(CompileTimeErrorCode.INVALID_CONSTRUCTOR_NAME, node);
      } else if (node.getParent() instanceof Annotation) {
        Annotation annotation = (Annotation) node.getParent();
        resolver.reportErrorForNode(CompileTimeErrorCode.INVALID_ANNOTATION, annotation);
      } else {
        if (doesntHaveProxy(resolver.getEnclosingClass())) {
          resolver.reportErrorForNode(StaticWarningCode.UNDEFINED_IDENTIFIER, node, node.getName());
        }
      }
    }

    node.setStaticElement(element);
    if (node.inSetterContext() && node.inGetterContext() && enclosingClass != null) {
      InterfaceType enclosingType = enclosingClass.getType();
      AuxiliaryElements auxiliaryElements = new AuxiliaryElements(lookUpGetter(
          null,
          enclosingType,
          node.getName()), null);
      node.setAuxiliaryElements(auxiliaryElements);
    }

    //
    // Validate annotation element.
    //
    if (node.getParent() instanceof Annotation) {
      Annotation annotation = (Annotation) node.getParent();
      resolveAnnotationElement(annotation);
    }
    return null;
  }
View Full Code Here

   */
  private void addAnnotations(ArrayList<ElementAnnotationImpl> annotationList,
      NodeList<Annotation> annotations) {
    int annotationCount = annotations.size();
    for (int i = 0; i < annotationCount; i++) {
      Annotation annotation = annotations.get(i);
      Element resolvedElement = annotation.getElement();
      if (resolvedElement != null) {
        ElementAnnotationImpl elementAnnotation = new ElementAnnotationImpl(resolvedElement);
        annotation.setElementAnnotation(elementAnnotation);
        annotationList.add(elementAnnotation);
      }
    }
  }
View Full Code Here

TOP

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

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.