1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 18:26:01 +02:00

Fix for 235196.

This commit is contained in:
Sergey Prigogin 2008-07-28 16:52:14 +00:00
parent b0780772c9
commit 0ff272e50e
3 changed files with 19 additions and 18 deletions

View file

@ -5645,7 +5645,7 @@ public class AST2CPPTests extends AST2BaseTest {
// using ns::A;
//
// class B: public A {};
public void _testBug235196() throws Exception {
public void testBug235196() throws Exception {
parseAndCheckBindings(getAboveComment());
}

View file

@ -28,14 +28,14 @@ import org.eclipse.core.runtime.PlatformObject;
/**
* @author aniefer
*/
public class CPPUsingDeclaration extends PlatformObject implements ICPPUsingDeclaration, ICPPInternalBinding{
public class CPPUsingDeclaration extends PlatformObject implements ICPPUsingDeclaration, ICPPInternalBinding {
private IASTName name;
private IBinding [] delegates;
private IBinding[] delegates;
public CPPUsingDeclaration( IASTName name, IBinding [] bindings ) {
if( name instanceof ICPPASTQualifiedName ){
IASTName [] ns = ((ICPPASTQualifiedName)name).getNames();
name = ns[ ns.length - 1 ];
public CPPUsingDeclaration(IASTName name, IBinding[] bindings) {
if (name instanceof ICPPASTQualifiedName) {
IASTName[] ns = ((ICPPASTQualifiedName) name).getNames();
name = ns[ns.length - 1];
}
this.name = name;
this.delegates= bindings;
@ -46,17 +46,17 @@ public class CPPUsingDeclaration extends PlatformObject implements ICPPUsingDecl
}
public String[] getQualifiedName() {
return CPPVisitor.getQualifiedName( this );
return CPPVisitor.getQualifiedName(this);
}
public char[][] getQualifiedNameCharArray() {
return CPPVisitor.getQualifiedNameCharArray( this );
return CPPVisitor.getQualifiedNameCharArray(this);
}
public boolean isGloballyQualified() throws DOMException {
IScope scope = getScope();
while( scope != null ){
if( scope instanceof ICPPBlockScope )
while (scope != null) {
if(scope instanceof ICPPBlockScope)
return false;
scope = scope.getParent();
}
@ -72,7 +72,7 @@ public class CPPUsingDeclaration extends PlatformObject implements ICPPUsingDecl
}
public IScope getScope() {
return CPPVisitor.getContainingScope( name.getParent() );
return CPPVisitor.getContainingScope(name.getParent());
}
public IASTNode[] getDeclarations() {
@ -81,19 +81,19 @@ public class CPPUsingDeclaration extends PlatformObject implements ICPPUsingDecl
public IASTNode getDefinition() {
IASTNode n = name.getParent();
if( n instanceof ICPPASTTemplateId )
if (n instanceof ICPPASTTemplateId)
n = n.getParent();
return n;
}
public void addDefinition( IASTNode node ) {
public void addDefinition(IASTNode node) {
}
public void addDeclaration( IASTNode node ) {
public void addDeclaration(IASTNode node) {
}
public void removeDeclaration( IASTNode node ) {
public void removeDeclaration(IASTNode node) {
}
public ILinkage getLinkage() {

View file

@ -1517,8 +1517,9 @@ public class CPPSemantics {
return null;
}
if (candidate != null) {
if (candidate instanceof IType == false && candidate instanceof ICPPNamespace == false
&& LookupData.typesOnly(name)) {
if (!(candidate instanceof IType) && !(candidate instanceof ICPPNamespace) &&
!(candidate instanceof ICPPUsingDeclaration) &&
LookupData.typesOnly(name)) {
return null;
}