mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02:00
Fixed 75338 - [Parser] complete.ASTExceptionSpecification#getTypeIds() yields useless information
This commit is contained in:
parent
95b192460c
commit
5bd3694555
2 changed files with 18 additions and 1 deletions
|
@ -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.IASTElaboratedTypeSpecifier;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier;
|
import org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTEnumerator;
|
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.IASTField;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTFunction;
|
import org.eclipse.cdt.core.parser.ast.IASTFunction;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification;
|
import org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification;
|
||||||
|
@ -2224,5 +2225,21 @@ public class CompleteParseASTTest extends CompleteParseBaseTest
|
||||||
assertTrue( floatPow.hasFunctionBody() );
|
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" );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1881,7 +1881,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
||||||
{
|
{
|
||||||
int size = typeIds.size();
|
int size = typeIds.size();
|
||||||
for( int i = 0; i < size; i++ )
|
for( int i = 0; i < size; i++ )
|
||||||
newTypeIds.add( ((IASTTypeId)typeIds.get(i)).toString() );
|
newTypeIds.add( typeIds.get(i) );
|
||||||
|
|
||||||
}
|
}
|
||||||
return new ASTExceptionSpecification( newTypeIds );
|
return new ASTExceptionSpecification( newTypeIds );
|
||||||
|
|
Loading…
Add table
Reference in a new issue