mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-09-10 12:03:16 +02:00
Fixed bug 72220 - [Search] Cannot search when a reference is part of a return statement
This commit is contained in:
parent
173c4dc627
commit
4dcc350233
2 changed files with 19 additions and 1 deletions
|
@ -381,4 +381,22 @@ public class SelectionParseTest extends SelectionParseBaseTest {
|
|||
assertEquals( classSpecifier.getClassKind(), ASTClassKind.UNION );
|
||||
assertEquals( classSpecifier.getName(), "Squaw"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
public void test72220() throws Exception
|
||||
{
|
||||
Writer writer = new StringWriter();
|
||||
writer.write( "const int FOUND_ME = 1;\n" ); //$NON-NLS-1$
|
||||
writer.write( "class Test{\n" ); //$NON-NLS-1$
|
||||
writer.write( "public:\n" ); //$NON-NLS-1$
|
||||
writer.write( "const int findCode() const;\n" ); //$NON-NLS-1$
|
||||
writer.write( "};\n" ); //$NON-NLS-1$
|
||||
writer.write( "const int Test::findCode() const {\n" ); //$NON-NLS-1$
|
||||
writer.write( "return FOUND_ME;\n" ); //$NON-NLS-1$
|
||||
writer.write( "}\n" ); //$NON-NLS-1$
|
||||
String code = writer.toString();
|
||||
int startIndex = code.indexOf( "return ") + "return ".length(); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
IASTNode node = parse( code, startIndex, startIndex + 8 );
|
||||
assertTrue( node instanceof IASTVariable );
|
||||
assertEquals( ((IASTVariable)node).getName(), "FOUND_ME" ); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3576,7 +3576,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
|||
ASTExpression expression = (ASTExpression) reference;
|
||||
final char[] dupleAsCharArray = duple.toCharArray();
|
||||
if( expression.getExpressionKind() == IASTExpression.Kind.ID_EXPRESSION &&
|
||||
CharArrayUtils.equals( expression.getLHSExpression().getIdExpressionCharArray(), dupleAsCharArray ))
|
||||
CharArrayUtils.equals( expression.getIdExpressionCharArray(), dupleAsCharArray ))
|
||||
{
|
||||
try {
|
||||
s = lookupQualifiedName( scopeToSymbol( scope ), duple, null, false );
|
||||
|
|
Loading…
Add table
Reference in a new issue