1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Correct presentation of the full names of variables that contain pointers.

This commit is contained in:
Mikhail Khodjaiants 2003-06-06 19:55:13 +00:00
parent 5243e5bd71
commit 08ab887f65
2 changed files with 26 additions and 6 deletions

View file

@ -1,3 +1,7 @@
2003-06-06 Mikhail Khodjaiants
Correct presentation of the full names of variables that contain pointers.
* CVariable.java
2003-06-06 Mikhail Khodjaiants 2003-06-06 Mikhail Khodjaiants
Changed the implementation of the'getName' method of CVariable to return Changed the implementation of the'getName' method of CVariable to return
the actual names of array members. the actual names of array members.

View file

@ -358,6 +358,7 @@ public abstract class CVariable extends CDebugElement
if ( fName == null ) if ( fName == null )
{ {
String cdiName = ( getOriginalCDIVariable() != null ) ? getOriginalCDIVariable().getName() : null; String cdiName = ( getOriginalCDIVariable() != null ) ? getOriginalCDIVariable().getName() : null;
fName = cdiName;
if ( cdiName != null && getParent() instanceof ICValue ) if ( cdiName != null && getParent() instanceof ICValue )
{ {
CVariable parent = getParentVariable(); CVariable parent = getParentVariable();
@ -370,10 +371,6 @@ public abstract class CVariable extends CDebugElement
fName = parent.getName() + '[' + cdiName + ']'; fName = parent.getName() + '[' + cdiName + ']';
} }
} }
else
{
fName = cdiName;
}
} }
return fName; return fName;
} }
@ -796,8 +793,27 @@ public abstract class CVariable extends CDebugElement
{ {
sb.insert( 0, '(' ); sb.insert( 0, '(' );
if ( i > 0 ) if ( i > 0 )
sb.append( ( vars[i - 1].isPointer() ) ? "->" : "." ); {
sb.append( vars[i].getName() ); if ( vars[i - 1].isPointer() )
{
if ( vars[i].getName().charAt( 0 ) == '*' && vars[i-1].getName().equals( vars[i].getName().substring( 1 ) ) )
{
sb.insert( 0, '*' );
}
else
{
sb.append( "->" );
sb.append( vars[i].getName() );
}
}
else
{
sb.append( '.' );
sb.append( vars[i].getName() );
}
}
else
sb.append( vars[i].getName() );
sb.append( ')' ); sb.append( ')' );
} }
return sb.toString(); return sb.toString();