mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
fix bug 89828
This commit is contained in:
parent
7abf1397a2
commit
f7566ee272
2 changed files with 34 additions and 6 deletions
|
@ -3138,5 +3138,22 @@ public class AST2CPPTests extends AST2BaseTest {
|
|||
assertTrue( col.getName(2).resolveBinding() instanceof ICPPClassType );
|
||||
assertTrue( col.getName(3).resolveBinding() instanceof ICPPClassType );
|
||||
}
|
||||
|
||||
public void testBug89828() throws Exception {
|
||||
IASTTranslationUnit tu = parse( "class B * b; void f(); void f( int );", ParserLanguage.CPP ); //$NON-NLS-1$
|
||||
CPPNameCollector col = new CPPNameCollector();
|
||||
tu.accept( col );
|
||||
|
||||
assertTrue( col.getName(0).resolveBinding() instanceof ICPPClassType );
|
||||
assertTrue( col.getName(1).resolveBinding() instanceof ICPPVariable );
|
||||
IFunction f1 = (IFunction) col.getName(2).resolveBinding();
|
||||
IFunction f2 = (IFunction) col.getName(3).resolveBinding();
|
||||
|
||||
IScope scope = tu.getScope();
|
||||
IBinding [] bs = scope.find("f"); //$NON-NLS-1$
|
||||
assertEquals( bs.length, 2 );
|
||||
assertSame( bs[0], f1 );
|
||||
assertSame( bs[1], f2 );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1301,13 +1301,24 @@ public class CPPSemantics {
|
|||
return (IBinding) bindings[0];
|
||||
}
|
||||
|
||||
LookupData data = createLookupData( name, false );
|
||||
data.foundItems = bindings;
|
||||
try {
|
||||
return resolveAmbiguities( data, name );
|
||||
} catch ( DOMException e ) {
|
||||
return e.getProblem();
|
||||
if( name.getPropertyInParent() != STRING_LOOKUP_PROPERTY ) {
|
||||
LookupData data = createLookupData( name, false );
|
||||
data.foundItems = bindings;
|
||||
try {
|
||||
return resolveAmbiguities( data, name );
|
||||
} catch ( DOMException e ) {
|
||||
return e.getProblem();
|
||||
}
|
||||
}
|
||||
|
||||
IBinding [] result = null;
|
||||
for ( int i = 0; i < bindings.length; i++ ) {
|
||||
if( bindings[i] instanceof IASTName )
|
||||
result = (IBinding[]) ArrayUtil.append( IBinding.class, result, ((IASTName)bindings[i]).resolveBinding() );
|
||||
else if( bindings[i] instanceof IBinding )
|
||||
result = (IBinding[]) ArrayUtil.append( IBinding.class, result, bindings[i] );
|
||||
}
|
||||
return new CPPCompositeBinding( result );
|
||||
}
|
||||
|
||||
static public boolean declaredBefore( Object obj, IASTNode node ){
|
||||
|
|
Loading…
Add table
Reference in a new issue