1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00
John Camelon 2004-05-21 15:01:57 +00:00
parent 22055aad20
commit d595dc0508
2 changed files with 21 additions and 1 deletions

View file

@ -1066,4 +1066,24 @@ public class CompletionParseTest extends CompletionParseBaseTest {
foundStruct = true;
assertTrue( foundStruct );
}
public void testBug62721() throws Exception
{
Writer writer = new StringWriter();
writer.write( "int f() {\n" ); //$NON-NLS-1$
writer.write( "short blah;\n" ); //$NON-NLS-1$
writer.write( "int x = sizeof(bl" ); //$NON-NLS-1$
String code = writer.toString();
IASTCompletionNode node = parse( code, code.indexOf( "of(bl") + 3); //$NON-NLS-1$
assertNotNull( node );
assertEquals( node.getCompletionKind(), CompletionKind.SINGLE_NAME_REFERENCE );
assertNull( node.getCompletionContext() );
IASTNode.LookupKind [] kinds = new IASTNode.LookupKind[1];
kinds[0] = IASTNode.LookupKind.LOCAL_VARIABLES;
IASTNode.ILookupResult result = node.getCompletionScope().lookup( node.getCompletionPrefix(), kinds, null, null );
assertEquals( result.getResultsSize(), 1 );
IASTNode blah = (IASTNode) result.getNodes().next();
assertTrue( blah instanceof IASTVariable );
assertEquals( ((IASTVariable)blah).getName(), "blah" ); //$NON-NLS-1$
}
}

View file

@ -2032,7 +2032,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
try
{
consume(IToken.tLPAREN);
d = typeId(scope, false, CompletionKind.TYPE_REFERENCE);
d = typeId(scope, false, CompletionKind.SINGLE_NAME_REFERENCE);
consume(IToken.tRPAREN);
}
catch (BacktrackException bt)