Package com.google.dart.engine.type

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


  public boolean canApply(XmlTagNode node) {
    return node.getAttribute(NG_REPEAT) != null;
  }

  private void defineLocalVariable_bool(AngularHtmlUnitResolver resolver, String name) {
    InterfaceType type = resolver.getTypeProvider().getBoolType();
    LocalVariableElementImpl variable = resolver.createLocalVariableWithName(type, name);
    resolver.defineVariable(variable);
  }
View Full Code Here


    LocalVariableElementImpl variable = resolver.createLocalVariableWithName(type, name);
    resolver.defineVariable(variable);
  }

  private void defineLocalVariable_int(AngularHtmlUnitResolver resolver, String name) {
    InterfaceType type = resolver.getTypeProvider().getIntType();
    LocalVariableElementImpl variable = resolver.createLocalVariableWithName(type, name);
    resolver.defineVariable(variable);
  }
View Full Code Here

  private boolean checkForInstanceMethodNameCollidesWithSuperclassStatic(
      ExecutableElement executableElement, SimpleIdentifier errorNameTarget) {
    String executableElementName = executableElement.getName();
    if (!(executableElement instanceof PropertyAccessorElement) && !executableElement.isOperator()) {
      HashSet<ClassElement> visitedClasses = new HashSet<ClassElement>();
      InterfaceType superclassType = enclosingClass.getSupertype();
      ClassElement superclassElement = superclassType == null ? null : superclassType.getElement();
      boolean executableElementPrivate = Identifier.isPrivateName(executableElementName);
      while (superclassElement != null && !visitedClasses.contains(superclassElement)) {
        visitedClasses.add(superclassElement);
        LibraryElement superclassLibrary = superclassElement.getLibrary();
        // Check fields.
        FieldElement[] fieldElts = superclassElement.getFields();
        for (FieldElement fieldElt : fieldElts) {
          // We need the same name.
          if (!fieldElt.getName().equals(executableElementName)) {
            continue;
          }
          // Ignore if private in a different library - cannot collide.
          if (executableElementPrivate && !currentLibrary.equals(superclassLibrary)) {
            continue;
          }
          // instance vs. static
          if (fieldElt.isStatic()) {
            errorReporter.reportErrorForNode(
                StaticWarningCode.INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLASS_STATIC,
                errorNameTarget,
                executableElementName,
                fieldElt.getEnclosingElement().getDisplayName());
            return true;
          }
        }
        // Check methods.
        MethodElement[] methodElements = superclassElement.getMethods();
        for (MethodElement methodElement : methodElements) {
          // We need the same name.
          if (!methodElement.getName().equals(executableElementName)) {
            continue;
          }
          // Ignore if private in a different library - cannot collide.
          if (executableElementPrivate && !currentLibrary.equals(superclassLibrary)) {
            continue;
          }
          // instance vs. static
          if (methodElement.isStatic()) {
            errorReporter.reportErrorForNode(
                StaticWarningCode.INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLASS_STATIC,
                errorNameTarget,
                executableElementName,
                methodElement.getEnclosingElement().getDisplayName());
            return true;
          }
        }
        superclassType = superclassElement.getSupertype();
        superclassElement = superclassType == null ? null : superclassType.getElement();
      }
    }
    return false;
  }
View Full Code Here

   * @param mixinElement the mixing to evaluate
   * @return {@code true} if and only if an error code is generated on the passed node
   * @see CompileTimeErrorCode#MIXIN_INHERITS_FROM_NOT_OBJECT
   */
  private boolean checkForMixinInheritsNotFromObject(TypeName mixinName, ClassElement mixinElement) {
    InterfaceType mixinSupertype = mixinElement.getSupertype();
    if (mixinSupertype != null) {
      if (!mixinSupertype.isObject() || !mixinElement.isTypedef()
          && mixinElement.getMixins().length != 0) {
        errorReporter.reportErrorForNode(
            CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT,
            mixinName,
            mixinElement.getName());
View Full Code Here

    ConstructorElement[] constructors = enclosingClass.getConstructors();
    if (!constructors[0].isSynthetic()) {
      return false;
    }
    // prepare super
    InterfaceType superType = enclosingClass.getSupertype();
    if (superType == null) {
      return false;
    }
    ClassElement superElement = superType.getElement();
    // try to find default generative super constructor
    ConstructorElement superUnnamedConstructor = superElement.getUnnamedConstructor();
    if (superUnnamedConstructor != null) {
      if (superUnnamedConstructor.isFactory()) {
        errorReporter.reportErrorForNode(
            CompileTimeErrorCode.NON_GENERATIVE_CONSTRUCTOR,
            node.getName(),
            superUnnamedConstructor);
        return true;
      }
      if (superUnnamedConstructor.isDefaultConstructor()) {
        return true;
      }
    }
    // report problem
    errorReporter.reportErrorForNode(
        CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT,
        node.getName(),
        superType.getDisplayName());
    return true;
  }
View Full Code Here

      // Check to see if an element was found in the superclass chain with the correct name.
      if (elt != null) {

        // Reference the types, if any are null then continue.
        InterfaceType enclosingType = enclosingClass.getType();
        FunctionType concreteType = elt.getType();
        FunctionType requiredMemberType = executableElt.getType();
        if (enclosingType == null || concreteType == null || requiredMemberType == null) {
          continue;
        }
View Full Code Here

    // Check to see whether the superclass has a non-factory unnamed constructor.
    //
    if (enclosingClass == null) {
      return false;
    }
    InterfaceType superType = enclosingClass.getSupertype();
    if (superType == null) {
      return false;
    }
    ClassElement superElement = superType.getElement();
    ConstructorElement superUnnamedConstructor = superElement.getUnnamedConstructor();
    if (superUnnamedConstructor != null) {
      if (superUnnamedConstructor.isFactory()) {
        errorReporter.reportErrorForNode(
            CompileTimeErrorCode.NON_GENERATIVE_CONSTRUCTOR,
            node.getReturnType(),
            superUnnamedConstructor);
        return true;
      }
      if (!superUnnamedConstructor.isDefaultConstructor()) {
        int offset;
        int length;
        {
          Identifier returnType = node.getReturnType();
          SimpleIdentifier name = node.getName();
          offset = returnType.getOffset();
          length = (name != null ? name.getEnd() : returnType.getEnd()) - offset;
        }
        errorReporter.reportErrorForOffset(
            CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT,
            offset,
            length,
            superType.getDisplayName());
      }
      return false;
    }
    errorReporter.reportErrorForNode(
        CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT,
View Full Code Here

   * @return {@code true} if and only if an error code is generated on the passed node
   * @see CompileTimeErrorCode#IMPLEMENTS_SUPER_CLASS
   */
  private boolean checkImplementsSuperClass(ClassDeclaration node) {
    // prepare super type
    InterfaceType superType = enclosingClass.getSupertype();
    if (superType == null) {
      return false;
    }
    // prepare interfaces
    ImplementsClause implementsClause = node.getImplementsClause();
    if (implementsClause == null) {
      return false;
    }
    // check interfaces
    boolean hasProblem = false;
    for (TypeName interfaceNode : implementsClause.getInterfaces()) {
      if (interfaceNode.getType().equals(superType)) {
        hasProblem = true;
        errorReporter.reportErrorForNode(
            CompileTimeErrorCode.IMPLEMENTS_SUPER_CLASS,
            interfaceNode,
            superType.getDisplayName());
      }
    }
    // done
    return hasProblem;
  }
View Full Code Here

   *
   * @param classElt the class that references itself
   * @return the error code that should be used
   */
  private ErrorCode getBaseCaseErrorCode(ClassElement classElt) {
    InterfaceType supertype = classElt.getSupertype();
    if (supertype != null && enclosingClass.equals(supertype.getElement())) {
      return CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_EXTENDS;
    }
    InterfaceType[] mixins = classElt.getMixins();
    for (int i = 0; i < mixins.length; i++) {
      if (enclosingClass.equals(mixins[i].getElement())) {
View Full Code Here

          }
          // schedule for checking
          toCheck.add(element);
          // type arguments
          if (type instanceof InterfaceType) {
            InterfaceType interfaceType = (InterfaceType) type;
            for (Type typeArgument : interfaceType.getTypeArguments()) {
              addTypeToCheck(typeArgument);
            }
          }
        }
      });
View Full Code Here

TOP

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

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.