1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-09 02:36: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; // using ns::A;
// //
// class B: public A {}; // class B: public A {};
public void _testBug235196() throws Exception { public void testBug235196() throws Exception {
parseAndCheckBindings(getAboveComment()); parseAndCheckBindings(getAboveComment());
} }

View file

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

View file

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