Package com.google.dart.engine.internal.element

Examples of com.google.dart.engine.internal.element.FunctionTypeAliasElementImpl


    visitChildren(holder, node);

    SimpleIdentifier aliasName = node.getName();
    ParameterElement[] parameters = holder.getParameters();
    TypeParameterElement[] typeParameters = holder.getTypeParameters();
    FunctionTypeAliasElementImpl element = new FunctionTypeAliasElementImpl(aliasName);
    element.setParameters(parameters);
    element.setTypeParameters(typeParameters);

    FunctionTypeImpl type = new FunctionTypeImpl(element);
    type.setTypeArguments(createTypeParameterTypes(typeParameters));
    element.setType(type);

    currentHolder.addTypeAlias(element);
    aliasName.setStaticElement(element);
    holder.validate();
    return null;
View Full Code Here


  }

  @Override
  public Void visitFunctionTypeAlias(FunctionTypeAlias node) {
    super.visitFunctionTypeAlias(node);
    FunctionTypeAliasElementImpl element = (FunctionTypeAliasElementImpl) node.getElement();
    element.setReturnType(computeReturnType(node.getReturnType()));
    return null;
  }
View Full Code Here

   * @param parameterList the list of parameters to the function
   */
  private void setFunctionTypedParameterType(ParameterElementImpl element, TypeName returnType,
      FormalParameterList parameterList) {
    ParameterElement[] parameters = getElements(parameterList);
    FunctionTypeAliasElementImpl aliasElement = new FunctionTypeAliasElementImpl(null);
    aliasElement.setSynthetic(true);
    aliasElement.shareParameters(parameters);
    aliasElement.setReturnType(computeReturnType(returnType));
    // FunctionTypeAliasElementImpl assumes the enclosing element is a
    // CompilationUnitElement (because non-synthetic function types can only be declared
    // at top level), so to avoid breaking things, go find the compilation unit element.
    aliasElement.setEnclosingElement(element.getAncestor(CompilationUnitElement.class));
    FunctionTypeImpl type = new FunctionTypeImpl(aliasElement);
    ClassElement definingClass = element.getAncestor(ClassElement.class);
    if (definingClass != null) {
      aliasElement.shareTypeParameters(definingClass.getTypeParameters());
      type.setTypeArguments(definingClass.getType().getTypeArguments());
    } else {
      FunctionTypeAliasElement alias = element.getAncestor(FunctionTypeAliasElement.class);
      while (alias != null && alias.isSynthetic()) {
        alias = alias.getAncestor(FunctionTypeAliasElement.class);
      }
      if (alias != null) {
        aliasElement.setTypeParameters(alias.getTypeParameters());
        type.setTypeArguments(alias.getType().getTypeArguments());
      } else {
        type.setTypeArguments(TypeImpl.EMPTY_ARRAY);
      }
    }
View Full Code Here

TOP

Related Classes of com.google.dart.engine.internal.element.FunctionTypeAliasElementImpl

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.