Package japa.parser.ast.stmt

Examples of japa.parser.ast.stmt.BlockStmt


        Type type;
        String name;
        List parameters;
        int arrayCount = 0;
        List throws_ = null;
        BlockStmt block = null;
        int line = modifier.beginLine;
        int column = modifier.beginColumn;
        switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
            case LT:
                typeParameters = TypeParameters();
View Full Code Here


        if (exConsInv != null) {
            stmts = add(0, stmts, exConsInv);
        }
        {
            if (true) {
                return new ConstructorDeclaration(line, column, token.endLine, token.endColumn, popJavadoc(), modifier.modifiers, modifier.annotations, typeParameters, name, parameters, throws_, new BlockStmt(bbLine, bbColumn, token.endLine, token.endColumn, stmts));
            }
        }
        throw new Error("Missing return statement in function");
    }
View Full Code Here

        }
        throw new Error("Missing return statement in function");
    }

    final public InitializerDeclaration InitializerDeclaration() throws ParseException {
        BlockStmt block;
        int line = -1;
        int column = 0;
        boolean isStatic = false;
        switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
            case STATIC:
                jj_consume_token(STATIC);
                isStatic = true;
                line = token.beginLine;
                column = token.beginColumn;
                break;
            default:
                jj_la1[49] = jj_gen;
                ;
        }
        block = Block();
        if (line == -1) {
            line = block.getBeginLine();
            column = block.getBeginColumn();
        }
        {
            if (true) {
                return new InitializerDeclaration(line, column, token.endLine, token.endColumn, popJavadoc(), isStatic, block);
            }
View Full Code Here

        beginColumn = token.beginColumn;
        stmts = Statements();
        jj_consume_token(RBRACE);
        {
            if (true) {
                return new BlockStmt(beginLine, beginColumn, token.endLine, token.endColumn, stmts);
            }
        }
        throw new Error("Missing return statement in function");
    }
View Full Code Here

    JavaFile file = helper.assertJavaSource("metamodel.controller.A");
    ClassOrInterfaceDeclaration a = file.assertDeclaration();
    MethodDeclaration index = new MethodDeclaration(Modifier.PUBLIC, ASTHelper.VOID_TYPE, "index");
    ASTHelper.addParameter(index, ASTHelper.createParameter(new ClassOrInterfaceType(String.class.getName()), "s"));
    index.setAnnotations(Collections.<AnnotationExpr>singletonList(new NormalAnnotationExpr(ASTHelper.createNameExpr(View.class.getName()), Collections.<MemberValuePair>emptyList())));
    index.setBody(new BlockStmt());
    a.getMembers().add(index);
    file.assertSave();
    helper.assertCompile();

    //
View Full Code Here

    //
    JavaFile file = helper.assertJavaSource("metamodel.controller.A");
    ClassOrInterfaceDeclaration a = file.assertDeclaration();
    MethodDeclaration show = new MethodDeclaration(Modifier.PUBLIC, ASTHelper.VOID_TYPE, "show");
    show.setAnnotations(Collections.<AnnotationExpr>singletonList(new NormalAnnotationExpr(ASTHelper.createNameExpr(View.class.getName()), Collections.<MemberValuePair>emptyList())));
    show.setBody(new BlockStmt());
    a.getMembers().add(show);
    file.assertSave();
    helper.assertCompile();

    //
View Full Code Here

   * @throws IOException
   */
  public static BlockStmt parseBlock(final String blockStatement)
      throws ParseException {
    StringReader sr = new StringReader(blockStatement);
    BlockStmt result = new ASTParser(sr).Block();
    sr.close();
    return result;
  }
View Full Code Here

    @Then("block statement in method $methodPosition in class $classPosition has $expectedCount total contained comments")
    public void thenBlockStatementInMethodInClassHasTotalContainedComments(int methodPosition, int classPosition, int expectedCount) {
        TypeDeclaration classUnderTest = compilationUnit.getTypes().get(classPosition - 1);
        MethodDeclaration methodUnderTest = (MethodDeclaration) getMemberByTypeAndPosition(classUnderTest, methodPosition - 1,
                MethodDeclaration.class);
        BlockStmt blockStmtUnderTest = methodUnderTest.getBody();
        assertThat(blockStmtUnderTest.getAllContainedComments().size(), is(expectedCount));
    }
View Full Code Here

    @Then("block statement in method $methodPosition in class $classPosition has $expectedCount orphan comments")
    public void thenBlockStatementInMethodInClassHasOrphanComments(int methodPosition, int classPosition, int expectedCount) {
        TypeDeclaration classUnderTest = compilationUnit.getTypes().get(classPosition - 1);
        MethodDeclaration methodUnderTest = (MethodDeclaration) getMemberByTypeAndPosition(classUnderTest, methodPosition - 1,
                MethodDeclaration.class);
        BlockStmt blockStmtUnderTest = methodUnderTest.getBody();
        assertThat(blockStmtUnderTest.getOrphanComments().size(), is(expectedCount));
    }
View Full Code Here

    @Then("block statement in method $methodPosition in class $classPosition orphan comment $commentPosition is \"$expectedContent\"")
    public void thenBlockStatementInMethodInClassIs(int methodPosition, int classPosition, int commentPosition, String expectedContent) {
        TypeDeclaration classUnderTest = compilationUnit.getTypes().get(classPosition - 1);
        MethodDeclaration methodUnderTest = (MethodDeclaration) getMemberByTypeAndPosition(classUnderTest, methodPosition -1,
                MethodDeclaration.class);
        BlockStmt blockStmtUnderTest = methodUnderTest.getBody();
        Comment commentUnderTest = blockStmtUnderTest.getOrphanComments().get(commentPosition - 1);
        assertThat(commentUnderTest.getContent(), is(equalToIgnoringWhiteSpace(expectedContent)));
    }
View Full Code Here

TOP

Related Classes of japa.parser.ast.stmt.BlockStmt

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.