diff options
author | Nathan Ridge | 2016-12-16 07:36:44 +0000 |
---|---|---|
committer | Nathan Ridge | 2016-12-31 18:29:36 +0000 |
commit | 94f4b03a0683e5b320cd2079c2af7f0e25f7cedb (patch) | |
tree | 433436282ea894f37dc2401b62a5c1bcb12ed5d5 | |
parent | d45c9b485174c4229d90c2efeabe3781e9fa93da (diff) | |
download | org.eclipse.cdt-94f4b03a0683e5b320cd2079c2af7f0e25f7cedb.tar.gz org.eclipse.cdt-94f4b03a0683e5b320cd2079c2af7f0e25f7cedb.tar.xz org.eclipse.cdt-94f4b03a0683e5b320cd2079c2af7f0e25f7cedb.zip |
Bug 508254 - Have adapter bindings for anonymous AST bindings implement ICPPInternalBinding
Change-Id: I02f035e6746aec4a937a325982033d70d711ffc7
2 files changed, 41 insertions, 1 deletions
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPBindingResolutionTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPBindingResolutionTest.java index ac0b9375d31..9348367373c 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPBindingResolutionTest.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPBindingResolutionTest.java @@ -2399,4 +2399,13 @@ public class IndexCPPBindingResolutionTest extends IndexBindingResolutionTestBas public void testStaticFieldOfEnclosingType_508254() throws Exception { checkBindings(); } + + // namespace { + // struct {} waldo; + // } + + // // empty file + public void testAnonymousStructInAnonymousNamespace_508254() throws Exception { + checkBindings(); + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMASTAdapter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMASTAdapter.java index 8b145ce61a8..a9d74762eb2 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMASTAdapter.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMASTAdapter.java @@ -45,6 +45,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPScope; import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter; import org.eclipse.cdt.core.index.IIndexBinding; import org.eclipse.cdt.core.parser.IToken; +import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding; public class PDOMASTAdapter { private static class AnonymousASTName implements IASTName { @@ -430,7 +431,7 @@ public class PDOMASTAdapter { } } - private static class AnonymousCPPBinding implements ICPPBinding { + private static class AnonymousCPPBinding implements ICPPInternalBinding { protected ICPPBinding fDelegate; private char[] fName; @@ -498,6 +499,36 @@ public class PDOMASTAdapter { public IBinding getOwner() { return fDelegate.getOwner(); } + + @Override + public IASTNode getDefinition() { + if (fDelegate instanceof ICPPInternalBinding) { + return ((ICPPInternalBinding) fDelegate).getDefinition(); + } + return null; + } + + @Override + public IASTNode[] getDeclarations() { + if (fDelegate instanceof ICPPInternalBinding) { + return ((ICPPInternalBinding) fDelegate).getDeclarations(); + } + return null; + } + + @Override + public void addDefinition(IASTNode node) { + if (fDelegate instanceof ICPPInternalBinding) { + ((ICPPInternalBinding) fDelegate).addDefinition(node); + } + } + + @Override + public void addDeclaration(IASTNode node) { + if (fDelegate instanceof ICPPInternalBinding) { + ((ICPPInternalBinding) fDelegate).addDeclaration(node); + } + } } private static class AnonymousCPPEnumeration extends AnonymousCPPBinding implements ICPPEnumeration { |