Examples of VarDecl


Examples of org.allspice.structured.VarDecl

        null)) ;
    assertEquals(obj.meth(),8) ;
  }
  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)),
View Full Code Here

Examples of org.allspice.structured.VarDecl

  public static interface SimpleArrayTest {
    public int meth() ;
  }
  public void test1() throws Exception {
    SimpleArrayTest obj = makeObject(SimpleArrayTest.class,new DeclareStatement(
        new FIFO<VarDecl>(new VarDecl("int","i",new ConstExpr(Integer.valueOf(5),null))),
        new FIFO<Statement>(new ReturnStatement(new VarExpr("i",null),null)),
        null
      )) ;
    assertEquals(obj.meth(),5) ;
  }
View Full Code Here

Examples of org.allspice.structured.VarDecl

  public static interface ComplexArrayTest {
    public int[][] meth() ;
  }
  public void test1() throws Exception {
    ComplexArrayTest obj = makeObject(ComplexArrayTest.class,new DeclareStatement(
        new FIFO<VarDecl>(new VarDecl("int[][]","i",new ArrayOfExpr(null,
            new FIFO<Expr>(
              new ArrayOfExpr(null,new FIFO<Expr>(
                  new ConstExpr(Integer.valueOf(6),null),
                  new ConstExpr(Integer.valueOf(9),null)
                  )),
View Full Code Here

Examples of org.allspice.structured.VarDecl

  public static interface WhileTest {
    public int meth(int arg0) ;
  }
  public void test1() throws Exception {
    WhileTest obj = makeObject(WhileTest.class,new DeclareStatement(
        new FIFO<VarDecl>(new VarDecl("int","i"),new VarDecl("int","total")),
        new FIFO<Statement>(
        new ExprStatement(new SetValueExpr(I,new ConstExpr(Integer.valueOf(0),null),null),null),
        new ExprStatement(new SetValueExpr(TOTAL,new ConstExpr(Integer.valueOf(0),null),null),null),
        new WhileStatement(
            new LTExpr(I,ARG0,null),
View Full Code Here

Examples of org.allspice.structured.VarDecl

      String returnType = getName(meth.getReturnType()) ;
      String name = meth.getName() ;
      ImmutableCollection<VarDecl> vars = new FIFO<VarDecl>() ;
      int i = 0 ;
      for(Class<?> arg: meth.getParameterTypes()) {
        vars = vars.insert(new VarDecl(getName(arg),"arg"+i)) ;
        i++ ;
      }
      FieldAttrs fa = new FieldAttrs().setVisibility(Visibility.PUBLIC) ;
      meths = meths.insert(new MethodDecl(fa,returnType,name,vars, new FIFO<String>(),new FIFO<Statement>(stats))) ;
    }
View Full Code Here

Examples of org.allspice.structured.VarDecl

private static final VarDecl reduce10(PositionRange range,Parser parser,ParserState state) {
      String type = (String)state.reductions.tail.tail.head.o ;
      String ID = (String)state.reductions.tail.head.o ;
      String arraydims = (String)state.reductions.head.o ;
{
  return new VarDecl(type+arraydims,ID,null,true) ;
}
}
View Full Code Here

Examples of org.allspice.structured.VarDecl

private static final VarDecl reduce11(PositionRange range,Parser parser,ParserState state) {
      String type = (String)state.reductions.tail.tail.head.o ;
      String ID = (String)state.reductions.tail.head.o ;
      String arraydims = (String)state.reductions.head.o ;
{
  return new VarDecl(type+arraydims,ID) ;
}
}
View Full Code Here

Examples of org.allspice.structured.VarDecl

* @param parser
* @param state
* @return The object
**/
private static final ImmutableCollection<VarDecl> reduce12(PositionRange range,Parser parser,ParserState state) {
      VarDecl param = (VarDecl)state.reductions.head.o ;
{
  return new FIFO<VarDecl>(param) ;
}
}
View Full Code Here

Examples of org.allspice.structured.VarDecl

* @param state
* @return The object
**/
private static final ImmutableCollection<VarDecl> reduce13(PositionRange range,Parser parser,ParserState state) {
      ImmutableCollection<VarDecl> parameterlist = (ImmutableCollection<VarDecl>)state.reductions.tail.tail.head.o ;
      VarDecl param = (VarDecl)state.reductions.head.o ;
{
  return parameterlist.insert(param) ;
}
}
View Full Code Here

Examples of org.allspice.structured.VarDecl

      ImmutableCollection<CatchBlock> catchclause = (ImmutableCollection<CatchBlock>)state.reductions.tail.tail.tail.tail.tail.tail.head.o ;
      String type = (String)state.reductions.tail.tail.tail.head.o ;
      String ID = (String)state.reductions.tail.tail.head.o ;
      ImmutableCollection<Statement> compoundstatement = (ImmutableCollection<Statement>)state.reductions.head.o ;
{
  CatchBlock cb = new CatchBlock(new VarDecl(type,ID),compoundstatement) ;
  return catchclause.insert(cb) ;
}
}
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.