Examples of TypeName


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

   * @see HintCode#UNNECESSARY_TYPE_CHECK_TRUE
   * @see HintCode#UNNECESSARY_TYPE_CHECK_FALSE
   */
  private boolean checkAllTypeChecks(IsExpression node) {
    Expression expression = node.getExpression();
    TypeName typeName = node.getType();
    Type lhsType = expression.getStaticType();
    Type rhsType = typeName.getType();
    if (lhsType == null || rhsType == null) {
      return false;
    }
    String rhsNameStr = typeName.getName().getName();
    // if x is dynamic
    if ((rhsType.isDynamic() && rhsNameStr.equals(Keyword.DYNAMIC.getSyntax()))) {
      if (node.getNotOperator() == null) {
        // the is case
        errorReporter.reportErrorForNode(HintCode.UNNECESSARY_TYPE_CHECK_TRUE, node);
View Full Code Here

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

   * @return {@code true} if and only if a hint code is generated on the passed node
   * @see HintCode#UNNECESSARY_CAST
   */
  private boolean checkForUnnecessaryCast(AsExpression node) {
    Expression expression = node.getExpression();
    TypeName typeName = node.getType();
    Type lhsType = expression.getStaticType();
    Type rhsType = typeName.getType();
    // TODO(jwren) After dartbug.com/13732, revisit this, we should be able to remove the
    // !(x instanceof TypeParameterType) checks.
    if (lhsType != null && rhsType != null && !lhsType.isDynamic() && !rhsType.isDynamic()
        && !(lhsType instanceof TypeParameterType) && !(rhsType instanceof TypeParameterType)
        && lhsType.isMoreSpecificThan(rhsType)) {
View Full Code Here

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

    for (int i = 0; i < numOfCatchClauses; i++) {
      CatchClause catchClause = catchClauses.get(i);
      if (catchClause.getOnKeyword() != null) {
        // on-catch clause found, verify that the exception type is not a subtype of a previous
        // on-catch exception type
        TypeName typeName = catchClause.getExceptionType();
        if (typeName != null && typeName.getType() != null) {
          Type currentType = typeName.getType();
          if (currentType.isObject()) {
            // Found catch clause clause that has Object as an exception type, this is equivalent to
            // having a catch clause that doesn't have an exception type, visit the block, but
            // generate an error on any following catch clauses (and don't visit them).
            safelyVisit(catchClause);
View Full Code Here

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

    try {
      recordElementDefinition(element, IndexConstants.DEFINES_CLASS);
      {
        ExtendsClause extendsClause = node.getExtendsClause();
        if (extendsClause != null) {
          TypeName superclassNode = extendsClause.getSuperclass();
          recordSuperType(superclassNode, IndexConstants.IS_EXTENDED_BY);
        } else {
          InterfaceType superType = element.getSupertype();
          if (superType != null) {
            ClassElement objectElement = superType.getElement();
View Full Code Here

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

    ClassElement element = node.getElement();
    enterScope(element);
    try {
      recordElementDefinition(element, IndexConstants.DEFINES_CLASS_ALIAS);
      {
        TypeName superclassNode = node.getSuperclass();
        if (superclassNode != null) {
          recordSuperType(superclassNode, IndexConstants.IS_EXTENDED_BY);
        }
      }
      {
View Full Code Here

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

  public Void visitVariableDeclarationList(VariableDeclarationList node) {
    NodeList<VariableDeclaration> variables = node.getVariables();
    if (variables != null) {
      // use first VariableDeclaration as Element for Location(s) in type
      {
        TypeName type = node.getType();
        if (type != null) {
          for (VariableDeclaration variableDeclaration : variables) {
            enterScope(variableDeclaration.getElement());
            try {
              type.accept(this);
            } finally {
              exitScope();
            }
            // only one iteration
            break;
View Full Code Here

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

   * @see HintCode#IS_INT
   * @see HintCode#IS_NOT_DOUBLE
   * @see HintCode#IS_NOT_INT
   */
  private boolean checkForIsDoubleHints(IsExpression node) {
    TypeName typeName = node.getType();
    Type type = typeName.getType();
    if (type != null && type.getElement() != null) {
      Element element = type.getElement();
      String typeNameStr = element.getName();
      LibraryElement libraryElement = element.getLibrary();
//      if (typeNameStr.equals(INT_TYPE_NAME) && libraryElement != null
View Full Code Here

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

      if (identifier != null) {
        methodName = identifier.getName();
      }

      enclosingFunction = node.getElement();
      TypeName returnType = node.getReturnType();
      if (node.isSetter() || node.isGetter()) {
        checkForMismatchedAccessorTypes(node, methodName);
        if (node.isSetter()) {
          FunctionExpression functionExpression = node.getFunctionExpression();
          if (functionExpression != null) {
View Full Code Here

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

  @Override
  public Void visitInstanceCreationExpression(InstanceCreationExpression node) {
    isInConstInstanceCreation = node.isConst();
    try {
      ConstructorName constructorName = node.getConstructorName();
      TypeName typeName = constructorName.getType();
      Type type = typeName.getType();
      if (type instanceof InterfaceType) {
        InterfaceType interfaceType = (InterfaceType) type;
        checkForConstOrNewWithAbstractClass(node, typeName, interfaceType);
        checkForConstOrNewWithEnum(node, typeName, interfaceType);
        if (isInConstInstanceCreation) {
View Full Code Here

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

      SimpleIdentifier identifier = node.getName();
      String methodName = "";
      if (identifier != null) {
        methodName = identifier.getName();
      }
      TypeName returnTypeName = node.getReturnType();
      if (node.isSetter() || node.isGetter()) {
        checkForMismatchedAccessorTypes(node, methodName);
      }
      if (node.isGetter()) {
        checkForVoidReturnType(node);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.