Package com.google.dart.engine.ast

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


    ConstructorElement redirectedElement = redirectedConstructor.getStaticElement();
    if (redirectedElement == null) {
      //
      // If the element is null, we check for the REDIRECT_TO_MISSING_CONSTRUCTOR case
      //
      TypeName constructorTypeName = redirectedConstructor.getType();
      Type redirectedType = constructorTypeName.getType();
      if (redirectedType != null && redirectedType.getElement() != null
          && !redirectedType.isDynamic()) {
        //
        // Prepare the constructor name
        //
        String constructorStrName = constructorTypeName.getName().getName();
        if (redirectedConstructor.getName() != null) {
          constructorStrName += '.' + redirectedConstructor.getName().getName();
        }
        ErrorCode errorCode = node.getConstKeyword() != null
            ? CompileTimeErrorCode.REDIRECT_TO_MISSING_CONSTRUCTOR
View Full Code Here


    SimpleIdentifier name = node.getName();
    if (!name.getName().equals("[]=")) {
      return false;
    }
    // check return type
    TypeName typeName = node.getReturnType();
    if (typeName != null) {
      Type type = typeName.getType();
      if (type != null && !type.isVoid()) {
        errorReporter.reportErrorForNode(StaticWarningCode.NON_VOID_RETURN_FOR_OPERATOR, typeName);
      }
    }
    // no warning
View Full Code Here

    NodeList<TypeName> typeNameArgList = node.getTypeArguments().getArguments();
    Type[] typeArguments = ((InterfaceType) type).getTypeArguments();
    int loopThroughIndex = Math.min(typeNameArgList.size(), boundingElts.length);
    boolean foundError = false;
    for (int i = 0; i < loopThroughIndex; i++) {
      TypeName argTypeName = typeNameArgList.get(i);
      Type argType = argTypeName.getType();
      Type boundType = boundingElts[i].getBound();
      if (argType != null && boundType != null) {
        if (typeArguments.length != 0 && typeArguments.length == typeParameters.length) {
          boundType = boundType.substitute(typeArguments, typeParameters);
        }
View Full Code Here

   * @param node the method declaration to evaluate
   * @return {@code true} if and only if an error code is generated on the passed node
   * @see StaticWarningCode#VOID_RETURN_FOR_GETTER
   */
  private boolean checkForVoidReturnType(MethodDeclaration node) {
    TypeName returnType = node.getReturnType();
    if (returnType == null || !returnType.getName().getName().equals("void")) {
      return false;
    }
    errorReporter.reportErrorForNode(StaticWarningCode.VOID_RETURN_FOR_GETTER, returnType);
    return true;
  }
View Full Code Here

    super.visitCatchClause(node);
    SimpleIdentifier exception = node.getExceptionParameter();
    if (exception != null) {
      // If an 'on' clause is provided the type of the exception parameter is the type in the 'on'
      // clause. Otherwise, the type of the exception parameter is 'Object'.
      TypeName exceptionTypeName = node.getExceptionType();
      Type exceptionType;
      if (exceptionTypeName == null) {
        exceptionType = getTypeProvider().getDynamicType();
      } else {
        exceptionType = getType(exceptionTypeName);
View Full Code Here

  @Override
  public Void visitDeclaredIdentifier(DeclaredIdentifier node) {
    super.visitDeclaredIdentifier(node);
    Type declaredType;
    TypeName typeName = node.getType();
    if (typeName == null) {
      declaredType = dynamicType;
    } else {
      declaredType = getType(typeName);
    }
View Full Code Here

    if (element instanceof ParameterElementImpl) {
      ParameterElementImpl parameter = (ParameterElementImpl) element;
      FormalParameterList parameterList = node.getParameters();
      if (parameterList == null) {
        Type type;
        TypeName typeName = node.getType();
        if (typeName == null) {
          type = dynamicType;
          if (parameter instanceof FieldFormalParameterElement) {
            FieldElement fieldElement = ((FieldFormalParameterElement) parameter).getField();
            if (fieldElement != null) {
View Full Code Here

  @Override
  public Void visitSimpleFormalParameter(SimpleFormalParameter node) {
    super.visitSimpleFormalParameter(node);
    Type declaredType;
    TypeName typeName = node.getType();
    if (typeName == null) {
      declaredType = dynamicType;
    } else {
      declaredType = getType(typeName);
    }
View Full Code Here

      Type[] parameters = getTypeArguments(type);
      int parameterCount = parameters.length;
      Type[] typeArguments = new Type[parameterCount];
      if (argumentCount == parameterCount) {
        for (int i = 0; i < parameterCount; i++) {
          TypeName argumentTypeName = arguments.get(i);
          Type argumentType = getType(argumentTypeName);
          if (argumentType == null) {
            argumentType = dynamicType;
          }
          typeArguments[i] = argumentType;
View Full Code Here

  }

  @Override
  public Void visitTypeParameter(TypeParameter node) {
    super.visitTypeParameter(node);
    TypeName bound = node.getBound();
    if (bound != null) {
      TypeParameterElementImpl typeParameter = (TypeParameterElementImpl) node.getName().getStaticElement();
      if (typeParameter != null) {
        typeParameter.setBound(bound.getType());
      }
    }
    return null;
  }
View Full Code Here

TOP

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

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.