Skip to main content
summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMarkus Schorn2009-07-02 09:52:00 -0400
committerMarkus Schorn2009-07-02 09:52:00 -0400
commit9d43c19c0a4f8137e7cc663685463744373e18b0 (patch)
tree25f7af875dcd4a7690f7a19037db9c7356396573 /core
parentfd1791462d385998244255172b24c9bda776b975 (diff)
downloadorg.eclipse.cdt-9d43c19c0a4f8137e7cc663685463744373e18b0.tar.gz
org.eclipse.cdt-9d43c19c0a4f8137e7cc663685463744373e18b0.tar.xz
org.eclipse.cdt-9d43c19c0a4f8137e7cc663685463744373e18b0.zip
Comparison of owners, bug 281782.
Diffstat (limited to 'core')
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexBugsTests.java2
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPBinding.java52
2 files changed, 25 insertions, 29 deletions
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexBugsTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexBugsTests.java
index fbb5b8a821..8bfe8fb40b 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexBugsTests.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexBugsTests.java
@@ -1993,7 +1993,7 @@ public class IndexBugsTests extends BaseTestCase {
// }
// enum E { e2 };
- public void _testDisambiguationByReachability_281782() throws Exception {
+ public void testDisambiguationByReachability_281782() throws Exception {
waitForIndexer();
String[] testData = getContentsForTest(3);
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPBinding.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPBinding.java
index 5e01c2f55a..f9cb5c01a3 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPBinding.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPBinding.java
@@ -44,41 +44,37 @@ abstract class PDOMCPPBinding extends PDOMBinding implements ICPPBinding {
}
protected boolean isSameOwner(IBinding owner1, IBinding owner2) {
- if (owner1 == null)
- return owner2 == null;
- if (owner2 == null)
- return false;
-
- if (owner1 instanceof IType) {
- if (owner2 instanceof IType) {
- return ((IType) owner1).isSameType((IType) owner2);
- }
- return false;
- }
try {
- while(owner1 instanceof ICPPNamespace && owner2 instanceof ICPPNamespace) {
- final char[] n1 = owner1.getNameCharArray();
- // ignore unknown namespaces
- if (n1.length == 0) {
- owner1= owner1.getOwner();
- continue;
- }
- final char[] n2= owner2.getNameCharArray();
- if (n2.length == 0) {
- owner2= owner2.getOwner();
- continue;
- }
- if (!CharArrayUtils.equals(n1, n2))
- return false;
-
+ // ignore unnamed namespaces
+ while(owner1 instanceof ICPPNamespace && owner1.getNameCharArray().length == 0)
owner1= owner1.getOwner();
+ // ignore unnamed namespaces
+ while(owner2 instanceof ICPPNamespace && owner2.getNameCharArray().length == 0)
owner2= owner2.getOwner();
+
+ if (owner1 == null)
+ return owner2 == null;
+ if (owner2 == null)
+ return false;
+
+ if (owner1 instanceof IType) {
+ if (owner2 instanceof IType) {
+ return ((IType) owner1).isSameType((IType) owner2);
+ }
+ return false;
+ }
+ if (owner1 instanceof ICPPNamespace) {
+ if (owner2 instanceof ICPPNamespace) {
+ if (!CharArrayUtils.equals(owner1.getNameCharArray(), owner2.getNameCharArray()))
+ return false;
+ return isSameOwner(owner1.getOwner(), owner2.getOwner());
+ }
+ return false;
}
} catch (DOMException e) {
CCorePlugin.log(e);
- return false;
}
- return owner1 == null && owner2 == null;
+ return false;
}
final public char[][] getQualifiedNameCharArray() throws DOMException {

Back to the top