1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00
Fixed NPE on nested declarations in code blocks.  
	
TESTS
	Updated CompleteParseASTTest::testSimpleForLoop()
This commit is contained in:
John Camelon 2003-09-05 14:20:15 +00:00
parent ae96e590ff
commit d557f7864c
4 changed files with 26 additions and 1 deletions

View file

@ -1,3 +1,6 @@
2003-09-05 John Camelon
Updated CompleteParseASTTest::testSimpleForLoop()
2003-09-04 John Camelon 2003-09-04 John Camelon
Updated ASTFailedTests::testBug39702() to fail more accurately. Updated ASTFailedTests::testBug39702() to fail more accurately.
Added testSimpleFunctionBody(), testSimpleForLoop() to CompleteParseASTTest.java. Added testSimpleFunctionBody(), testSimpleForLoop() to CompleteParseASTTest.java.

View file

@ -595,6 +595,17 @@ public class CompleteParseASTTest extends CompleteParseBaseTest
IASTFunction f = (IASTFunction) i.next(); IASTFunction f = (IASTFunction) i.next();
assertFalse( i.hasNext() ); assertFalse( i.hasNext() );
assertEquals( callback.getReferences().size(), 5 ); 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 public void testBug42541() throws Exception

View file

@ -1,3 +1,6 @@
2003-09-05 John Camelon
Fixed NPE on nested declarations in code blocks.
2003-09-04 John Camelon 2003-09-04 John Camelon
First pass of parsing function bodies with X-Reference information. First pass of parsing function bodies with X-Reference information.
Updated IASTFactory/ISourceElementRequestor to include IASTCodeScope Updated IASTFactory/ISourceElementRequestor to include IASTCodeScope

View file

@ -1667,7 +1667,15 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
IContainerSymbol newScope = pst.newContainerSymbol(""); IContainerSymbol newScope = pst.newContainerSymbol("");
newScope.setContainingSymbol(symbol); newScope.setContainingSymbol(symbol);
return new ASTCodeScope( newScope ); ASTCodeScope codeScope = new ASTCodeScope( newScope );
try
{
attachSymbolExtension( newScope, codeScope );
}
catch (ExtensionException e)
{
}
return codeScope;
} }
/* (non-Javadoc) /* (non-Javadoc)