Package org.allspice.structured.statement

Examples of org.allspice.structured.statement.TryCatchStatement


public class TestTryCatch extends MyTestCase {
  public static interface TryFinally {
    public int meth(Exception arg0) ;
  }
  public void test1() throws Exception {
    TryFinally obj = makeObject(TryFinally.class,new TryCatchStatement(
        new FIFO<Statement>(new ThrowStatement(ARG0,null)),
        new FIFO<CatchBlock>(new CatchBlock(
            new VarDecl("java.lang.Exception","ex"),
            new FIFO<Statement>(
                new ReturnStatement(new ConstExpr(Integer.valueOf(1),null),null)
View Full Code Here


  private static final VarExpr X = new VarExpr("x",null);
  public static interface MethTest {
    public int meth() ;
  }
  public void test0() throws Exception {
    MethTest obj = makeObject(MethTest.class,new TryCatchStatement(
            new FIFO<Statement>(new ReturnStatement(new ConstExpr(Integer.valueOf(0),null),null)),
            new FIFO<CatchBlock>(),
            new FIFO<Statement>(new ExprStatement(new ConstExpr(Integer.valueOf(5),null),null)),
            null
          ),
View Full Code Here

    assertEquals(obj.meth(),0) ;
  }
  public void test1() throws Exception {
    MethTest obj = makeObject(MethTest.class,new DeclareStatement(
        new FIFO<VarDecl>(new VarDecl("int","x")),
        new FIFO<Statement>(new TryCatchStatement(
            new FIFO<Statement>(new ExprStatement(new SetValueExpr(X,new ConstExpr(Integer.valueOf(7),null),null),null)),
            new FIFO<CatchBlock>(),
            new FIFO<Statement>(new ExprStatement(new SetValueExpr(X,new PlusExpr(X,new ConstExpr(Integer.valueOf(1),null),null),null),null)),
            null
          ),
View Full Code Here

  }
  public void test2() throws Exception {
    MethTest obj = makeObject(MethTest.class,new DeclareStatement(
        new FIFO<VarDecl>(new VarDecl("int","x")),
        new FIFO<Statement>(
          new TryCatchStatement(
            new FIFO<Statement>(new ExprStatement(new SetValueExpr(X,new ConstExpr(Integer.valueOf(7),null),null),null),new ReturnStatement(X,null)),
            new FIFO<CatchBlock>(),
            new FIFO<Statement>(new ExprStatement(new SetValueExpr(X,new PlusExpr(X,new ConstExpr(Integer.valueOf(1),null),null),null),null)),
            null
          ),
View Full Code Here

TOP

Related Classes of org.allspice.structured.statement.TryCatchStatement

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.