Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Niefer2005-07-07 15:15:59 -0400
committerAndrew Niefer2005-07-07 15:15:59 -0400
commitc162527605aef79dd428a06f927011a82ee5c035 (patch)
tree53888f6d947f28408152b65bd360c8526cfd8061
parent856008f63f345b2218304b74b95bda933378b445 (diff)
downloadorg.eclipse.cdt-c162527605aef79dd428a06f927011a82ee5c035.tar.gz
org.eclipse.cdt-c162527605aef79dd428a06f927011a82ee5c035.tar.xz
org.eclipse.cdt-c162527605aef79dd428a06f927011a82ee5c035.zip
bug 102754
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethod.java17
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethodInstance.java7
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethodSpecialization.java2
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethodTemplate.java16
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethodTemplateSpecialization.java9
5 files changed, 37 insertions, 14 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethod.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethod.java
index d13ce310bb..7d2a25b5ca 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethod.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethod.java
@@ -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;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethodInstance.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethodInstance.java
index 10f4afbfbf..50ee066978 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethodInstance.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethodInstance.java
@@ -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;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethodSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethodSpecialization.java
index 7bbc1aa325..ecb6fc20fa 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethodSpecialization.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethodSpecialization.java
@@ -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;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethodTemplate.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethodTemplate.java
index 0569f61d5e..4a35cb242d 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethodTemplate.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethodTemplate.java
@@ -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;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethodTemplateSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethodTemplateSpecialization.java
index 183f461d27..cc72bf5c1a 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethodTemplateSpecialization.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethodTemplateSpecialization.java
@@ -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;

Back to the top