mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Bug 508254 - Have adapter bindings for anonymous AST bindings implement ICPPInternalBinding
Change-Id: I02f035e6746aec4a937a325982033d70d711ffc7
This commit is contained in:
parent
d6076f954b
commit
64033dea4c
2 changed files with 41 additions and 1 deletions
|
@ -2409,4 +2409,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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Add table
Reference in a new issue