Package com.google.dart.engine.element

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


   * @param element the element whose look-up name is to be returned
   * @return the name that will be used to look up the given element
   */
  private String getName(Element element) {
    if (element instanceof MethodElement) {
      MethodElement method = (MethodElement) element;
      if (method.getName().equals("-") && method.getParameters().length == 0) {
        return UNARY_MINUS;
      }
    }
    return element.getName();
  }
View Full Code Here


    return super.visitImportDirective(node);
  }

  @Override
  public Void visitIndexExpression(IndexExpression node) {
    MethodElement element = node.getBestElement();
    if (element instanceof MethodElement) {
      Token operator = node.getLeftBracket();
      Location location = createLocationFromToken(operator);
      recordRelationship(element, IndexConstants.IS_INVOKED_BY_QUALIFIED, location);
    }
View Full Code Here

    return null;
  }

  @Override
  public MethodElement lookUpMethod(String methodName, LibraryElement library) {
    MethodElement element = getMethod(methodName);
    if (element != null && element.isAccessibleIn(library)) {
      return element;
    }
    return lookUpMethodInSuperclass(methodName, library);
  }
View Full Code Here

  }

  @Override
  public MethodElement lookUpMethodInSuperclass(String methodName, LibraryElement library) {
    for (InterfaceType mixin : getMixins()) {
      MethodElement element = mixin.getMethod(methodName);
      if (element != null && element.isAccessibleIn(library)) {
        return element;
      }
    }
    HashSet<ClassElement> visitedClasses = new HashSet<ClassElement>();
    InterfaceType supertype = getSuperclass();
    ClassElement supertypeElement = supertype == null ? null : supertype.getElement();
    while (supertype != null && !visitedClasses.contains(supertypeElement)) {
      visitedClasses.add(supertypeElement);
      MethodElement element = supertype.getMethod(methodName);
      if (element != null && element.isAccessibleIn(library)) {
        return element;
      }
      for (InterfaceType mixin : supertype.getMixins()) {
        element = mixin.getMethod(methodName);
        if (element != null && element.isAccessibleIn(library)) {
          return element;
        }
      }
      supertype = supertype.getSuperclass();
      supertypeElement = supertype == null ? null : supertype.getElement();
View Full Code Here

    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

            node,
            name);
        return true;
      }
      // methods
      MethodElement method = classElement.getMethod(name);
      if (method != null) {
        errorReporter.reportErrorForNode(
            CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_NAME_AND_METHOD,
            node,
            name);
View Full Code Here

      return false;
    }
    VariableElement leftVariableElement = getVariableElement(lhs);
    Type leftType = (leftVariableElement == null) ? getStaticType(lhs)
        : leftVariableElement.getType();
    MethodElement invokedMethod = node.getStaticElement();
    if (invokedMethod == null) {
      return false;
    }
    Type rightType = invokedMethod.getType().getReturnType();
    if (leftType == null || rightType == null) {
      return false;
    }
    if (!rightType.isAssignableTo(leftType)) {
      errorReporter.reportTypeErrorForNode(
View Full Code Here

    if (type.isDynamic() || type.isBottom()) {
      return true;
    } else if (type instanceof FunctionType || type.isDartCoreFunction()) {
      return true;
    } else if (type instanceof InterfaceType) {
      MethodElement callMethod = ((InterfaceType) type).lookUpMethod(
          FunctionElement.CALL_METHOD_NAME,
          currentLibrary);
      return callMethod != null;
    }
    return false;
View Full Code Here

      Expression leftHandSide = node.getLeftHandSide();
      if (leftHandSide != null) {
        String methodName = operatorType.getLexeme();

        Type staticType = getStaticType(leftHandSide);
        MethodElement staticMethod = lookUpMethod(leftHandSide, staticType, methodName);
        node.setStaticElement(staticMethod);

        Type propagatedType = getPropagatedType(leftHandSide);
        MethodElement propagatedMethod = lookUpMethod(leftHandSide, propagatedType, methodName);
        node.setPropagatedElement(propagatedMethod);

        if (shouldReportMissingMember(staticType, staticMethod)) {
          if (doesntHaveProxy(staticType.getElement())) {
            resolver.reportErrorForToken(
View Full Code Here

      Expression leftOperand = node.getLeftOperand();
      if (leftOperand != null) {
        String methodName = operator.getLexeme();

        Type staticType = getStaticType(leftOperand);
        MethodElement staticMethod = lookUpMethod(leftOperand, staticType, methodName);
        node.setStaticElement(staticMethod);

        Type propagatedType = getPropagatedType(leftOperand);
        MethodElement propagatedMethod = lookUpMethod(leftOperand, propagatedType, methodName);
        node.setPropagatedElement(propagatedMethod);

        if (shouldReportMissingMember(staticType, staticMethod)) {
          if (doesntHaveProxy(staticType.getElement())) {
            resolver.reportErrorForToken(
View Full Code Here

TOP

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

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.