mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-09 02:36:01 +02:00
Fix for bug 238554 Implement Method void parameters
This commit is contained in:
parent
7cf6bfaec0
commit
030bdf48c4
2 changed files with 32 additions and 3 deletions
|
@ -712,3 +712,28 @@ int *TestClass::get(char *val)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//! Bug 238554 void parameters
|
||||||
|
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
||||||
|
//@.config
|
||||||
|
filename=A.h
|
||||||
|
//@A.h
|
||||||
|
|
||||||
|
class Test
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//$void doNothing(void);$//
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//@A.cpp
|
||||||
|
#include "A.h"
|
||||||
|
|
||||||
|
//=
|
||||||
|
#include "A.h"
|
||||||
|
|
||||||
|
void Test::doNothing(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ import org.eclipse.text.edits.InsertEdit;
|
||||||
import org.eclipse.text.edits.MultiTextEdit;
|
import org.eclipse.text.edits.MultiTextEdit;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration;
|
import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
|
||||||
import org.eclipse.cdt.ui.refactoring.CTextFileChange;
|
import org.eclipse.cdt.ui.refactoring.CTextFileChange;
|
||||||
|
|
||||||
|
@ -58,7 +59,10 @@ public class ParameterHandler {
|
||||||
for(IASTParameterDeclaration actParam : getParametersFromMethodNode()) {
|
for(IASTParameterDeclaration actParam : getParametersFromMethodNode()) {
|
||||||
String actName = actParam.getDeclarator().getName().toString();
|
String actName = actParam.getDeclarator().getName().toString();
|
||||||
boolean isChangable = false;
|
boolean isChangable = false;
|
||||||
if(actName.length() == 0) {
|
if(actParam.getDeclSpecifier()instanceof IASTSimpleDeclSpecifier && ((IASTSimpleDeclSpecifier)actParam.getDeclSpecifier()).getType() == IASTSimpleDeclSpecifier.t_void) {
|
||||||
|
actName = ""; //$NON-NLS-1$
|
||||||
|
isChangable = false;
|
||||||
|
}else if(actName.length() == 0) {
|
||||||
needsAditionalArgumentNames = true;
|
needsAditionalArgumentNames = true;
|
||||||
isChangable = true;
|
isChangable = true;
|
||||||
actName = findNameForParameter(NameHelper.getTypeName(actParam));
|
actName = findNameForParameter(NameHelper.getTypeName(actParam));
|
||||||
|
|
Loading…
Add table
Reference in a new issue