1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00
John Camelon 2004-06-03 00:38:37 +00:00
parent d0c897c1e9
commit 1193d6341a
2 changed files with 22 additions and 6 deletions

View file

@ -1889,6 +1889,25 @@ public class CompleteParseASTTest extends CompleteParseBaseTest
writer.write( "blah3\n"); //$NON-NLS-1$ writer.write( "blah3\n"); //$NON-NLS-1$
writer.write( "};\n"); //$NON-NLS-1$ writer.write( "};\n"); //$NON-NLS-1$
writer.write( "e mye = blah;\n"); //$NON-NLS-1$ writer.write( "e mye = blah;\n"); //$NON-NLS-1$
parse( writer.toString().toString() ); parse( writer.toString() );
}
public void testBug47752() throws Exception
{
Writer writer = new StringWriter();
writer.write( "class BBC\n"); //$NON-NLS-1$
writer.write( "{\n"); //$NON-NLS-1$
writer.write( "int x;\n"); //$NON-NLS-1$
writer.write( "};\n"); //$NON-NLS-1$
writer.write( "void func( BBC bar )\n"); //$NON-NLS-1$
writer.write( "try\n"); //$NON-NLS-1$
writer.write( "{\n"); //$NON-NLS-1$
writer.write( "}\n"); //$NON-NLS-1$
writer.write( "catch ( BBC error )\n"); //$NON-NLS-1$
writer.write( "{\n"); //$NON-NLS-1$
writer.write( " //... error handling code ...\n"); //$NON-NLS-1$
writer.write( "}\n"); //$NON-NLS-1$
parse( writer.toString() );
assertEquals( callback.getReferences().size(), 2 );
} }
} }

View file

@ -1093,10 +1093,7 @@ public abstract class Parser extends ExpressionParser implements IParser
declarator.setHasFunctionBody(true); declarator.setHasFunctionBody(true);
hasFunctionBody = true; hasFunctionBody = true;
} }
if( fromCatchHandler )
return null;
if( hasFunctionTryBlock && ! hasFunctionBody ) if( hasFunctionTryBlock && ! hasFunctionBody )
throw backtrack; throw backtrack;
} }
@ -1122,7 +1119,7 @@ public abstract class Parser extends ExpressionParser implements IParser
} }
if (i.hasNext()) // no need to do this unless we have a declarator if (i.hasNext()) // no need to do this unless we have a declarator
{ {
if (!hasFunctionBody) if (!hasFunctionBody || fromCatchHandler)
{ {
IASTDeclaration declaration = null; IASTDeclaration declaration = null;
while (i.hasNext()) while (i.hasNext())