// If the type is nested, simulate Java inner class access visibility by creating a
// reference to the outer type on the constructor
final ICPPASTDeclSpecifier parentReferenceDeclSpecifier = f.newTypedefNameSpecifier(new NameInfo(enclosingType.getName()).getName());
final ICPPASTDeclarator parentReferenceDeclarator = f.newDeclarator(f.newName("__parent".toCharArray()));
parentReferenceDeclarator.addPointerOperator(f.newPointer());
final IASTParameterDeclaration parentReference = f.newParameterDeclaration(parentReferenceDeclSpecifier, parentReferenceDeclarator);
functionDeclarator.addParameterDeclaration(parentReference);
}
for (final Object parameterObject : methodDeclaration.parameters()) {
final SingleVariableDeclaration parameter = (SingleVariableDeclaration) parameterObject;
final SingleVariableDeclarationInfo declarationInfo = new SingleVariableDeclarationInfo(parameter, compilationUnitInfo);
final IASTParameterDeclaration parameterDeclaration = f.newParameterDeclaration(declarationInfo.getDeclSpecifier(), declarationInfo.getDeclarator());
functionDeclarator.addParameterDeclaration(parameterDeclaration);
}
}