Package com.google.dart.engine.element

Examples of com.google.dart.engine.element.ClassElement


  public boolean hasNonFinalField() {
    ArrayList<ClassElement> classesToVisit = new ArrayList<ClassElement>();
    HashSet<ClassElement> visitedClasses = new HashSet<ClassElement>();
    classesToVisit.add(this);
    while (!classesToVisit.isEmpty()) {
      ClassElement currentElement = classesToVisit.remove(0);
      if (visitedClasses.add(currentElement)) {
        // check fields
        for (FieldElement field : currentElement.getFields()) {
          if (!field.isFinal() && !field.isConst() && !field.isStatic() && !field.isSynthetic()) {
            return true;
          }
        }
        // check mixins
        for (InterfaceType mixinType : currentElement.getMixins()) {
          ClassElement mixinElement = mixinType.getElement();
          classesToVisit.add(mixinElement);
        }
        // check super
        InterfaceType supertype = currentElement.getSupertype();
        if (supertype != null) {
          ClassElement superElement = supertype.getElement();
          if (superElement != null) {
            classesToVisit.add(superElement);
          }
        }
      }
View Full Code Here


    ArrayList<InterfaceType> typesToVisit = new ArrayList<InterfaceType>();
    ArrayList<ClassElement> visitedClasses = new ArrayList<ClassElement>();
    typesToVisit.add(this.getType());
    while (!typesToVisit.isEmpty()) {
      InterfaceType currentType = typesToVisit.remove(0);
      ClassElement currentElement = currentType.getElement();
      if (!visitedClasses.contains(currentElement)) {
        visitedClasses.add(currentElement);
        if (currentType != this.getType()) {
          supertypes.add(currentType);
        }
        InterfaceType supertype = currentType.getSuperclass();
        if (supertype != null) {
          typesToVisit.add(supertype);
        }
        for (InterfaceType type : currentElement.getInterfaces()) {
          typesToVisit.add(type);
        }
        for (InterfaceType type : currentElement.getMixins()) {
          ClassElement element = type.getElement();
          if (!visitedClasses.contains(element)) {
            supertypes.add(type);
          }
        }
      }
View Full Code Here

  private MethodElement internalLookUpConcreteMethod(String methodName, LibraryElement library,
      boolean includeThisClass) {
    MethodElement method = internalLookUpMethod(methodName, library, includeThisClass);
    while (method != null && method.isAbstract()) {
      ClassElement definingClass = method.getEnclosingElement();
      if (definingClass == null) {
        return null;
      }
      method = definingClass.lookUpInheritedMethod(methodName, library);
    }
    return method;
  }
View Full Code Here

  }

  private PropertyAccessorElement internalLookUpGetter(String getterName, LibraryElement library,
      boolean includeThisClass) {
    HashSet<ClassElement> visitedClasses = new HashSet<ClassElement>();
    ClassElement currentElement = this;
    if (includeThisClass) {
      PropertyAccessorElement element = currentElement.getGetter(getterName);
      if (element != null && element.isAccessibleIn(library)) {
        return element;
      }
    }
    while (currentElement != null && visitedClasses.add(currentElement)) {
      for (InterfaceType mixin : currentElement.getMixins()) {
        ClassElement mixinElement = mixin.getElement();
        if (mixinElement != null) {
          PropertyAccessorElement element = mixinElement.getGetter(getterName);
          if (element != null && element.isAccessibleIn(library)) {
            return element;
          }
        }
      }
View Full Code Here

  }

  private MethodElement internalLookUpMethod(String methodName, LibraryElement library,
      boolean includeThisClass) {
    HashSet<ClassElement> visitedClasses = new HashSet<ClassElement>();
    ClassElement currentElement = this;
    if (includeThisClass) {
      MethodElement element = currentElement.getMethod(methodName);
      if (element != null && element.isAccessibleIn(library)) {
        return element;
      }
    }
    while (currentElement != null && visitedClasses.add(currentElement)) {
      for (InterfaceType mixin : currentElement.getMixins()) {
        ClassElement mixinElement = mixin.getElement();
        if (mixinElement != null) {
          MethodElement element = mixinElement.getMethod(methodName);
          if (element != null && element.isAccessibleIn(library)) {
            return element;
          }
        }
      }
View Full Code Here

  }

  private PropertyAccessorElement internalLookUpSetter(String setterName, LibraryElement library,
      boolean includeThisClass) {
    HashSet<ClassElement> visitedClasses = new HashSet<ClassElement>();
    ClassElement currentElement = this;
    if (includeThisClass) {
      PropertyAccessorElement element = currentElement.getSetter(setterName);
      if (element != null && element.isAccessibleIn(library)) {
        return element;
      }
    }
    while (currentElement != null && visitedClasses.add(currentElement)) {
      for (InterfaceType mixin : currentElement.getMixins()) {
        ClassElement mixinElement = mixin.getElement();
        if (mixinElement != null) {
          PropertyAccessorElement element = mixinElement.getSetter(setterName);
          if (element != null && element.isAccessibleIn(library)) {
            return element;
          }
        }
      }
View Full Code Here

    return definingCompilationUnit.getSource();
  }

  @Override
  public ClassElement getType(String className) {
    ClassElement type = definingCompilationUnit.getType(className);
    if (type != null) {
      return type;
    }
    for (CompilationUnitElement part : parts) {
      type = part.getType(className);
View Full Code Here

      if (asyncElement == null) {
        AnalysisEngine.getInstance().getLogger().logError(
            "Could not build the element model for dart:async");
        return VoidTypeImpl.getInstance();
      }
      ClassElement futureElement = asyncElement.getType("Future");
      if (futureElement == null) {
        AnalysisEngine.getInstance().getLogger().logError(
            "Could not find type Future in dart:async");
        return VoidTypeImpl.getInstance();
      }
      InterfaceType futureType = futureElement.getType();
      return futureType.substitute(new Type[] {DynamicTypeImpl.getInstance()});
    } catch (AnalysisException exception) {
      AnalysisEngine.getInstance().getLogger().logError(
          "Could not build the element model for dart:async",
          exception);
View Full Code Here

    ClassDeclaration classDeclaration = node.getAncestor(ClassDeclaration.class);
    if (classDeclaration == null) {
      return null;
    }
    // prepare ClassElement
    ClassElement classElement = classDeclaration.getElement();
    if (classElement == null) {
      return null;
    }
    // check toolkit objects
    for (ToolkitObjectElement toolkitObject : classElement.getToolkitObjects()) {
      AngularPropertyElement[] properties = AngularPropertyElement.EMPTY_ARRAY;
      // maybe name
      if (toolkitObject instanceof AngularElement) {
        if (isNameCoveredByLiteral(toolkitObject, node)) {
          return toolkitObject;
View Full Code Here

    return super.visitBinaryExpression(node);
  }

  @Override
  public Void visitClassDeclaration(ClassDeclaration node) {
    ClassElement outerClass = enclosingClass;
    try {
      enclosingClass = node.getElement();
      // Commented out until we decide that we want this hint in the analyzer
//    checkForOverrideEqualsButNotHashCode(node);
      return super.visitClassDeclaration(node);
View Full Code Here

TOP

Related Classes of com.google.dart.engine.element.ClassElement

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.