Var x = new Var(1,new TypeName(type)) ;
MethodDef md = new MethodDef(TypeName.VOID,"setFoo",x) ;
md = md.addInstructions(
new Load(new Var(0,new TypeName("TestClass"))),
new Load(x),
new Store(new FieldRef(cd.name,new TypeName(type),"foo")),
new Return(TypeCode.VOID)
) ;
cd = cd.addMethod(md) ;
}
{
MethodDef md = new MethodDef(new TypeName(type),"getFoo") ;
md = md.addInstructions(
new Load(new Var(0,new TypeName("TestClass"))),
new Load(new FieldRef(cd.name,new TypeName(type),"foo")),
new Return(TypeCode.getType(type))
) ;
cd = cd.addMethod(md) ;
}
return cd ;