Examples of CallExpression


Examples of com.google.minijoe.compiler.ast.CallExpression

    // call expressions are left associative
    while (true) {
      if (!newFlag && nextToken == Token.OPERATOR_OPENPAREN) {
        Expression[] arguments = parseArgumentList();
        expression = new CallExpression(expression, arguments);
      } else if (nextToken == Token.OPERATOR_OPENSQUARE) {
        readToken(Token.OPERATOR_OPENSQUARE);
        Expression property = parseExpression(true);
        readToken(Token.OPERATOR_CLOSESQUARE);
        expression = new PropertyExpression(expression, property);
View Full Code Here

Examples of com.google.minijoe.compiler.ast.CallExpression

  }

  public void testCallExpression() throws CompilerException {
    assertParserOutput(
        new ExpressionStatement(
            new CallExpression(
                new Identifier("thing"),
                new Expression[] {
                }
            )
        ),
        "thing();"
    );
    assertParserOutput(
        new ExpressionStatement(
            new CallExpression(
                new Identifier("thing"),
                new Expression[] {
                  new NumberLiteral(1.0)
                }
            )
        ),
        "thing(1.0);"
    );
    assertParserOutput(
        new ExpressionStatement(
            new CallExpression(
                new Identifier("thing"),
                new Expression[] {
                  new NumberLiteral(1.0),
                  new StringLiteral("hatstand")
                }
View Full Code Here

Examples of com.stuffwithstuff.bantam.expressions.CallExpression

        args.add(parser.parseExpression());
      } while (parser.match(TokenType.COMMA));
      parser.consume(TokenType.RIGHT_PAREN);
    }
   
    return new CallExpression(left, args);
  }
View Full Code Here

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

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

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

      }
    } 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

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

  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

Examples of org.lilystudio.javascript.expression.CallExpression

            node.removeChild(firstChild);
            return new ArrayLiteral(node, root, scope);
          }
        }
      }
      return new CallExpression(node, root, scope);
    }

    case Token.INC:
    case Token.DEC:
      if (node.getIntProp(Node.INCRDECR_PROP, -1) > 1) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.