VariablesDeclaration extends Declaration { public void setDeclInfo(int index, VariableDeclInfo variableDeclInfo) { declInfos.set(index, variableDeclInfo); } VariablesDeclaration(Type baseType,
                              List<VariableDeclInfo> declInfos);  VariablesDeclaration(Type baseType, VariableDeclInfo declInfo);  VariablesDeclaration(Type baseType); Type getBaseType(); void setBaseType(Type baseType); VariableDeclInfo getDeclInfo(int index); List<VariableDeclInfo> getDeclInfos(); void setDeclInfo(int index, VariableDeclInfo variableDeclInfo); int getNumDecls(); void removeDeclInfo(int index); @Override void accept(IAstVisitor visitor); @Override VariablesDeclaration clone();  }
@Test public void testSetDeclInfo() throws Exception { final String program = "int x, y; int main() { int y, z, w; }"; final TranslationUnit tu = ParseHelper.parse(program); new StandardVisitor() { @Override public void visitVariablesDeclaration(VariablesDeclaration variablesDeclaration) { super.visitVariablesDeclaration(variablesDeclaration); for (int i = 0; i < variablesDeclaration.getNumDecls(); i++) { final VariableDeclInfo vdi = variablesDeclaration.getDeclInfo(i); variablesDeclaration.setDeclInfo(i, new VariableDeclInfo(vdi.getName() + "_modified", vdi.getArrayInfo(), vdi.getInitializer())); } } }.visit(tu); CompareAstsDuplicate.assertEqualAsts( "int x_modified, y_modified; int main() { int y_modified, z_modified, w_modified; }", tu); }