Package com.google.dart.engine.internal.type

Examples of com.google.dart.engine.internal.type.FunctionTypeImpl


      ((VariableElementImpl) element).setType(declaredType);
      if (element instanceof PropertyInducingElement) {
        PropertyInducingElement variableElement = (PropertyInducingElement) element;
        PropertyAccessorElementImpl getter = (PropertyAccessorElementImpl) variableElement.getGetter();
        getter.setReturnType(declaredType);
        FunctionTypeImpl getterType = new FunctionTypeImpl(getter);
        ClassElement definingClass = element.getAncestor(ClassElement.class);
        if (definingClass != null) {
          getterType.setTypeArguments(definingClass.getType().getTypeArguments());
        }
        getter.setType(getterType);

        PropertyAccessorElementImpl setter = (PropertyAccessorElementImpl) variableElement.getSetter();
        if (setter != null) {
          ParameterElement[] parameters = setter.getParameters();
          if (parameters.length > 0) {
            ((ParameterElementImpl) parameters[0]).setType(declaredType);
          }
          setter.setReturnType(VoidTypeImpl.getInstance());
          FunctionTypeImpl setterType = new FunctionTypeImpl(setter);
          if (definingClass != null) {
            setterType.setTypeArguments(definingClass.getType().getTypeArguments());
          }
          setter.setType(setterType);
        }
      }
    } else {
View Full Code Here


            parameterTypes));
        implicitParameters[i] = implicitParameter;
      }
      implicitConstructor.setParameters(implicitParameters);
    }
    FunctionTypeImpl type = new FunctionTypeImpl(implicitConstructor);
    type.setTypeArguments(classType.getTypeArguments());
    implicitConstructor.setType(type);
    return implicitConstructor;
  }
View Full Code Here

    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);
      }
    }
    element.setType(type);
  }
View Full Code Here

TOP

Related Classes of com.google.dart.engine.internal.type.FunctionTypeImpl

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.