Package japa.parser.ast.expr

Examples of japa.parser.ast.expr.MethodCallExpr


        method.setBody(block);

        //add a statement do the method body
        NameExpr clazz = new NameExpr("System");
        FieldAccessExpr field = new FieldAccessExpr(clazz, "out");
        MethodCallExpr call = new MethodCallExpr(field, "println");
        ASTHelper.addArgument(call, new StringLiteralExpr("Hello World"));
        ASTHelper.addStmt(block, call);

        LOG.info(cu.toString());
    }
View Full Code Here


        method.setBody(block);

        //add a statement do the method body
        NameExpr clazz = new NameExpr("System");
        FieldAccessExpr field = new FieldAccessExpr(clazz, "out");
        MethodCallExpr call = new MethodCallExpr(field, "println");
        ASTHelper.addArgument(call, new StringLiteralExpr("Hello World"));
        ASTHelper.addStmt(block, call);

        LOG.info(cu.toString());
    }
View Full Code Here

    public Boolean visit(NullLiteralExpr n1, Node arg) {
        return Boolean.TRUE;
    }

    public Boolean visit(MethodCallExpr n1, Node arg) {
        MethodCallExpr n2 = (MethodCallExpr) arg;

        if (!nodeEquals(n1.getScope(), n2.getScope())) {
            return Boolean.FALSE;
        }

        if (!objEquals(n1.getName(), n2.getName())) {
            return Boolean.FALSE;
        }

        if (!nodesEquals(n1.getArgs(), n2.getArgs())) {
            return Boolean.FALSE;
        }

        if (!nodesEquals(n1.getTypeArgs(), n2.getTypeArgs())) {
            return Boolean.FALSE;
        }

        return Boolean.TRUE;
    }
View Full Code Here

                        break;
                    default:
                        jj_la1[84] = jj_gen;
                        ;
                }
                ret = hasArgs ? new MethodCallExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, typeArgs, name, args) : new FieldAccessExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, null, name);
                break;
            case LPAREN:
                jj_consume_token(LPAREN);
                line = token.beginLine;
                column = token.beginColumn;
                ret = Expression();
                jj_consume_token(RPAREN);
                ret = new EnclosedExpr(line, column, token.endLine, token.endColumn, ret);
                break;
            case NEW:
                ret = AllocationExpression(null);
                break;
            default:
                jj_la1[86] = jj_gen;
                if (jj_2_27(2147483647)) {
                    type = ResultType();
                    jj_consume_token(DOT);
                    jj_consume_token(CLASS);
                    ret = new ClassExpr(type.getBeginLine(), type.getBeginColumn(), token.endLine, token.endColumn, type);
                } else {
                    switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
                        case IDENTIFIER:
                            jj_consume_token(IDENTIFIER);
                            name = token.image;
                            line = token.beginLine;
                            column = token.beginColumn;
                            switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
                                case LPAREN:
                                    args = Arguments();
                                    hasArgs = true;
                                    break;
                                default:
                                    jj_la1[85] = jj_gen;
                                    ;
                            }
                            ret = hasArgs ? new MethodCallExpr(line, column, token.endLine, token.endColumn, null, null, name, args) : new NameExpr(line, column, token.endLine, token.endColumn, name);
                            break;
                        default:
                            jj_la1[87] = jj_gen;
                            jj_consume_token(-1);
                            throw new ParseException();
View Full Code Here

                                    break;
                                default:
                                    jj_la1[90] = jj_gen;
                                    ;
                            }
                            ret = hasArgs ? new MethodCallExpr(scope.getBeginLine(), scope.getBeginColumn(), token.endLine, token.endColumn, scope, typeArgs, name, args) : new FieldAccessExpr(scope.getBeginLine(), scope.getBeginColumn(), token.endLine, token.endColumn, scope, typeArgs, name);
                        } else {
                            jj_consume_token(-1);
                            throw new ParseException();
                        }
                }
View Full Code Here

    Expression scope = cloneNodes(_n.getScope(), _arg);
    List<Type> typeArgs = visit(_n.getTypeArgs(), _arg);
    List<Expression> args = visit(_n.getArgs(), _arg);
    Comment comment = cloneNodes(_n.getComment(), _arg);

    MethodCallExpr r = new MethodCallExpr(
        _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
        scope, typeArgs, _n.getName(), args
    );
    r.setComment(comment);
    return r;
  }
View Full Code Here

  @Override public Boolean visit(final NullLiteralExpr n1, final Node arg) {
    return Boolean.TRUE;
  }

  @Override public Boolean visit(final MethodCallExpr n1, final Node arg) {
    final MethodCallExpr n2 = (MethodCallExpr) arg;

    if (!nodeEquals(n1.getScope(), n2.getScope())) {
      return Boolean.FALSE;
    }

    if (!objEquals(n1.getName(), n2.getName())) {
      return Boolean.FALSE;
    }

    if (!nodesEquals(n1.getArgs(), n2.getArgs())) {
      return Boolean.FALSE;
    }

    if (!nodesEquals(n1.getTypeArgs(), n2.getTypeArgs())) {
      return Boolean.FALSE;
    }

    return Boolean.TRUE;
  }
View Full Code Here

TOP

Related Classes of japa.parser.ast.expr.MethodCallExpr

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.