public static NameInformation createInfoForAddedParameter( String type, String name, String defaultValue) { NameInformation info = new NameInformation(null); info.setTypeName(type); info.setNewName(name); info.setDefaultValue(defaultValue); info.setNewOrder(INDEX_FOR_ADDED); return info; }
public List<IASTParameterDeclaration> getParameterDeclarations( Collection<NameInformation> parameterNames, INodeFactory nodeFactory) { List<IASTParameterDeclaration> result = new ArrayList<IASTParameterDeclaration>(parameterNames.size()); for (NameInformation param : parameterNames) { result.add(param.getParameterDeclaration(nodeFactory)); } return result; }
/** * Returns a map from references to parameters inside the body of the extracted function to the * parameters themselves. The map includes only the parameters that are either renamed, or passed * by pointer. * * @param parameters the function parameters. * @return a map from references to parameters to parameters themselves. */ protected static Map<IASTName, NameInformation> getChangedParameterReferences( List<NameInformation> parameters) { final Map<IASTName, NameInformation> referenceLookupMap = new HashMap<IASTName, NameInformation>(); for (NameInformation param : parameters) { if (param.isRenamed() || param.getIndirection() == Indirection.POINTER) { for (IASTName name : param.getReferencesInSelection()) { referenceLookupMap.put(name, param); } } } return referenceLookupMap; }