mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Changed the implementation of the'getName' method of CVariable to return the actual names of array members.
This commit is contained in:
parent
c3bab5f786
commit
5243e5bd71
4 changed files with 60 additions and 12 deletions
|
@ -1,3 +1,10 @@
|
|||
2003-06-06 Mikhail Khodjaiants
|
||||
Changed the implementation of the'getName' method of CVariable to return
|
||||
the actual names of array members.
|
||||
* CArrayPartition.java
|
||||
* CArrayPartitionValue.java
|
||||
* CVariable.java
|
||||
|
||||
2003-06-05 Mikhail Khodjaiants
|
||||
Core support of infinite values of the floating point types.
|
||||
* ICVariable.java
|
||||
|
|
|
@ -91,7 +91,7 @@ public class CArrayPartition extends CVariable
|
|||
{
|
||||
if ( fArrayPartitionValue == null )
|
||||
{
|
||||
fArrayPartitionValue = new CArrayPartitionValue( (CDebugTarget)getDebugTarget(), fCDIVariables, getStart(), getEnd() );
|
||||
fArrayPartitionValue = new CArrayPartitionValue( this, fCDIVariables, getStart(), getEnd() );
|
||||
}
|
||||
return fArrayPartitionValue;
|
||||
}
|
||||
|
|
|
@ -30,6 +30,11 @@ public class CArrayPartitionValue extends CDebugElement implements ICValue
|
|||
*/
|
||||
private List fCDIVariables;
|
||||
|
||||
/**
|
||||
* Parent variable.
|
||||
*/
|
||||
private CVariable fParent = null;
|
||||
|
||||
/**
|
||||
* List of child variables.
|
||||
*/
|
||||
|
@ -43,10 +48,11 @@ public class CArrayPartitionValue extends CDebugElement implements ICValue
|
|||
* Constructor for CArrayPartitionValue.
|
||||
* @param target
|
||||
*/
|
||||
public CArrayPartitionValue( CDebugTarget target, List cdiVariables, int start, int end )
|
||||
public CArrayPartitionValue( CVariable parent, List cdiVariables, int start, int end )
|
||||
{
|
||||
super( target );
|
||||
super( (CDebugTarget)parent.getDebugTarget() );
|
||||
fCDIVariables = cdiVariables;
|
||||
fParent = parent;
|
||||
fStart = start;
|
||||
fEnd = end;
|
||||
}
|
||||
|
@ -152,4 +158,9 @@ public class CArrayPartitionValue extends CDebugElement implements ICValue
|
|||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public CVariable getParentVariable()
|
||||
{
|
||||
return fParent;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,6 +68,11 @@ public abstract class CVariable extends CDebugElement
|
|||
*/
|
||||
protected ICValue fValue;
|
||||
|
||||
/**
|
||||
* The name of this variable.
|
||||
*/
|
||||
private String fName = null;
|
||||
|
||||
private Boolean fEditable = null;
|
||||
|
||||
/**
|
||||
|
@ -350,7 +355,27 @@ public abstract class CVariable extends CDebugElement
|
|||
*/
|
||||
public String getName() throws DebugException
|
||||
{
|
||||
return ( getOriginalCDIVariable() != null ) ? getOriginalCDIVariable().getName() : null;
|
||||
if ( fName == null )
|
||||
{
|
||||
String cdiName = ( getOriginalCDIVariable() != null ) ? getOriginalCDIVariable().getName() : null;
|
||||
if ( cdiName != null && getParent() instanceof ICValue )
|
||||
{
|
||||
CVariable parent = getParentVariable();
|
||||
while( parent instanceof CArrayPartition )
|
||||
{
|
||||
parent = parent.getParentVariable();
|
||||
}
|
||||
if ( parent instanceof CVariable && parent.getType() instanceof ICDIArrayType )
|
||||
{
|
||||
fName = parent.getName() + '[' + cdiName + ']';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fName = cdiName;
|
||||
}
|
||||
}
|
||||
return fName;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -758,16 +783,12 @@ public abstract class CVariable extends CDebugElement
|
|||
{
|
||||
LinkedList list = new LinkedList();
|
||||
list.add( this );
|
||||
CVariable var = null;
|
||||
CDebugElement element = getParent();
|
||||
while ( element instanceof CValue )
|
||||
CVariable var = getParentVariable();
|
||||
while( var != null )
|
||||
{
|
||||
var = ((CValue)element).getParentVariable();
|
||||
if ( var == null )
|
||||
break;
|
||||
if ( !( var instanceof CArrayPartition ) && !var.isAccessSpecifier() )
|
||||
if ( !( var.getType() instanceof ICDIArrayType ) && !( var instanceof CArrayPartition ) && !var.isAccessSpecifier() )
|
||||
list.addFirst( var );
|
||||
element = var.getParent();
|
||||
var = var.getParentVariable();
|
||||
}
|
||||
StringBuffer sb = new StringBuffer();
|
||||
CVariable[] vars = (CVariable[])list.toArray( new CVariable[list.size()] );
|
||||
|
@ -786,4 +807,13 @@ public abstract class CVariable extends CDebugElement
|
|||
{
|
||||
return ( "public".equals( getName() ) || "protected".equals( getName() ) || "private".equals( getName() ) );
|
||||
}
|
||||
|
||||
private CVariable getParentVariable() throws DebugException
|
||||
{
|
||||
if ( getParent() instanceof CValue )
|
||||
return ((CValue)getParent()).getParentVariable();
|
||||
if ( getParent() instanceof CArrayPartitionValue )
|
||||
return ((CArrayPartitionValue)getParent()).getParentVariable();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue