Package com.google.dart.engine.element

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


    return typeArguments;
  }

  @Override
  public TypeParameterElement[] getTypeParameters() {
    Element element = getElement();
    if (element instanceof FunctionTypeAliasElement) {
      return ((FunctionTypeAliasElement) element).getTypeParameters();
    }
    ClassElement definingClass = element.getAncestor(ClassElement.class);
    if (definingClass != null) {
      return definingClass.getTypeParameters();
    }
    return TypeParameterElementImpl.EMPTY_ARRAY;
  }
View Full Code Here


          + ") != parameterTypes.length (" + parameterTypes.length + ")");
    }
    if (argumentTypes.length == 0) {
      return this;
    }
    Element element = getElement();
    FunctionTypeImpl newType = (element instanceof ExecutableElement) ? new FunctionTypeImpl(
        (ExecutableElement) element) : new FunctionTypeImpl((FunctionTypeAliasElement) element);
    newType.setTypeArguments(substitute(typeArguments, argumentTypes, parameterTypes));
    return newType;
  }
View Full Code Here

  /**
   * @return the base parameter elements of this function element, not {@code null}.
   */
  protected ParameterElement[] getBaseParameters() {
    Element element = getElement();
    if (element instanceof ExecutableElement) {
      return ((ExecutableElement) element).getParameters();
    } else {
      return ((FunctionTypeAliasElement) element).getParameters();
    }
View Full Code Here

   * Return the return type defined by this function's element.
   *
   * @return the return type defined by this function's element
   */
  private Type getBaseReturnType() {
    Element element = getElement();
    if (element instanceof ExecutableElement) {
      return ((ExecutableElement) element).getReturnType();
    } else {
      return ((FunctionTypeAliasElement) element).getReturnType();
    }
View Full Code Here

  @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 Element} to open when requested at the given {@link Expression}.
   */
  public static Element getElementToOpen(HtmlUnit htmlUnit, Expression expression) {
    Element element = getElement(expression);
    {
      AngularElement angularElement = AngularHtmlUnitResolver.getAngularElement(element);
      if (angularElement != null) {
        return angularElement;
      }
View Full Code Here

  @Override
  public void visitExpression(Expression expression) {
    // Formatter
    if (expression instanceof SimpleIdentifier) {
      SimpleIdentifier identifier = (SimpleIdentifier) expression;
      Element element = identifier.getBestElement();
      if (element instanceof AngularElement) {
        store.recordRelationship(
            element,
            IndexConstants.ANGULAR_REFERENCE,
            createLocationForIdentifier(identifier));
View Full Code Here

    return super.visitHtmlUnit(node);
  }

  @Override
  public Void visitXmlAttributeNode(XmlAttributeNode node) {
    Element element = node.getElement();
    if (element != null) {
      Token nameToken = node.getNameToken();
      Location location = createLocationForToken(nameToken);
      store.recordRelationship(element, IndexConstants.ANGULAR_REFERENCE, location);
    }
View Full Code Here

    return valid(typeProvider.getMapType(), new MapState(map));
  }

  @Override
  public EvaluationResultImpl visitMethodInvocation(MethodInvocation node) {
    Element element = node.getMethodName().getStaticElement();
    if (element instanceof FunctionElement) {
      FunctionElement function = (FunctionElement) element;
      if (function.getName().equals("identical")) {
        NodeList<Expression> arguments = node.getArgumentList().getArguments();
        if (arguments.size() == 2) {
          Element enclosingElement = function.getEnclosingElement();
          if (enclosingElement instanceof CompilationUnitElement) {
            LibraryElement library = ((CompilationUnitElement) enclosingElement).getLibrary();
            if (library.isDartCore()) {
              EvaluationResultImpl leftArgument = arguments.get(0).accept(this);
              EvaluationResultImpl rightArgument = arguments.get(1).accept(this);
View Full Code Here

//    if (isStringLength(element)) {
//      EvaluationResultImpl target = node.getPrefix().accept(this);
//      return target.stringLength(typeProvider, node);
//    }
    SimpleIdentifier prefixNode = node.getPrefix();
    Element prefixElement = prefixNode.getStaticElement();
    if (!(prefixElement instanceof PrefixElement)) {
      EvaluationResultImpl prefixResult = prefixNode.accept(this);
      if (!(prefixResult instanceof ValidResult)) {
        return error(node, 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.