Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Correct presentation of the full names of variables that contain pointers

Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.core/ChangeLog,v
retrieving revision 1.199
diff -u -r1.199 ChangeLog
--- ChangeLog 6 Jun 2003 19:27:17 -0000 1.199
+++ ChangeLog 6 Jun 2003 19:54:28 -0000
@@ -1,4 +1,8 @@
 2003-06-06 Mikhail Khodjaiants
+ Correct presentation of the full names of variables that contain pointers.
+ * CVariable.java
+
+2003-06-06 Mikhail Khodjaiants
  Changed the implementation of the'getName' method of CVariable to return
  the actual names of array members.
  * CArrayPartition.java
Index: src/org/eclipse/cdt/debug/internal/core/model/CVariable.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CVariable.java,v
retrieving revision 1.31
diff -u -r1.31 CVariable.java
--- src/org/eclipse/cdt/debug/internal/core/model/CVariable.java 6 Jun 2003 19:27:17 -0000 1.31
+++ src/org/eclipse/cdt/debug/internal/core/model/CVariable.java 6 Jun 2003 19:54:29 -0000
@@ -358,6 +358,7 @@
   if ( fName == null )
   {
    String cdiName = ( getOriginalCDIVariable() != null ) ? getOriginalCDIVariable().getName() : null;
+   fName = cdiName;
    if ( cdiName != null && getParent() instanceof ICValue )
    {
     CVariable parent = getParentVariable();
@@ -370,10 +371,6 @@
      fName = parent.getName() + '[' + cdiName + ']';
     }
    }
-   else
-   {
-    fName = cdiName;
-   }
   }
   return fName;
  }
@@ -796,8 +793,27 @@
   {
    sb.insert( 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( ')' );
   }
   return sb.toString();

Back to the top