Package com.google.dart.engine.ast

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


    if (result instanceof ValidResult) {
      return EvaluationResult.forValue(((ValidResult) result).getValue());
    }
    ArrayList<AnalysisError> errors = new ArrayList<AnalysisError>();
    for (ErrorResult.ErrorData data : ((ErrorResult) result).getErrorData()) {
      AstNode node = data.getNode();
      errors.add(new AnalysisError(source, node.getOffset(), node.getLength(), data.getErrorCode()));
    }
    return EvaluationResult.forErrors(errors.toArray(new AnalysisError[errors.size()]));
  }
View Full Code Here


    return expression.getOffset();
  }

  @Override
  public Reference getReference(int offset) {
    AstNode node = new NodeLocator(offset).searchWithin(expression);
    if (node != null) {
      Element element = ElementLocator.locate(node);
      return new Reference(element, node.getOffset(), node.getLength());
    }
    return null;
  }
View Full Code Here

   * Returns the {@link Expression} that is part of the given root {@link AstNode} and encloses the
   * given offset.
   */
  private static Expression getExpressionAt(AstNode root, int offset) {
    if (root.getOffset() <= offset && offset <= root.getEnd()) {
      AstNode dartNode = new NodeLocator(offset).searchWithin(root);
      if (dartNode instanceof Expression) {
        return (Expression) dartNode;
      }
    }
    return null;
View Full Code Here

   *         node with {@link PrefixElement}, may be {@code null}.
   */
  public static ImportElementInfo getImportElementInfo(SimpleIdentifier prefixNode) {
    ImportElementInfo info = new ImportElementInfo();
    // 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) {
View Full Code Here

    // accessor should be synthetic, i.e. field normal
    if (!accessor.isSynthetic()) {
      return location;
    }
    // should be LHS of assignment
    AstNode parent;
    {
      AstNode node = identifier;
      parent = node.getParent();
      // new T().field = x;
      if (parent instanceof PropertyAccess) {
        PropertyAccess propertyAccess = (PropertyAccess) parent;
        if (propertyAccess.getPropertyName() == node) {
          node = propertyAccess;
View Full Code Here

  /**
   * @return {@code true} if given "node" is part of an import {@link Combinator}.
   */
  private static boolean isIdentifierInImportCombinator(SimpleIdentifier node) {
    AstNode parent = node.getParent();
    return parent instanceof Combinator;
  }
View Full Code Here

  /**
   * @return {@code true} if given "node" is part of {@link PrefixedIdentifier} "prefix.node".
   */
  private static boolean isIdentifierInPrefixedIdentifier(SimpleIdentifier node) {
    AstNode parent = node.getParent();
    return parent instanceof PrefixedIdentifier
        && ((PrefixedIdentifier) parent).getIdentifier() == node;
  }
View Full Code Here

  /**
   * @return {@code true} if given node already indexed as more interesting reference, so it should
   *         not be indexed again.
   */
  private boolean isAlreadyHandledName(SimpleIdentifier node) {
    AstNode parent = node.getParent();
    if (parent instanceof MethodInvocation) {
      return ((MethodInvocation) parent).getMethodName() == node;
    }
    return false;
  }
View Full Code Here

        continue;
      }
      if (!overriddenNamedPTEntry.getValue().isAssignableTo(overridingType)) {
        // lookup the parameter for the error to select
        ParameterElement parameterToSelect = null;
        AstNode parameterLocationToSelect = null;
        for (int i = 0; i < parameters.length; i++) {
          ParameterElement parameter = parameters[i];
          if (parameter.getParameterKind() == ParameterKind.NAMED
              && overriddenNamedPTEntry.getKey().equals(parameter.getName())) {
            parameterToSelect = parameter;
View Full Code Here

   * @see StaticWarningCode#ASSIGNMENT_TO_METHOD
   */
  private boolean checkForAssignmentToFinal(Expression expression) {
    // prepare element
    Element element = null;
    AstNode highlightedNode = expression;
    if (expression instanceof Identifier) {
      element = ((Identifier) expression).getStaticElement();
      if (expression instanceof PrefixedIdentifier) {
        highlightedNode = ((PrefixedIdentifier) expression).getIdentifier();
      }
View Full Code Here

TOP

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

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.