use of abs.frontend.ast.FieldUse in project abstools by abstools.
the class DeltaForGetSetFieldsBuilder method addSetter.
/**
* Add an add method modifier
* @param fieldName
* @param exp
* @param decl
* @return
*/
AddMethodModifier addSetter(String fieldName, Access type) {
MethodSig sig = new MethodSig(testCaseNameBuilder.setterMethodName(fieldName), new abs.frontend.ast.List<Annotation>(), getUnit(), new abs.frontend.ast.List<ParamDecl>());
sig.addParam(new ParamDecl("v", type, new abs.frontend.ast.List<Annotation>()));
Block block = new Block();
block.addStmtNoTransform(getVAssign(new FieldUse(fieldName), new VarUse("v")));
MethodImpl method = new MethodImpl(sig, block, false);
AddMethodModifier modifier = new AddMethodModifier(method);
return modifier;
}
use of abs.frontend.ast.FieldUse in project abstools by abstools.
the class DeltaForGetSetFieldsBuilder method addGetter.
AddMethodModifier addGetter(Exp returnValue, String fieldName, Access returnType) {
MethodSig sig = new MethodSig(testCaseNameBuilder.getterMethodName(fieldName), new abs.frontend.ast.List<Annotation>(), returnType, new abs.frontend.ast.List<ParamDecl>());
Block block = new Block();
ReturnStmt rs = new ReturnStmt();
rs.setRetExp(new FieldUse(fieldName));
block.addStmtNoTransform(rs);
MethodImpl method = new MethodImpl(sig, block, false);
AddMethodModifier modifier = new AddMethodModifier(method);
return modifier;
}
Aggregations