Package com.google.dart.engine.element

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


  @Override
  public Void visitFunctionExpression(FunctionExpression node) {
    // If this function expression is wrapped in a function declaration, don't change the
    // enclosingFunction field.
    if (!(node.getParent() instanceof FunctionDeclaration)) {
      ExecutableElement outerFunction = enclosingFunction;
      try {
        enclosingFunction = node.getElement();
        return super.visitFunctionExpression(node);
      } finally {
        enclosingFunction = outerFunction;
View Full Code Here


    return super.visitMapLiteral(node);
  }

  @Override
  public Void visitMethodDeclaration(MethodDeclaration node) {
    ExecutableElement previousFunction = enclosingFunction;
    try {
      isInStaticMethod = node.isStatic();
      enclosingFunction = node.getElement();
      SimpleIdentifier identifier = node.getName();
      String methodName = "";
View Full Code Here

   */
  private boolean checkForAllInvalidOverrideErrorCodesForMethod(MethodDeclaration node) {
    if (enclosingClass == null || node.isStatic() || node.getBody() instanceof NativeFunctionBody) {
      return false;
    }
    ExecutableElement executableElement = node.getElement();
    if (executableElement == null) {
      return false;
    }
    SimpleIdentifier methodName = node.getName();
    if (methodName.isSynthetic()) {
      return false;
    }
    FormalParameterList formalParameterList = node.getParameters();
    NodeList<FormalParameter> parameterList = formalParameterList != null
        ? formalParameterList.getParameters() : null;
    AstNode[] parameters = parameterList != null
        ? parameterList.toArray(new AstNode[parameterList.size()]) : null;
    return checkForAllInvalidOverrideErrorCodesForExecutable(
        executableElement,
        executableElement.getParameters(),
        parameters,
        methodName);
  }
View Full Code Here

   */
  private boolean checkForConcreteClassWithAbstractMember(MethodDeclaration node) {
    if (node.isAbstract() && enclosingClass != null && !enclosingClass.isAbstract()) {
      SimpleIdentifier nameNode = node.getName();
      String memberName = nameNode.getName();
      ExecutableElement overriddenMember;
      if (node.isGetter()) {
        overriddenMember = enclosingClass.lookUpInheritedConcreteGetter(memberName, currentLibrary);
      } else if (node.isSetter()) {
        overriddenMember = enclosingClass.lookUpInheritedConcreteSetter(memberName, currentLibrary);
      } else {
View Full Code Here

    boolean hasProblem = false;
    // method declared in the enclosing class vs. inherited getter
    for (MethodElement method : enclosingClass.getMethods()) {
      String name = method.getName();
      // find inherited property accessor (and can be only getter)
      ExecutableElement inherited = inheritanceManager.lookupInheritance(enclosingClass, name);
      if (!(inherited instanceof PropertyAccessorElement)) {
        continue;
      }
      // report problem
      hasProblem = true;
      errorReporter.reportErrorForOffset(
          CompileTimeErrorCode.CONFLICTING_GETTER_AND_METHOD,
          method.getNameOffset(),
          name.length(),
          enclosingClass.getDisplayName(),
          inherited.getEnclosingElement().getDisplayName(),
          name);
    }
    // getter declared in the enclosing class vs. inherited method
    for (PropertyAccessorElement accessor : enclosingClass.getAccessors()) {
      if (!accessor.isGetter()) {
        continue;
      }
      String name = accessor.getName();
      // find inherited method
      ExecutableElement inherited = inheritanceManager.lookupInheritance(enclosingClass, name);
      if (!(inherited instanceof MethodElement)) {
        continue;
      }
      // report problem
      hasProblem = true;
      errorReporter.reportErrorForOffset(
          CompileTimeErrorCode.CONFLICTING_METHOD_AND_GETTER,
          accessor.getNameOffset(),
          name.length(),
          enclosingClass.getDisplayName(),
          inherited.getEnclosingElement().getDisplayName(),
          name);
    }
    // done
    return hasProblem;
  }
View Full Code Here

      // if non-final variable, ignore setter - we alreay reported problem for getter
      if (accessor.isSetter() && accessor.isSynthetic()) {
        continue;
      }
      // try to find super element
      ExecutableElement superElement;
      superElement = enclosingType.lookUpGetterInSuperclass(name, currentLibrary);
      if (superElement == null) {
        superElement = enclosingType.lookUpSetterInSuperclass(name, currentLibrary);
      }
      if (superElement == null) {
        superElement = enclosingType.lookUpMethodInSuperclass(name, currentLibrary);
      }
      if (superElement == null) {
        continue;
      }
      // OK, not static
      if (!superElement.isStatic()) {
        continue;
      }
      // prepare "super" type to report its name
      ClassElement superElementClass = (ClassElement) superElement.getEnclosingElement();
      InterfaceType superElementType = superElementClass.getType();
      // report problem
      hasProblem = true;
      if (getter) {
        errorReporter.reportErrorForElement(
View Full Code Here

          Element enclosingElementOfSetter = null;
          ClassMember conflictingSetter = memberHashMap.get(setterName);
          if (conflictingSetter != null) {
            enclosingElementOfSetter = conflictingSetter.getElement().getEnclosingElement();
          } else {
            ExecutableElement elementFromInheritance = inheritanceManager.lookupInheritance(
                enclosingClass,
                setterName);
            if (elementFromInheritance != null) {
              enclosingElementOfSetter = elementFromInheritance.getEnclosingElement();
            }
          }
          if (enclosingElementOfSetter != null) {
            // report problem
            errorReporter.reportErrorForNode(
View Full Code Here

    if (enclosingClass == null) {
      return false;
    }
    InterfaceType enclosingType = enclosingClass.getType();
    // try to find setter
    ExecutableElement setter = enclosingType.lookUpSetter(name, currentLibrary);
    if (setter == null) {
      return false;
    }
    // OK, also static
    if (setter.isStatic()) {
      return false;
    }
    // prepare "setter" type to report its name
    ClassElement setterClass = (ClassElement) setter.getEnclosingElement();
    InterfaceType setterType = setterClass.getType();
    // report problem
    errorReporter.reportErrorForNode(
        StaticWarningCode.CONFLICTING_STATIC_GETTER_AND_INSTANCE_SETTER,
        nameNode,
View Full Code Here

    if (enclosingClass == null) {
      return false;
    }
    InterfaceType enclosingType = enclosingClass.getType();
    // try to find member
    ExecutableElement member;
    member = enclosingType.lookUpMethod(name, currentLibrary);
    if (member == null) {
      member = enclosingType.lookUpGetter(name, currentLibrary);
    }
    if (member == null) {
      member = enclosingType.lookUpSetter(name, currentLibrary);
    }
    if (member == null) {
      return false;
    }
    // OK, also static
    if (member.isStatic()) {
      return false;
    }
    // prepare "member" type to report its name
    ClassElement memberClass = (ClassElement) member.getEnclosingElement();
    InterfaceType memberType = memberClass.getType();
    // report problem
    errorReporter.reportErrorForNode(
        StaticWarningCode.CONFLICTING_STATIC_SETTER_AND_INSTANCE_MEMBER,
        nameNode,
View Full Code Here

    String name = staticMember.getName();
    if (name == null) {
      return false;
    }
    // try to find member
    ExecutableElement inheritedMember = inheritanceManager.lookupInheritance(enclosingClass, name);
    if (inheritedMember == null) {
      return false;
    }
    // OK, also static
    if (inheritedMember.isStatic()) {
      return false;
    }
    // determine the display name, use the extended display name if the enclosing class of the
    // inherited member is in a different source
    String displayName;
    Element enclosingElement = inheritedMember.getEnclosingElement();
    if (enclosingElement.getSource().equals(enclosingClass.getSource())) {
      displayName = enclosingElement.getDisplayName();
    } else {
      displayName = enclosingElement.getExtendedDisplayName(null);
    }
View Full Code Here

TOP

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

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.