mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Cosmetics.
This commit is contained in:
parent
d3264a7418
commit
72b6075733
1 changed files with 28 additions and 26 deletions
|
@ -40,7 +40,7 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
|
|||
public CPPMethod(IASTDeclarator declarator) {
|
||||
super(declarator);
|
||||
}
|
||||
|
||||
|
||||
public IASTDeclaration getPrimaryDeclaration() {
|
||||
//first check if we already know it
|
||||
if (declarations != null) {
|
||||
|
@ -60,7 +60,7 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
|
|||
if (decl.getParent() instanceof ICPPASTCompositeTypeSpecifier)
|
||||
return decl;
|
||||
}
|
||||
|
||||
|
||||
final char[] myName = getASTName().getLookupKey();
|
||||
ICPPClassScope scope = (ICPPClassScope) getScope();
|
||||
ICPPASTCompositeTypeSpecifier compSpec = (ICPPASTCompositeTypeSpecifier) ASTInternal.getPhysicalNodeOfScope(scope);
|
||||
|
@ -91,33 +91,34 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
|
|||
*/
|
||||
public int getVisibility() {
|
||||
IASTDeclaration decl = getPrimaryDeclaration();
|
||||
if( decl == null ){
|
||||
if (decl == null) {
|
||||
IScope scope = getScope();
|
||||
if( scope instanceof ICPPClassScope ){
|
||||
if (scope instanceof ICPPClassScope) {
|
||||
ICPPClassType cls = ((ICPPClassScope)scope).getClassType();
|
||||
if( cls != null )
|
||||
return ( cls.getKey() == ICPPClassType.k_class ) ? ICPPASTVisibilityLabel.v_private : ICPPASTVisibilityLabel.v_public;
|
||||
if (cls != null)
|
||||
return (cls.getKey() == ICPPClassType.k_class) ? ICPPASTVisibilityLabel.v_private : ICPPASTVisibilityLabel.v_public;
|
||||
}
|
||||
return ICPPASTVisibilityLabel.v_private;
|
||||
}
|
||||
|
||||
|
||||
IASTCompositeTypeSpecifier cls = (IASTCompositeTypeSpecifier) decl.getParent();
|
||||
IASTDeclaration [] members = cls.getMembers();
|
||||
ICPPASTVisibilityLabel vis = null;
|
||||
for (IASTDeclaration member : members) {
|
||||
if( member instanceof ICPPASTVisibilityLabel )
|
||||
if (member instanceof ICPPASTVisibilityLabel) {
|
||||
vis = (ICPPASTVisibilityLabel) member;
|
||||
else if( member == decl )
|
||||
} else if (member == decl) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( vis != null ){
|
||||
if (vis != null) {
|
||||
return vis.getVisibility();
|
||||
} else if( cls.getKey() == ICPPASTCompositeTypeSpecifier.k_class ){
|
||||
} else if (cls.getKey() == ICPPASTCompositeTypeSpecifier.k_class) {
|
||||
return ICPPASTVisibilityLabel.v_private;
|
||||
}
|
||||
}
|
||||
return ICPPASTVisibilityLabel.v_public;
|
||||
}
|
||||
|
||||
|
||||
public ICPPClassType getClassOwner() {
|
||||
ICPPClassScope scope = (ICPPClassScope)getScope();
|
||||
return scope.getClassType();
|
||||
|
@ -139,15 +140,15 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
|
|||
public IScope getScope() {
|
||||
return CPPVisitor.getContainingScope(getASTName());
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isVirtual()
|
||||
*/
|
||||
public boolean isVirtual() {
|
||||
IASTDeclaration decl = getPrimaryDeclaration();
|
||||
if( decl != null ){
|
||||
if (decl != null) {
|
||||
ICPPASTDeclSpecifier declSpec = getDeclSpec(decl);
|
||||
if( declSpec != null ){
|
||||
if (declSpec != null) {
|
||||
return declSpec.isVirtual();
|
||||
}
|
||||
}
|
||||
|
@ -156,10 +157,11 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
|
|||
|
||||
protected ICPPASTDeclSpecifier getDeclSpec(IASTDeclaration decl) {
|
||||
ICPPASTDeclSpecifier declSpec = null;
|
||||
if( decl instanceof IASTSimpleDeclaration )
|
||||
if (decl instanceof IASTSimpleDeclaration) {
|
||||
declSpec = (ICPPASTDeclSpecifier) ((IASTSimpleDeclaration)decl).getDeclSpecifier();
|
||||
else if( decl instanceof IASTFunctionDefinition )
|
||||
} else if (decl instanceof IASTFunctionDefinition) {
|
||||
declSpec = (ICPPASTDeclSpecifier) ((IASTFunctionDefinition)decl).getDeclSpecifier();
|
||||
}
|
||||
return declSpec;
|
||||
}
|
||||
|
||||
|
@ -169,11 +171,11 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
|
|||
@Override
|
||||
public boolean isInline() {
|
||||
IASTDeclaration decl = getPrimaryDeclaration();
|
||||
if( decl instanceof IASTFunctionDefinition )
|
||||
if (decl instanceof IASTFunctionDefinition)
|
||||
return true;
|
||||
if( decl == null )
|
||||
if (decl == null)
|
||||
return false;
|
||||
|
||||
|
||||
IASTDeclSpecifier declSpec = ((IASTSimpleDeclaration)decl).getDeclSpecifier();
|
||||
return declSpec.isInline();
|
||||
}
|
||||
|
@ -183,9 +185,9 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
|
|||
*/
|
||||
@Override
|
||||
public boolean isMutable() {
|
||||
return hasStorageClass( this, IASTDeclSpecifier.sc_mutable );
|
||||
return hasStorageClass(this, IASTDeclSpecifier.sc_mutable);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isStatic(boolean resolveAll) {
|
||||
IASTDeclaration decl = getPrimaryDeclaration();
|
||||
|
@ -205,21 +207,21 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
|
|||
char[] name = getNameCharArray();
|
||||
if (name.length > 1 && name[0] == '~')
|
||||
return true;
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isImplicit() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isPureVirtual()
|
||||
*/
|
||||
public boolean isPureVirtual() {
|
||||
if (declarations != null) {
|
||||
for (IASTDeclarator dtor : declarations) {
|
||||
if (dtor == null)
|
||||
if (dtor == null)
|
||||
break;
|
||||
|
||||
dtor = ASTQueries.findOutermostDeclarator(dtor);
|
||||
|
|
Loading…
Add table
Reference in a new issue