diff --git a/core/org.eclipse.cdt.core.tests/ChangeLog b/core/org.eclipse.cdt.core.tests/ChangeLog index 08ec538e5a1..5797c17151c 100644 --- a/core/org.eclipse.cdt.core.tests/ChangeLog +++ b/core/org.eclipse.cdt.core.tests/ChangeLog @@ -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. diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java index bd1f1b39984..85408f7ee2f 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/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 diff --git a/core/org.eclipse.cdt.core/parser/ChangeLog b/core/org.eclipse.cdt.core/parser/ChangeLog index 6357a3d7d14..7130028edd7 100644 --- a/core/org.eclipse.cdt.core/parser/ChangeLog +++ b/core/org.eclipse.cdt.core/parser/ChangeLog @@ -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 diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java index a37a97feec3..386e1ff98d3 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java @@ -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)