Package com.google.minijoe.compiler.ast

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


    if (nextToken == Token.KEYWORD_FINALLY) {
      readToken(Token.KEYWORD_FINALLY);
      finallyBlock = parseBlockStatement();
    }

    return new TryStatement(tryBlock, catchIdentifier, catchBlock, finallyBlock);
  }
View Full Code Here


    super(name);
  }

  public void testTryCatchStatement() throws CompilerException {
    assertParserOutput(
        new TryStatement(
            new BlockStatement(
                new Statement[] {
                    new ExpressionStatement(
                        new Identifier("something")
                    )
                }
            ),
            new Identifier("foo"),
            new BlockStatement(
                new Statement[] {
                    new ExpressionStatement(
                        new Identifier("bar")
                    )
                }
            ),
            null
        ),
        "try {something;} catch (foo) {bar;}"
    );
    assertParserOutput(
        new TryStatement(
            new BlockStatement(
                new Statement[] {
                    new ExpressionStatement(
                        new Identifier("something")
                    )
                }
            ),
            null,
            null,
            new BlockStatement(
                new Statement[] {
                    new ExpressionStatement(
                        new Identifier("baz")
                    )
                }
            )
        ),
        "try {something;} finally {baz;}"
    );
    assertParserOutput(
        new TryStatement(
            new BlockStatement(
                new Statement[] {
                    new ExpressionStatement(
                        new Identifier("something")
                    )
View Full Code Here

TOP

Related Classes of com.google.minijoe.compiler.ast.TryStatement

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.