mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-24 09:25:31 +02:00
Patch by Devin Steffler
Fixed 72710 [Search] Field Reference incorrectly reported as variable ref
This commit is contained in:
parent
e98111fb62
commit
6830aea7d7
2 changed files with 22 additions and 0 deletions
|
@ -498,5 +498,23 @@ public class SelectionParseTest extends SelectionParseBaseTest {
|
|||
assertTrue( node instanceof IASTClassSpecifier );
|
||||
assertEquals( ((IASTClassSpecifier)node).getName(), "AAA" ); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
public void testBug72710() throws Exception
|
||||
{
|
||||
Writer writer = new StringWriter();
|
||||
writer.write( "class Card{\n" ); //$NON-NLS-1$
|
||||
writer.write( " Card( int rank );\n" ); //$NON-NLS-1$
|
||||
writer.write( " int rank;\n" ); //$NON-NLS-1$
|
||||
writer.write( "};\n" ); //$NON-NLS-1$
|
||||
writer.write( "Card::Card( int rank ) {\n" ); //$NON-NLS-1$
|
||||
writer.write( "this->rank = rank;\n" ); //$NON-NLS-1$
|
||||
writer.write( "}\n" ); //$NON-NLS-1$
|
||||
String code = writer.toString();
|
||||
int index = code.indexOf( "this->rank") + 6; //$NON-NLS-1$
|
||||
IASTNode node = parse( code, index, index + 4 );
|
||||
assertTrue( node instanceof IASTField );
|
||||
IASTField rank = (IASTField) node;
|
||||
assertEquals( rank.getName(), "rank"); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -82,6 +82,10 @@ public abstract class AbstractToken implements IToken, ITokenDuple {
|
|||
return false;
|
||||
if( !CharArrayUtils.equals( ((IToken)other).getCharImage(), getCharImage() ) )
|
||||
return false;
|
||||
if( getOffset() != ((IToken)other).getOffset() )
|
||||
return false;
|
||||
if( getEndOffset() != ((IToken)other).getEndOffset() )
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue