Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Applied [HEAD] Nested declaration fix for Bogdan

CORE
        Fixed NPE on nested declarations in code blocks. 
 
TESTS
        Updated CompleteParseASTTest::testSimpleForLoop()

JohnC

Index: parser/ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/ChangeLog,v
retrieving revision 1.111
diff -u -r1.111 ChangeLog
--- parser/ChangeLog	5 Sep 2003 13:45:16 -0000	1.111
+++ parser/ChangeLog	5 Sep 2003 14:18:37 -0000
@@ -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
Index: parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java,v
retrieving revision 1.27
diff -u -r1.27 CompleteParseASTFactory.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java	5 Sep 2003 13:45:16 -0000	1.27
+++ parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java	5 Sep 2003 14:18:38 -0000
@@ -1667,7 +1667,15 @@
 		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)
Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/ChangeLog,v
retrieving revision 1.78
diff -u -r1.78 ChangeLog
--- ChangeLog	5 Sep 2003 13:45:11 -0000	1.78
+++ ChangeLog	5 Sep 2003 14:16:38 -0000
@@ -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.
Index: parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java,v
retrieving revision 1.21
diff -u -r1.21 CompleteParseASTTest.java
--- parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java	5 Sep 2003 13:45:11 -0000	1.21
+++ parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java	5 Sep 2003 14:16:39 -0000
@@ -595,6 +595,17 @@
 		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

Back to the top