mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Fix Symbol Table Lookup in addBaseSpecifier() for Andrew.
This commit is contained in:
parent
2ea02e1982
commit
8b6f29d3ad
2 changed files with 20 additions and 4 deletions
|
@ -651,7 +651,10 @@ public class CompleteParseASTTest extends TestCase
|
|||
IASTVariable v = (IASTVariable)declarations.next();
|
||||
assertEquals( v.getName(), "x");
|
||||
assertEquals( ((IASTSimpleTypeSpecifier)v.getAbstractDeclaration().getTypeSpecifier()).getTypeSpecifier(), classA );
|
||||
assertEquals( callback.getReferences().size(), 3 );
|
||||
assertEquals( callback.getReferences().size(), 3 );
|
||||
Iterator i = callback.getReferences().iterator();
|
||||
while( i.hasNext() )
|
||||
assertEquals( ((IASTReference)i.next()).getReferencedElement(), classA );
|
||||
}
|
||||
|
||||
public void testSimpleField() throws Exception
|
||||
|
@ -777,8 +780,18 @@ public class CompleteParseASTTest extends TestCase
|
|||
assertEquals( enumeratorE_1.getOwnerEnumerationSpecifier(), enumE1 );
|
||||
IASTVariable variableX = (IASTVariable)subB.next();
|
||||
IASTClassSpecifier classC = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)subB.next()).getTypeSpecifier();
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void testAndrewsExample() throws Exception
|
||||
{
|
||||
Iterator declarations = parse( "namespace N{ class A {}; } using namespace N; class B: public A{};").getDeclarations();
|
||||
IASTNamespaceDefinition namespaceN = (IASTNamespaceDefinition)declarations.next();
|
||||
IASTClassSpecifier classA = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)getDeclarations( namespaceN ).next()).getTypeSpecifier();
|
||||
IASTUsingDirective usingClause = (IASTUsingDirective)declarations.next();
|
||||
IASTClassSpecifier classB = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)declarations.next()).getTypeSpecifier();
|
||||
IASTBaseSpecifier baseSpec = (IASTBaseSpecifier)classB.getBaseClauses().next();
|
||||
assertEquals( baseSpec.getParentClassSpecifier(), classA );
|
||||
assertEquals( callback.getReferences().size(), 2 );
|
||||
}
|
||||
|
||||
// public void testSimpleTypedef() throws Exception
|
||||
|
|
|
@ -397,7 +397,10 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
|||
if( t.getType() == IToken.tCOLONCOLON ) continue;
|
||||
try
|
||||
{
|
||||
symbol = symbol.LookupNestedNameSpecifier( t.getImage() );
|
||||
if( t == parentClassName.getLastToken())
|
||||
symbol = (IContainerSymbol)symbol.Lookup( t.getImage() );
|
||||
else
|
||||
symbol = symbol.LookupNestedNameSpecifier( t.getImage() );
|
||||
references.add( createReference( symbol, t.getImage(), t.getOffset() ));
|
||||
}
|
||||
catch( ParserSymbolTableException pste )
|
||||
|
|
Loading…
Add table
Reference in a new issue