mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-09-10 12:03:16 +02:00
bug 102754
This commit is contained in:
parent
856008f63f
commit
c162527605
5 changed files with 37 additions and 14 deletions
|
@ -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.ICPPASTQualifiedName;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTVisiblityLabel;
|
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.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.ICPPDelegate;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
||||||
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
|
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
|
||||||
|
@ -51,7 +52,7 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isDestructor()
|
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isDestructor()
|
||||||
*/
|
*/
|
||||||
public boolean isDestructor() throws DOMException {
|
public boolean isDestructor() {
|
||||||
char[] name = getNameCharArray();
|
char[] name = getNameCharArray();
|
||||||
if (name.length > 1 && name[0] == '~')
|
if (name.length > 1 && name[0] == '~')
|
||||||
return true;
|
return true;
|
||||||
|
@ -82,7 +83,7 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isDestructor()
|
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isDestructor()
|
||||||
*/
|
*/
|
||||||
public boolean isDestructor() throws DOMException {
|
public boolean isDestructor() {
|
||||||
char[] name = getNameCharArray();
|
char[] name = getNameCharArray();
|
||||||
if (name.length > 1 && name[0] == '~')
|
if (name.length > 1 && name[0] == '~')
|
||||||
return true;
|
return true;
|
||||||
|
@ -140,6 +141,16 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
|
||||||
*/
|
*/
|
||||||
public int getVisibility() throws DOMException {
|
public int getVisibility() throws DOMException {
|
||||||
IASTDeclaration decl = getPrimaryDeclaration();
|
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();
|
IASTCompositeTypeSpecifier cls = (IASTCompositeTypeSpecifier) decl.getParent();
|
||||||
IASTDeclaration [] members = cls.getMembers();
|
IASTDeclaration [] members = cls.getMembers();
|
||||||
ICPPASTVisiblityLabel vis = null;
|
ICPPASTVisiblityLabel vis = null;
|
||||||
|
@ -250,7 +261,7 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isDestructor()
|
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isDestructor()
|
||||||
*/
|
*/
|
||||||
public boolean isDestructor() throws DOMException {
|
public boolean isDestructor() {
|
||||||
char[] name = getNameCharArray();
|
char[] name = getNameCharArray();
|
||||||
if (name.length > 1 && name[0] == '~')
|
if (name.length > 1 && name[0] == '~')
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -38,9 +38,8 @@ public class CPPMethodInstance extends CPPFunctionInstance implements ICPPMethod
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMember#getVisibility()
|
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMember#getVisibility()
|
||||||
*/
|
*/
|
||||||
public int getVisibility() {
|
public int getVisibility() throws DOMException {
|
||||||
// TODO Auto-generated method stub
|
return ((ICPPMethod)getTemplateDefinition()).getVisibility();
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -53,7 +52,7 @@ public class CPPMethodInstance extends CPPFunctionInstance implements ICPPMethod
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isDestructor()
|
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isDestructor()
|
||||||
*/
|
*/
|
||||||
public boolean isDestructor() throws DOMException {
|
public boolean isDestructor() {
|
||||||
char[] name = getNameCharArray();
|
char[] name = getNameCharArray();
|
||||||
if (name.length > 1 && name[0] == '~')
|
if (name.length > 1 && name[0] == '~')
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -75,7 +75,7 @@ public class CPPMethodSpecialization extends CPPFunctionSpecialization
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isDestructor()
|
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isDestructor()
|
||||||
*/
|
*/
|
||||||
public boolean isDestructor() throws DOMException {
|
public boolean isDestructor() {
|
||||||
char[] name = getNameCharArray();
|
char[] name = getNameCharArray();
|
||||||
if (name.length > 1 && name[0] == '~')
|
if (name.length > 1 && name[0] == '~')
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -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.ICPPASTTemplateDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTVisiblityLabel;
|
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.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.ICPPMethod;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateScope;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateScope;
|
||||||
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
|
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
|
||||||
|
@ -97,6 +98,17 @@ public class CPPMethodTemplate extends CPPFunctionTemplate implements
|
||||||
*/
|
*/
|
||||||
public int getVisibility() throws DOMException {
|
public int getVisibility() throws DOMException {
|
||||||
IASTDeclaration decl = getPrimaryDeclaration();
|
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();
|
IASTCompositeTypeSpecifier cls = (IASTCompositeTypeSpecifier) decl.getParent();
|
||||||
IASTDeclaration [] members = cls.getMembers();
|
IASTDeclaration [] members = cls.getMembers();
|
||||||
ICPPASTVisiblityLabel vis = null;
|
ICPPASTVisiblityLabel vis = null;
|
||||||
|
@ -117,7 +129,7 @@ public class CPPMethodTemplate extends CPPFunctionTemplate implements
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isVirtual()
|
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isVirtual()
|
||||||
*/
|
*/
|
||||||
public boolean isVirtual() throws DOMException {
|
public boolean isVirtual() {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -136,7 +148,7 @@ public class CPPMethodTemplate extends CPPFunctionTemplate implements
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isDestructor()
|
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isDestructor()
|
||||||
*/
|
*/
|
||||||
public boolean isDestructor() throws DOMException {
|
public boolean isDestructor() {
|
||||||
char[] name = getNameCharArray();
|
char[] name = getNameCharArray();
|
||||||
if (name.length > 1 && name[0] == '~')
|
if (name.length > 1 && name[0] == '~')
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -35,13 +35,12 @@ public class CPPMethodTemplateSpecialization extends
|
||||||
public CPPMethodTemplateSpecialization(IBinding specialized,
|
public CPPMethodTemplateSpecialization(IBinding specialized,
|
||||||
ICPPScope scope, ObjectMap argumentMap) {
|
ICPPScope scope, ObjectMap argumentMap) {
|
||||||
super(specialized, scope, argumentMap);
|
super(specialized, scope, argumentMap);
|
||||||
// TODO Auto-generated constructor stub
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isVirtual()
|
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isVirtual()
|
||||||
*/
|
*/
|
||||||
public boolean isVirtual() throws DOMException {
|
public boolean isVirtual() {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -50,14 +49,16 @@ public class CPPMethodTemplateSpecialization extends
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMember#getVisibility()
|
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMember#getVisibility()
|
||||||
*/
|
*/
|
||||||
public int getVisibility() throws DOMException {
|
public int getVisibility() throws DOMException {
|
||||||
// TODO Auto-generated method stub
|
IBinding m = getSpecializedBinding();
|
||||||
|
if( m instanceof ICPPMethod )
|
||||||
|
return ((ICPPMethod)m).getVisibility();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isDestructor()
|
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isDestructor()
|
||||||
*/
|
*/
|
||||||
public boolean isDestructor() throws DOMException {
|
public boolean isDestructor() {
|
||||||
char[] name = getNameCharArray();
|
char[] name = getNameCharArray();
|
||||||
if (name.length > 1 && name[0] == '~')
|
if (name.length > 1 && name[0] == '~')
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Add table
Reference in a new issue