1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-06 17:26:01 +02:00

Fixed 75338 - [Parser] complete.ASTExceptionSpecification#getTypeIds() yields useless information

This commit is contained in:
John Camelon 2004-10-05 18:16:06 +00:00
parent 95b192460c
commit 5bd3694555
2 changed files with 18 additions and 1 deletions

View file

@ -27,6 +27,7 @@ import org.eclipse.cdt.core.parser.ast.IASTCodeScope;
import org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTEnumerator;
import org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification;
import org.eclipse.cdt.core.parser.ast.IASTField;
import org.eclipse.cdt.core.parser.ast.IASTFunction;
import org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification;
@ -2224,5 +2225,21 @@ public class CompleteParseASTTest extends CompleteParseBaseTest
assertTrue( floatPow.hasFunctionBody() );
}
public void testBug75338() throws Exception
{
Writer writer = new StringWriter();
writer.write( "class Thrown { };\n");
writer.write( "void foo() throw( Thrown );");
Iterator i = (Iterator) parse( writer.toString() ).getDeclarations();
assertTrue( i.next() instanceof IASTAbstractTypeSpecifierDeclaration );
IASTFunction foo = (IASTFunction) i.next();
assertFalse( i.hasNext() );
IASTExceptionSpecification exSpec = foo.getExceptionSpec();
assertNotNull( exSpec );
Iterator typeIds = exSpec.getTypeIds();
assertTrue( typeIds.hasNext() );
IASTTypeId typeId = (IASTTypeId) typeIds.next();
assertEquals( typeId.getTypeOrClassName(), "Thrown" );
}
}

View file

@ -1881,7 +1881,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
{
int size = typeIds.size();
for( int i = 0; i < size; i++ )
newTypeIds.add( ((IASTTypeId)typeIds.get(i)).toString() );
newTypeIds.add( typeIds.get(i) );
}
return new ASTExceptionSpecification( newTypeIds );