Package com.google.dart.engine.element

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


   *
   * @return the parameter element representing the parameter to which the value of the right
   *         operand will be bound
   */
  protected ParameterElement getPropagatedParameterElementForRightHandSide() {
    ExecutableElement executableElement = null;
    if (propagatedElement != null) {
      executableElement = propagatedElement;
    } else {
      if (leftHandSide instanceof Identifier) {
        Identifier identifier = (Identifier) leftHandSide;
        Element leftElement = identifier.getPropagatedElement();
        if (leftElement instanceof ExecutableElement) {
          executableElement = (ExecutableElement) leftElement;
        }
      }
      if (leftHandSide instanceof PropertyAccess) {
        SimpleIdentifier identifier = ((PropertyAccess) leftHandSide).getPropertyName();
        Element leftElement = identifier.getPropagatedElement();
        if (leftElement instanceof ExecutableElement) {
          executableElement = (ExecutableElement) leftElement;
        }
      }
    }
    if (executableElement == null) {
      return null;
    }
    ParameterElement[] parameters = executableElement.getParameters();
    if (parameters.length < 1) {
      return null;
    }
    return parameters[0];
  }
View Full Code Here


   *
   * @return the parameter element representing the parameter to which the value of the right
   *         operand will be bound
   */
  protected ParameterElement getStaticParameterElementForRightHandSide() {
    ExecutableElement executableElement = null;
    if (staticElement != null) {
      executableElement = staticElement;
    } else {
      if (leftHandSide instanceof Identifier) {
        Element leftElement = ((Identifier) leftHandSide).getStaticElement();
        if (leftElement instanceof ExecutableElement) {
          executableElement = (ExecutableElement) leftElement;
        }
      }
      if (leftHandSide instanceof PropertyAccess) {
        Element leftElement = ((PropertyAccess) leftHandSide).getPropertyName().getStaticElement();
        if (leftElement instanceof ExecutableElement) {
          executableElement = (ExecutableElement) leftElement;
        }
      }
    }
    if (executableElement == null) {
      return null;
    }
    ParameterElement[] parameters = executableElement.getParameters();
    if (parameters.length < 1) {
      return null;
    }
    return parameters[0];
  }
View Full Code Here

   * performed, then {@code null} will be returned.
   *
   * @return the best element available for this function
   */
  public ExecutableElement getBestElement() {
    ExecutableElement element = getPropagatedElement();
    if (element == null) {
      element = getStaticElement();
    }
    return element;
  }
View Full Code Here

    return super.visitIndexExpression(node);
  }

  @Override
  public Void visitMethodDeclaration(MethodDeclaration node) {
    ExecutableElement element = node.getElement();
    enterScope(element);
    try {
      return super.visitMethodDeclaration(node);
    } finally {
      exitScope();
View Full Code Here

      }
      FunctionScope functionScope = new FunctionScope(scope, element);
      functionScope.defineParameters();
      scope = functionScope;
    } else if (node instanceof FunctionDeclaration) {
      ExecutableElement element = ((FunctionDeclaration) node).getElement();
      if (element == null) {
        throw new AnalysisException("Cannot build a scope for an unresolved function");
      }
      FunctionScope functionScope = new FunctionScope(scope, element);
      functionScope.defineParameters();
      scope = functionScope;
    } else if (node instanceof FunctionTypeAlias) {
      scope = new FunctionTypeScope(scope, ((FunctionTypeAlias) node).getElement());
    } else if (node instanceof MethodDeclaration) {
      ExecutableElement element = ((MethodDeclaration) node).getElement();
      if (element == null) {
        throw new AnalysisException("Cannot build a scope for an unresolved method");
      }
      FunctionScope functionScope = new FunctionScope(scope, element);
      functionScope.defineParameters();
View Full Code Here

  public BoolState equalEqual(InstanceState rightOperand) throws EvaluationException {
    if (element == null) {
      return BoolState.UNKNOWN_VALUE;
    }
    if (rightOperand instanceof FunctionState) {
      ExecutableElement rightElement = ((FunctionState) rightOperand).element;
      if (rightElement == null) {
        return BoolState.UNKNOWN_VALUE;
      }
      return BoolState.from(element.equals(rightElement));
    } else if (rightOperand instanceof DynamicState) {
View Full Code Here

//    return super.visitFieldDeclaration(node);
//  }

  @Override
  public Void visitMethodDeclaration(MethodDeclaration node) {
    ExecutableElement element = node.getElement();
    if (isOverride(element)) {
      if (getOverriddenMember(element) == null) {
        if (element instanceof MethodElement) {
          errorReporter.reportErrorForNode(HintCode.OVERRIDE_ON_NON_OVERRIDING_METHOD, node.getName());
        } else if (element instanceof PropertyAccessorElement) {
View Full Code Here

      EvaluationResultImpl value = variableElementImpl.getEvaluationResult();
      if (variableElementImpl.isConst() && value != null) {
        return value;
      }
    } else if (element instanceof ExecutableElement) {
      ExecutableElement function = (ExecutableElement) element;
      if (function.isStatic()) {
        return valid(typeProvider.getFunctionType(), new FunctionState(function));
      }
    } else if (element instanceof ClassElement || element instanceof FunctionTypeAliasElement) {
      return valid(typeProvider.getTypeType(), new TypeState(element));
    }
View Full Code Here

    return super.visitConditionalExpression(node);
  }

  @Override
  public Void visitConstructorDeclaration(ConstructorDeclaration node) {
    ExecutableElement outerFunction = enclosingFunction;
    try {
      ConstructorElement constructorElement = node.getElement();
      enclosingFunction = constructorElement;
      isEnclosingConstructorConst = node.getConstKeyword() != null;
      isInFactory = node.getFactoryKeyword() != null;
View Full Code Here

    return super.visitFieldFormalParameter(node);
  }

  @Override
  public Void visitFunctionDeclaration(FunctionDeclaration node) {
    ExecutableElement outerFunction = enclosingFunction;
    try {
      SimpleIdentifier identifier = node.getName();
      String methodName = "";
      if (identifier != null) {
        methodName = identifier.getName();
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.