1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 09:25:31 +02:00

bug 102754

This commit is contained in:
Andrew Niefer 2005-07-07 19:15:59 +00:00
parent 856008f63f
commit c162527605
5 changed files with 37 additions and 14 deletions

View file

@ -29,6 +29,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTVisiblityLabel;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
@ -51,7 +52,7 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isDestructor()
*/
public boolean isDestructor() throws DOMException {
public boolean isDestructor() {
char[] name = getNameCharArray();
if (name.length > 1 && name[0] == '~')
return true;
@ -82,7 +83,7 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isDestructor()
*/
public boolean isDestructor() throws DOMException {
public boolean isDestructor() {
char[] name = getNameCharArray();
if (name.length > 1 && name[0] == '~')
return true;
@ -140,6 +141,16 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
*/
public int getVisibility() throws DOMException {
IASTDeclaration decl = getPrimaryDeclaration();
if( decl == null ){
IScope scope = getScope();
if( scope instanceof ICPPClassScope ){
ICPPClassType cls = ((ICPPClassScope)scope).getClassType();
if( cls != null )
return ( cls.getKey() == ICPPClassType.k_class ) ? ICPPASTVisiblityLabel.v_private : ICPPASTVisiblityLabel.v_public;
}
return ICPPASTVisiblityLabel.v_private;
}
IASTCompositeTypeSpecifier cls = (IASTCompositeTypeSpecifier) decl.getParent();
IASTDeclaration [] members = cls.getMembers();
ICPPASTVisiblityLabel vis = null;
@ -250,7 +261,7 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isDestructor()
*/
public boolean isDestructor() throws DOMException {
public boolean isDestructor() {
char[] name = getNameCharArray();
if (name.length > 1 && name[0] == '~')
return true;

View file

@ -38,9 +38,8 @@ public class CPPMethodInstance extends CPPFunctionInstance implements ICPPMethod
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMember#getVisibility()
*/
public int getVisibility() {
// TODO Auto-generated method stub
return 0;
public int getVisibility() throws DOMException {
return ((ICPPMethod)getTemplateDefinition()).getVisibility();
}
/* (non-Javadoc)
@ -53,7 +52,7 @@ public class CPPMethodInstance extends CPPFunctionInstance implements ICPPMethod
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isDestructor()
*/
public boolean isDestructor() throws DOMException {
public boolean isDestructor() {
char[] name = getNameCharArray();
if (name.length > 1 && name[0] == '~')
return true;

View file

@ -75,7 +75,7 @@ public class CPPMethodSpecialization extends CPPFunctionSpecialization
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isDestructor()
*/
public boolean isDestructor() throws DOMException {
public boolean isDestructor() {
char[] name = getNameCharArray();
if (name.length > 1 && name[0] == '~')
return true;

View file

@ -26,6 +26,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateDeclaration;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTVisiblityLabel;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateScope;
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
@ -97,6 +98,17 @@ public class CPPMethodTemplate extends CPPFunctionTemplate implements
*/
public int getVisibility() throws DOMException {
IASTDeclaration decl = getPrimaryDeclaration();
if( decl == null ){
IScope scope = getScope();
if( scope instanceof ICPPTemplateScope)
scope = scope.getParent();
if( scope instanceof ICPPClassScope ){
ICPPClassType cls = ((ICPPClassScope)scope).getClassType();
if( cls != null )
return ( cls.getKey() == ICPPClassType.k_class ) ? ICPPASTVisiblityLabel.v_private : ICPPASTVisiblityLabel.v_public;
}
return ICPPASTVisiblityLabel.v_private;
}
IASTCompositeTypeSpecifier cls = (IASTCompositeTypeSpecifier) decl.getParent();
IASTDeclaration [] members = cls.getMembers();
ICPPASTVisiblityLabel vis = null;
@ -117,7 +129,7 @@ public class CPPMethodTemplate extends CPPFunctionTemplate implements
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isVirtual()
*/
public boolean isVirtual() throws DOMException {
public boolean isVirtual() {
// TODO Auto-generated method stub
return false;
}
@ -136,7 +148,7 @@ public class CPPMethodTemplate extends CPPFunctionTemplate implements
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isDestructor()
*/
public boolean isDestructor() throws DOMException {
public boolean isDestructor() {
char[] name = getNameCharArray();
if (name.length > 1 && name[0] == '~')
return true;

View file

@ -35,13 +35,12 @@ public class CPPMethodTemplateSpecialization extends
public CPPMethodTemplateSpecialization(IBinding specialized,
ICPPScope scope, ObjectMap argumentMap) {
super(specialized, scope, argumentMap);
// TODO Auto-generated constructor stub
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isVirtual()
*/
public boolean isVirtual() throws DOMException {
public boolean isVirtual() {
// TODO Auto-generated method stub
return false;
}
@ -50,14 +49,16 @@ public class CPPMethodTemplateSpecialization extends
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMember#getVisibility()
*/
public int getVisibility() throws DOMException {
// TODO Auto-generated method stub
IBinding m = getSpecializedBinding();
if( m instanceof ICPPMethod )
return ((ICPPMethod)m).getVisibility();
return 0;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isDestructor()
*/
public boolean isDestructor() throws DOMException {
public boolean isDestructor() {
char[] name = getNameCharArray();
if (name.length > 1 && name[0] == '~')
return true;