mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
CORE
Fixed NPE on nested declarations in code blocks. TESTS Updated CompleteParseASTTest::testSimpleForLoop()
This commit is contained in:
parent
ae96e590ff
commit
d557f7864c
4 changed files with 26 additions and 1 deletions
|
@ -1,3 +1,6 @@
|
|||
2003-09-05 John Camelon
|
||||
Updated CompleteParseASTTest::testSimpleForLoop()
|
||||
|
||||
2003-09-04 John Camelon
|
||||
Updated ASTFailedTests::testBug39702() to fail more accurately.
|
||||
Added testSimpleFunctionBody(), testSimpleForLoop() to CompleteParseASTTest.java.
|
||||
|
|
|
@ -595,6 +595,17 @@ public class CompleteParseASTTest extends CompleteParseBaseTest
|
|||
IASTFunction f = (IASTFunction) i.next();
|
||||
assertFalse( i.hasNext() );
|
||||
assertEquals( callback.getReferences().size(), 5 );
|
||||
i = parse( "const int FIVE = 5; void f() { int x = 0; for( int i = 0; i < FIVE; ++i ) x += i; }").getDeclarations();
|
||||
five = (IASTVariable) i.next();
|
||||
f = (IASTFunction) i.next();
|
||||
assertFalse( i.hasNext() );
|
||||
assertEquals( callback.getReferences().size(), 5 );
|
||||
|
||||
i = parse( "class A { }; void f() { for( int i = 0; i < (A*)0; ++i ) { A anA; } }").getDeclarations();
|
||||
IASTClassSpecifier classA = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
|
||||
f = (IASTFunction)i.next();
|
||||
assertFalse( i.hasNext() );
|
||||
assertEquals( callback.getReferences().size(), 4 );
|
||||
}
|
||||
|
||||
public void testBug42541() throws Exception
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
2003-09-05 John Camelon
|
||||
Fixed NPE on nested declarations in code blocks.
|
||||
|
||||
2003-09-04 John Camelon
|
||||
First pass of parsing function bodies with X-Reference information.
|
||||
Updated IASTFactory/ISourceElementRequestor to include IASTCodeScope
|
||||
|
|
|
@ -1667,7 +1667,15 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
|||
IContainerSymbol newScope = pst.newContainerSymbol("");
|
||||
newScope.setContainingSymbol(symbol);
|
||||
|
||||
return new ASTCodeScope( newScope );
|
||||
ASTCodeScope codeScope = new ASTCodeScope( newScope );
|
||||
try
|
||||
{
|
||||
attachSymbolExtension( newScope, codeScope );
|
||||
}
|
||||
catch (ExtensionException e)
|
||||
{
|
||||
}
|
||||
return codeScope;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
|
Loading…
Add table
Reference in a new issue