1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2011-05-16 19:11:22 +00:00
parent 6a8b930ea6
commit 2085f2d1fc
2 changed files with 9 additions and 7 deletions

View file

@ -7,7 +7,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Institute for Software - initial API and implementation
* Institute for Software - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.ui.refactoring;
@ -31,7 +31,6 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding;
/**
* Represents a function or method and adds some useful helper methods to
* determine if methods are in the same class.
*
*/
public class MethodContext {
public enum ContextType{ NONE, FUNCTION, METHOD }
@ -204,7 +203,8 @@ public class MethodContext {
private static ICPPClassType getClassBinding(IASTName declName1) {
if (declName1.getParent().getParent().getParent() instanceof ICPPASTCompositeTypeSpecifier) {
ICPPASTCompositeTypeSpecifier compTypeSpec = (ICPPASTCompositeTypeSpecifier) declName1.getParent().getParent().getParent();
ICPPASTCompositeTypeSpecifier compTypeSpec =
(ICPPASTCompositeTypeSpecifier) declName1.getParent().getParent().getParent();
return (ICPPClassType) compTypeSpec.getName().resolveBinding();
}
return null;

View file

@ -107,11 +107,11 @@ public class NodeHelper {
while (node != null && !found) {
node = node.getParent();
if (node instanceof IASTFunctionDeclarator) {
name=((IASTFunctionDeclarator)node).getName();
name = ((IASTFunctionDeclarator) node).getName();
found = true;
context.setType(MethodContext.ContextType.FUNCTION);
} else if (node instanceof IASTFunctionDefinition) {
name=CPPVisitor.findInnermostDeclarator(((IASTFunctionDefinition)node).getDeclarator()).getName();
name = CPPVisitor.findInnermostDeclarator(((IASTFunctionDefinition) node).getDeclarator()).getName();
found = true;
context.setType(MethodContext.ContextType.FUNCTION);
}
@ -160,7 +160,8 @@ public class NodeHelper {
IASTName declName = DeclarationFinder.findDeclarationInTranslationUnit(locTu, tmpname);
if (declName != null) {
IASTNode methoddefinition = declName.getParent().getParent();
if (methoddefinition instanceof IASTSimpleDeclaration || methoddefinition instanceof IASTFunctionDefinition) {
if (methoddefinition instanceof IASTSimpleDeclaration ||
methoddefinition instanceof IASTFunctionDefinition) {
context.setMethodDeclarationName(declName);
}
}
@ -206,7 +207,8 @@ public class NodeHelper {
if (simpleDeclaration == null) {
return false;
}
return simpleDeclaration.getDeclarators().length == 1 && simpleDeclaration.getDeclarators()[0] instanceof ICPPASTFunctionDeclarator;
return simpleDeclaration.getDeclarators().length == 1 &&
simpleDeclaration.getDeclarators()[0] instanceof ICPPASTFunctionDeclarator;
}
public static boolean isContainedInTemplateDeclaration(IASTNode node) {