Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/SelectionParseTest.java18
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/token/AbstractToken.java4
2 files changed, 22 insertions, 0 deletions
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/SelectionParseTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/SelectionParseTest.java
index b4aad1f0213..b9113cec971 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/SelectionParseTest.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/SelectionParseTest.java
@@ -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$
+ }
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/token/AbstractToken.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/token/AbstractToken.java
index f9c0d988393..ee2de93bef1 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/token/AbstractToken.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/token/AbstractToken.java
@@ -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;
}

Back to the top