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

Bug 306555: Need extra parens for Cast To Type

This commit is contained in:
Marc Khouzam 2010-05-11 20:21:36 +00:00
parent 8a3597ae0a
commit a9b247a3f2

View file

@ -29,7 +29,6 @@ import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
import org.eclipse.cdt.dsf.datamodel.DMContexts;
import org.eclipse.cdt.dsf.debug.service.IExpressions;
import org.eclipse.cdt.dsf.debug.service.IExpressions.IExpressionDMContext;
import org.eclipse.cdt.dsf.debug.service.IExpressions2.CastInfo;
import org.eclipse.cdt.dsf.debug.service.IExpressions2.ICastedExpressionDMContext;
import org.eclipse.cdt.dsf.debug.service.IFormattedValues;
import org.eclipse.cdt.dsf.debug.service.IFormattedValues.FormattedValueDMContext;
@ -650,15 +649,13 @@ public class MIVariableManager implements ICommandControl {
ExpressionInfo[] childrenOfArray = new ExpressionInfo[getNumChildrenHint()];
String exprName = exprDmc.getExpression();
int castingLength = 0;
int castingIndex = 0;
// in case of casts, need to resolve that before dereferencing, to be safe
if (exprDmc instanceof ICastedExpressionDMContext) {
CastInfo castInfo = ((ICastedExpressionDMContext)exprDmc).getCastInfo();
castingLength = castInfo.getArrayCount();
castingIndex = castInfo.getArrayStartIndex();
if (castingLength > 0)
// When casting, if we are dealing with a resulting array, we should surround
// it with parenthesis before we subscript it.
exprName = '(' + exprName + ')';
castingIndex = ((ICastedExpressionDMContext)exprDmc).getCastInfo().getArrayStartIndex();
}
for (int i= 0; i < childrenOfArray.length; i++) {
String fullExpr = exprName + "[" + i + "]";//$NON-NLS-1$//$NON-NLS-2$