Package com.google.dart.engine.type

Examples of com.google.dart.engine.type.Type


      TypeArgumentList typeArguments) {
    NodeList<TypeName> typeNames = typeArguments.getArguments();
    if (typeNames.size() < 1) {
      return false;
    }
    Type listElementType = typeNames.get(0).getType();
    // Prepare problem to report.
    ErrorCode errorCode;
    if (node.getConstKeyword() != null) {
      errorCode = CompileTimeErrorCode.LIST_ELEMENT_TYPE_NOT_ASSIGNABLE;
    } else {
View Full Code Here


    // Prepare maps key/value types.
    NodeList<TypeName> typeNames = typeArguments.getArguments();
    if (typeNames.size() < 2) {
      return false;
    }
    Type keyType = typeNames.get(0).getType();
    Type valueType = typeNames.get(1).getType();
    // Prepare problem to report.
    ErrorCode keyErrorCode;
    ErrorCode valueErrorCode;
    if (node.getConstKeyword() != null) {
      keyErrorCode = CompileTimeErrorCode.MAP_KEY_TYPE_NOT_ASSIGNABLE;
View Full Code Here

        return false;
      }
    }

    // Default of null == no accessor or no type (dynamic)
    Type getterType = null;
    Type setterType = null;

    // Get an existing counterpart accessor if any.
    if (propertyAccessorElement.isGetter()) {
      getterType = getGetterType(propertyAccessorElement);
      setterType = getSetterType(counterpartAccessor);
View Full Code Here

   * @return {@code true} if and only if an error code is generated on the passed node
   */
  private boolean checkForMissingEnumConstantInSwitch(SwitchStatement statement) {
    // TODO(brianwilkerson) This needs to be checked after constant values have been computed.
    Expression expression = statement.getExpression();
    Type expressionType = getStaticType(expression);
    if (expressionType == null) {
      return false;
    }
    Element expressionElement = expressionType.getElement();
    if (!(expressionElement instanceof ClassElement)) {
      return false;
    }
    ClassElement classElement = (ClassElement) expressionElement;
    if (!classElement.isEnum()) {
View Full Code Here

      ConstructorName constructorName, TypeName typeName) {
    // OK if resolved
    if (node.getStaticElement() != null) {
      return false;
    }
    Type type = typeName.getType();
    if (type instanceof InterfaceType) {
      ClassElement element = ((InterfaceType) type).getElement();
      if (element != null && element.isEnum()) {
        // We have already reported the error.
        return false;
View Full Code Here

   * @param condition the conditional expression to test
   * @return {@code true} if and only if an error code is generated on the passed node
   * @see StaticTypeWarningCode#NON_BOOL_CONDITION
   */
  private boolean checkForNonBoolCondition(Expression condition) {
    Type conditionType = getStaticType(condition);
    if (conditionType != null && !conditionType.isAssignableTo(boolType)) {
      errorReporter.reportErrorForNode(StaticTypeWarningCode.NON_BOOL_CONDITION, condition);
      return true;
    }
    return false;
  }
View Full Code Here

   * @return {@code true} if and only if an error code is generated on the passed node
   * @see StaticTypeWarningCode#NON_BOOL_EXPRESSION
   */
  private boolean checkForNonBoolExpression(AssertStatement node) {
    Expression expression = node.getCondition();
    Type type = getStaticType(expression);
    if (type instanceof InterfaceType) {
      if (!type.isAssignableTo(boolType)) {
        errorReporter.reportErrorForNode(StaticTypeWarningCode.NON_BOOL_EXPRESSION, expression);
        return true;
      }
    } else if (type instanceof FunctionType) {
      FunctionType functionType = (FunctionType) type;
View Full Code Here

   * @param expression the expression expression to test
   * @return {@code true} if and only if an error code is generated on the passed node
   * @see StaticTypeWarningCode#NON_BOOL_NEGATION_EXPRESSION
   */
  private boolean checkForNonBoolNegationExpression(Expression expression) {
    Type conditionType = getStaticType(expression);
    if (conditionType != null && !conditionType.isAssignableTo(boolType)) {
      errorReporter.reportErrorForNode(
          StaticTypeWarningCode.NON_BOOL_NEGATION_EXPRESSION,
          expression);
      return true;
    }
View Full Code Here

      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
    return false;
View Full Code Here

   * @return {@code true} if and only if an error code is generated on the passed node
   * @see StaticWarningCode#NON_VOID_RETURN_FOR_SETTER
   */
  private boolean checkForNonVoidReturnTypeForSetter(TypeName typeName) {
    if (typeName != null) {
      Type type = typeName.getType();
      if (type != null && !type.isVoid()) {
        errorReporter.reportErrorForNode(StaticWarningCode.NON_VOID_RETURN_FOR_SETTER, typeName);
      }
    }
    return false;
  }
View Full Code Here

TOP

Related Classes of com.google.dart.engine.type.Type

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.