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-07-17 19:38:57 -07:00
parent d3264a7418
commit 72b6075733

View file

@ -91,12 +91,12 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
*/ */
public int getVisibility() { public int getVisibility() {
IASTDeclaration decl = getPrimaryDeclaration(); IASTDeclaration decl = getPrimaryDeclaration();
if( decl == null ){ if (decl == null) {
IScope scope = getScope(); IScope scope = getScope();
if( scope instanceof ICPPClassScope ){ if (scope instanceof ICPPClassScope) {
ICPPClassType cls = ((ICPPClassScope)scope).getClassType(); ICPPClassType cls = ((ICPPClassScope)scope).getClassType();
if( cls != null ) if (cls != null)
return ( cls.getKey() == ICPPClassType.k_class ) ? ICPPASTVisibilityLabel.v_private : ICPPASTVisibilityLabel.v_public; return (cls.getKey() == ICPPClassType.k_class) ? ICPPASTVisibilityLabel.v_private : ICPPASTVisibilityLabel.v_public;
} }
return ICPPASTVisibilityLabel.v_private; return ICPPASTVisibilityLabel.v_private;
} }
@ -105,14 +105,15 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
IASTDeclaration [] members = cls.getMembers(); IASTDeclaration [] members = cls.getMembers();
ICPPASTVisibilityLabel vis = null; ICPPASTVisibilityLabel vis = null;
for (IASTDeclaration member : members) { for (IASTDeclaration member : members) {
if( member instanceof ICPPASTVisibilityLabel ) if (member instanceof ICPPASTVisibilityLabel) {
vis = (ICPPASTVisibilityLabel) member; vis = (ICPPASTVisibilityLabel) member;
else if( member == decl ) } else if (member == decl) {
break; break;
}
} }
if( vis != null ){ if (vis != null) {
return vis.getVisibility(); return vis.getVisibility();
} else if( cls.getKey() == ICPPASTCompositeTypeSpecifier.k_class ){ } else if (cls.getKey() == ICPPASTCompositeTypeSpecifier.k_class) {
return ICPPASTVisibilityLabel.v_private; return ICPPASTVisibilityLabel.v_private;
} }
return ICPPASTVisibilityLabel.v_public; return ICPPASTVisibilityLabel.v_public;
@ -145,9 +146,9 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
*/ */
public boolean isVirtual() { public boolean isVirtual() {
IASTDeclaration decl = getPrimaryDeclaration(); IASTDeclaration decl = getPrimaryDeclaration();
if( decl != null ){ if (decl != null) {
ICPPASTDeclSpecifier declSpec = getDeclSpec(decl); ICPPASTDeclSpecifier declSpec = getDeclSpec(decl);
if( declSpec != null ){ if (declSpec != null) {
return declSpec.isVirtual(); return declSpec.isVirtual();
} }
} }
@ -156,10 +157,11 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
protected ICPPASTDeclSpecifier getDeclSpec(IASTDeclaration decl) { protected ICPPASTDeclSpecifier getDeclSpec(IASTDeclaration decl) {
ICPPASTDeclSpecifier declSpec = null; ICPPASTDeclSpecifier declSpec = null;
if( decl instanceof IASTSimpleDeclaration ) if (decl instanceof IASTSimpleDeclaration) {
declSpec = (ICPPASTDeclSpecifier) ((IASTSimpleDeclaration)decl).getDeclSpecifier(); declSpec = (ICPPASTDeclSpecifier) ((IASTSimpleDeclaration)decl).getDeclSpecifier();
else if( decl instanceof IASTFunctionDefinition ) } else if (decl instanceof IASTFunctionDefinition) {
declSpec = (ICPPASTDeclSpecifier) ((IASTFunctionDefinition)decl).getDeclSpecifier(); declSpec = (ICPPASTDeclSpecifier) ((IASTFunctionDefinition)decl).getDeclSpecifier();
}
return declSpec; return declSpec;
} }
@ -169,9 +171,9 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
@Override @Override
public boolean isInline() { public boolean isInline() {
IASTDeclaration decl = getPrimaryDeclaration(); IASTDeclaration decl = getPrimaryDeclaration();
if( decl instanceof IASTFunctionDefinition ) if (decl instanceof IASTFunctionDefinition)
return true; return true;
if( decl == null ) if (decl == null)
return false; return false;
IASTDeclSpecifier declSpec = ((IASTSimpleDeclaration)decl).getDeclSpecifier(); IASTDeclSpecifier declSpec = ((IASTSimpleDeclaration)decl).getDeclSpecifier();
@ -183,7 +185,7 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
*/ */
@Override @Override
public boolean isMutable() { public boolean isMutable() {
return hasStorageClass( this, IASTDeclSpecifier.sc_mutable ); return hasStorageClass(this, IASTDeclSpecifier.sc_mutable);
} }
@Override @Override