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