Package com.google.dart.engine.element

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


      }
    }
    // create attributes for name tokens
    List<PolymerAttributeElement> attributes = Lists.newArrayList();
    Set<String> definedNames = Sets.newHashSet();
    ClassElement classElement = dartElement.getClassElement();
    for (NameToken nameToken : nameTokens) {
      int offset = nameToken.offset;
      // prepare name
      String name = nameToken.value;
      if (!isValidAttributeName(name)) {
        reportErrorForNameToken(nameToken, PolymerCode.INVALID_ATTRIBUTE_NAME, name);
        continue;
      }
      if (!definedNames.add(name)) {
        reportErrorForNameToken(nameToken, PolymerCode.DUPLICATE_ATTRIBUTE_DEFINITION, name);
        continue;
      }
      // create attribute
      PolymerAttributeElementImpl attribute = new PolymerAttributeElementImpl(name, offset);
      attributes.add(attribute);
      // resolve field
      FieldElement field = classElement.getField(name);
      if (field == null) {
        reportErrorForNameToken(
            nameToken,
            PolymerCode.UNDEFINED_ATTRIBUTE_FIELD,
            name,
            classElement.getDisplayName());
        continue;
      }
      if (!isPublishedField(field)) {
        reportErrorForNameToken(
            nameToken,
            PolymerCode.ATTRIBUTE_FIELD_NOT_PUBLISHED,
            name,
            classElement.getDisplayName());
      }
      attribute.setField(field);
    }
    htmlElement.setAttributes(attributes.toArray(new PolymerAttributeElement[attributes.size()]));
  }
View Full Code Here


    this.store = store;
  }

  @Override
  public Void visitClassDeclaration(ClassDeclaration node) {
    ClassElement classElement = node.getElement();
    if (classElement != null) {
      ToolkitObjectElement[] toolkitObjects = classElement.getToolkitObjects();
      for (ToolkitObjectElement object : toolkitObjects) {
        if (object instanceof AngularComponentElement) {
          indexComponent((AngularComponentElement) object);
        }
        if (object instanceof AngularDecoratorElement) {
View Full Code Here

    // prepare ClassElement
    Element element = type.getElement();
    if (!(element instanceof ClassElement)) {
      return false;
    }
    ClassElement classElement = (ClassElement) element;
    // lookup for ==
    MethodElement method = classElement.lookUpConcreteMethod("==", currentLibrary);
    if (method == null || method.getEnclosingElement().getType().isObject()) {
      return false;
    }
    // there is == that we don't like
    return true;
View Full Code Here

   */
  private boolean checkImplementsFunctionWithoutCall(ClassDeclaration node) {
    if (node.isAbstract()) {
      return false;
    }
    ClassElement classElement = node.getElement();
    if (classElement == null) {
      return false;
    }
    if (!classElement.getType().isSubtypeOf(typeProvider.getFunctionType())) {
      return false;
    }
    // If there is a noSuchMethod method, then don't report the warning, see dartbug.com/16078
    if (classElement.getMethod(FunctionElement.NO_SUCH_METHOD_METHOD_NAME) != null) {
      return false;
    }
    ExecutableElement callMethod = inheritanceManager.lookupMember(classElement, "call");
    if (callMethod == null || !(callMethod instanceof MethodElement)
        || ((MethodElement) callMethod).isAbstract()) {
View Full Code Here

   */
  private boolean isFuture(Type type) {
    if (type instanceof InterfaceType) {
      InterfaceType interfaceType = (InterfaceType) type;
      if (interfaceType.getName().equals("Future")) {
        ClassElement element = interfaceType.getElement();
        if (element != null) {
          LibraryElement library = element.getLibrary();
          if (library.getName().equals("dart.async")) {
            return true;
          }
        }
      }
View Full Code Here

    }
  }

  @Override
  public Void visitClassDeclaration(ClassDeclaration node) {
    ClassElement outerClass = enclosingClass;
    try {
      isInNativeClass = node.getNativeClause() != null;
      enclosingClass = node.getElement();
      ExtendsClause extendsClause = node.getExtendsClause();
      ImplementsClause implementsClause = node.getImplementsClause();
View Full Code Here

  public Void visitClassTypeAlias(ClassTypeAlias node) {
    checkForBuiltInIdentifierAsName(
        node.getName(),
        CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME);

    ClassElement outerClassElement = enclosingClass;
    try {
      enclosingClass = node.getElement();
      ImplementsClause implementsClause = node.getImplementsClause();
      // Only check for all of the inheritance logic around clauses if there isn't an error code
      // such as "Cannot extend double" already on the class.
View Full Code Here

  @Override
  public Void visitMethodInvocation(MethodInvocation node) {
    Expression target = node.getRealTarget();
    SimpleIdentifier methodName = node.getMethodName();
    if (target != null) {
      ClassElement typeReference = ElementResolver.getTypeReference(target);
      checkForStaticAccessToInstanceMember(typeReference, methodName);
      checkForInstanceAccessToStaticMember(typeReference, methodName);
    } else {
      checkForUnqualifiedReferenceToNonLocalStaticMember(methodName);
    }
View Full Code Here

  }

  @Override
  public Void visitPrefixedIdentifier(PrefixedIdentifier node) {
    if (!(node.getParent() instanceof Annotation)) {
      ClassElement typeReference = ElementResolver.getTypeReference(node.getPrefix());
      SimpleIdentifier name = node.getIdentifier();
      checkForStaticAccessToInstanceMember(typeReference, name);
      checkForInstanceAccessToStaticMember(typeReference, name);
    }
    return super.visitPrefixedIdentifier(node);
View Full Code Here

    return super.visitPrefixExpression(node);
  }

  @Override
  public Void visitPropertyAccess(PropertyAccess node) {
    ClassElement typeReference = ElementResolver.getTypeReference(node.getRealTarget());
    SimpleIdentifier propertyName = node.getPropertyName();
    checkForStaticAccessToInstanceMember(typeReference, propertyName);
    checkForInstanceAccessToStaticMember(typeReference, propertyName);
    return super.visitPropertyAccess(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.