Package org.eclipse.dltk.ast.expressions

Examples of org.eclipse.dltk.ast.expressions.CallExpression


      this.criteriaFunction = criteriaFunction;
    }

    public boolean visit(Expression node) throws Exception {
      if (node instanceof CallExpression) {
        CallExpression callExpression = (CallExpression) node;
        if (criteriaFunction.equals(callExpression.getName())) {
          result = (ASTNode) callExpression.getArgs().getChilds()
              .get(0);
          context = contextStack.peek();
          return false;
        }
      }
View Full Code Here


      this.criteriaFunction = criteriaFunction;
    }

    public boolean visit(Expression node) throws Exception {
      if (node instanceof CallExpression) {
        CallExpression callExpression = (CallExpression) node;
        if (criteriaFunction.equals(callExpression.getName())) {
          result = (ASTNode) callExpression.getArgs().getChilds()
              .get(0);
          context = contextStack.peek();
          return false;
        }
      }
View Full Code Here

      }
    } else if (node instanceof Include) {
      Include include = (Include) node;
      if (include.getExpr() instanceof Scalar) {
        Scalar filePath = (Scalar) include.getExpr();
        CallExpression callExpression = new CallExpressionLocation(
            filePath.sourceStart(), filePath.sourceEnd(), null,
            "include", new CallArgumentsList()); //$NON-NLS-1$
        locator.match(callExpression, getNodeSet());
      }
    } else if (node instanceof Argument) {
View Full Code Here

  private IGoal produceNextSubgoal(IGoal previousGoal,
      IEvaluatedType previousResult, GoalState goalState) {

    ExpressionTypeGoal typedGoal = (ExpressionTypeGoal) goal;
    CallExpression expression = (CallExpression) typedGoal.getExpression();

    // just starting to evaluate method, evaluate method receiver first:
    if (state == STATE_INIT) {
      ASTNode receiver = expression.getReceiver();
      if (receiver == null) {
        state = STATE_GOT_RECEIVER;
      } else {
        state = STATE_WAITING_RECEIVER;
        return new ExpressionTypeGoal(goal.getContext(), receiver);
      }
    }

    // receiver must been evaluated now, lets evaluate method return type:
    if (state == STATE_WAITING_RECEIVER) {
      receiverType = previousResult;
      previousResult = null;
      if (receiverType == null) {
        return null;
      }
      state = STATE_GOT_RECEIVER;
    }

    // we've evaluated receiver, lets evaluate the method return type now
    // (using PHP Doc first):
    if (state == STATE_GOT_RECEIVER) {
      state = STATE_WAITING_METHOD_PHPDOC;
      return new PHPDocMethodReturnTypeGoal(typedGoal.getContext(),
          receiverType, expression.getName());
    }

    // PHPDoc logic is done, start evaluating 'return' statements here:
    if (state == STATE_WAITING_METHOD_PHPDOC) {
      if (goalState != GoalState.PRUNED && previousResult != null
          && previousResult != UnknownType.INSTANCE) {
        result = previousResult;
        previousResult = null;
        // BUG 404031, stop read if found not simple element
        if (!PHPTypeInferenceUtils.isSimple(result)) {
          return null;
        }
      }
      state = STATE_WAITING_METHOD;
      CallArgumentsList args = expression.getArgs();
      String[] argNames = null;
      if (args != null && args.getChilds() != null) {
        List<ASTNode> childs = args.getChilds();
        int i = 0;
        argNames = new String[childs.size()];
        for (ASTNode o : childs) {
          if (o instanceof Scalar) {
            Scalar arg = (Scalar) o;
            argNames[i] = ASTUtils.stripQuotes(arg.getValue());
          }
          i++;
        }
      }
      return new MethodElementReturnTypeGoal(typedGoal.getContext(),
          receiverType, expression.getName(), argNames);
    }

    if (state == STATE_WAITING_METHOD) {
      if (goalState != GoalState.PRUNED && previousResult != null
          && previousResult != UnknownType.INSTANCE) {
View Full Code Here

TOP

Related Classes of org.eclipse.dltk.ast.expressions.CallExpression

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.