1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-05 23:35:48 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2011-04-18 18:53:08 +00:00
parent 51c07a5131
commit 3128381403

View file

@ -89,7 +89,7 @@ public class NodeHelper {
} }
public static IASTSimpleDeclaration findSimpleDeclarationInParents(IASTNode node) { public static IASTSimpleDeclaration findSimpleDeclarationInParents(IASTNode node) {
while (node != null){ while (node != null) {
if (node instanceof IASTSimpleDeclaration) { if (node instanceof IASTSimpleDeclaration) {
return (IASTSimpleDeclaration) node; return (IASTSimpleDeclaration) node;
} }
@ -104,13 +104,13 @@ public class NodeHelper {
MethodContext context = new MethodContext(); MethodContext context = new MethodContext();
context.setType(MethodContext.ContextType.NONE); context.setType(MethodContext.ContextType.NONE);
IASTName name = null; IASTName name = null;
while (node != null && !found){ while (node != null && !found) {
node = node.getParent(); node = node.getParent();
if (node instanceof IASTFunctionDeclarator){ if (node instanceof IASTFunctionDeclarator) {
name=((IASTFunctionDeclarator)node).getName(); name=((IASTFunctionDeclarator)node).getName();
found = true; found = true;
context.setType(MethodContext.ContextType.FUNCTION); context.setType(MethodContext.ContextType.FUNCTION);
} else if (node instanceof IASTFunctionDefinition){ } else if (node instanceof IASTFunctionDefinition) {
name=CPPVisitor.findInnermostDeclarator(((IASTFunctionDefinition)node).getDeclarator()).getName(); name=CPPVisitor.findInnermostDeclarator(((IASTFunctionDefinition)node).getDeclarator()).getName();
found = true; found = true;
context.setType(MethodContext.ContextType.FUNCTION); context.setType(MethodContext.ContextType.FUNCTION);
@ -126,8 +126,8 @@ public class NodeHelper {
private static void getMethodContex(IASTTranslationUnit translationUnit, MethodContext context, private static void getMethodContex(IASTTranslationUnit translationUnit, MethodContext context,
IASTName name) { IASTName name) {
if (name instanceof ICPPASTQualifiedName){ if (name instanceof ICPPASTQualifiedName) {
ICPPASTQualifiedName qname =( ICPPASTQualifiedName )name; ICPPASTQualifiedName qname = (ICPPASTQualifiedName) name;
context.setMethodQName(qname); context.setMethodQName(qname);
IBinding bind = qname.resolveBinding(); IBinding bind = qname.resolveBinding();
IASTName[] decl = translationUnit.getDeclarationsInAST(bind); IASTName[] decl = translationUnit.getDeclarationsInAST(bind);
@ -166,14 +166,14 @@ public class NodeHelper {
} }
} }
} }
if (name instanceof ICPPASTQualifiedName){ if (name instanceof ICPPASTQualifiedName) {
ICPPASTQualifiedName qname =( ICPPASTQualifiedName )name; ICPPASTQualifiedName qname = (ICPPASTQualifiedName) name;
context.setMethodQName(qname); context.setMethodQName(qname);
} }
} }
public static IASTCompoundStatement findCompoundStatementInAncestors(IASTNode node) { public static IASTCompoundStatement findCompoundStatementInAncestors(IASTNode node) {
while (node != null){ while (node != null) {
if (node instanceof IASTCompoundStatement) { if (node instanceof IASTCompoundStatement) {
return (IASTCompoundStatement) node; return (IASTCompoundStatement) node;
} }
@ -183,7 +183,7 @@ public class NodeHelper {
} }
public static IASTCompositeTypeSpecifier findClassInAncestors(IASTNode node) { public static IASTCompositeTypeSpecifier findClassInAncestors(IASTNode node) {
while (!(node instanceof IASTCompositeTypeSpecifier)){ while (!(node instanceof IASTCompositeTypeSpecifier)) {
if (node instanceof IASTTranslationUnit) { if (node instanceof IASTTranslationUnit) {
return null; return null;
} }
@ -193,7 +193,7 @@ public class NodeHelper {
} }
public static IASTFunctionDefinition findFunctionDefinitionInAncestors(IASTNode node) { public static IASTFunctionDefinition findFunctionDefinitionInAncestors(IASTNode node) {
while (node != null){ while (node != null) {
if (node instanceof IASTFunctionDefinition) { if (node instanceof IASTFunctionDefinition) {
return (IASTFunctionDefinition) node; return (IASTFunctionDefinition) node;
} }