mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-26 02:15:31 +02:00
Cosmetics.
This commit is contained in:
parent
1e824bb514
commit
1e3fc49c45
2 changed files with 33 additions and 23 deletions
|
@ -91,6 +91,7 @@ public class Value implements IValue {
|
|||
fResolvedUnknown= resolvedUnknowns;
|
||||
fMap= map;
|
||||
}
|
||||
|
||||
public void nextSeperator() throws UnknownValueException {
|
||||
final char[] expression = fExpression;
|
||||
final int len = expression.length;
|
||||
|
@ -400,7 +401,8 @@ public class Value implements IValue {
|
|||
* Returns a {@code Number} for numerical values or a {@code String}, otherwise.
|
||||
* @throws UnknownValueException
|
||||
*/
|
||||
private static Object evaluate(IASTExpression e, Map<String, Integer> unknownSigs, List<ICPPUnknownBinding> unknowns, int maxdepth) throws UnknownValueException {
|
||||
private static Object evaluate(IASTExpression e, Map<String, Integer> unknownSigs,
|
||||
List<ICPPUnknownBinding> unknowns, int maxdepth) throws UnknownValueException {
|
||||
if (maxdepth < 0 || e == null)
|
||||
throw UNKNOWN_EX;
|
||||
|
||||
|
@ -433,7 +435,8 @@ public class Value implements IValue {
|
|||
final IASTExpression pe = cexpr.getPositiveResultExpression();
|
||||
Object po= pe == null ? o : evaluate(pe, unknownSigs, unknowns, maxdepth);
|
||||
Object neg= evaluate(cexpr.getNegativeResultExpression(), unknownSigs, unknowns, maxdepth);
|
||||
return "" + CONDITIONAL_CHAR + SEPARATOR + o.toString() + SEPARATOR + po.toString() + SEPARATOR + neg.toString(); //$NON-NLS-1$
|
||||
return "" + CONDITIONAL_CHAR + SEPARATOR + o.toString() + SEPARATOR + po.toString() + //$NON-NLS-1$
|
||||
SEPARATOR + neg.toString();
|
||||
}
|
||||
if (e instanceof IASTIdExpression) {
|
||||
IBinding b= ((IASTIdExpression) e).getName().resolvePreBinding();
|
||||
|
@ -483,7 +486,8 @@ public class Value implements IValue {
|
|||
/**
|
||||
* Extract a value off a binding.
|
||||
*/
|
||||
private static Object evaluateBinding(IBinding b, Map<String, Integer> unknownSigs, List<ICPPUnknownBinding> unknowns, int maxdepth) throws UnknownValueException {
|
||||
private static Object evaluateBinding(IBinding b, Map<String, Integer> unknownSigs,
|
||||
List<ICPPUnknownBinding> unknowns, int maxdepth) throws UnknownValueException {
|
||||
if (b instanceof IType) {
|
||||
throw UNKNOWN_EX;
|
||||
}
|
||||
|
@ -510,7 +514,8 @@ public class Value implements IValue {
|
|||
throw UNKNOWN_EX;
|
||||
}
|
||||
|
||||
private static Object createReference(ICPPUnknownBinding unknown, Map<String, Integer> unknownSigs, List<ICPPUnknownBinding> unknowns) {
|
||||
private static Object createReference(ICPPUnknownBinding unknown,
|
||||
Map<String, Integer> unknownSigs, List<ICPPUnknownBinding> unknowns) {
|
||||
String sig= getSignatureForUnknown(unknown);
|
||||
Integer idx= unknownSigs.get(sig);
|
||||
if (idx == null) {
|
||||
|
@ -521,7 +526,8 @@ public class Value implements IValue {
|
|||
return "" + REFERENCE_CHAR + idx.toString(); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
private static Object evaluateValue(IValue cv, Map<String, Integer> unknownSigs, List<ICPPUnknownBinding> unknowns) throws UnknownValueException {
|
||||
private static Object evaluateValue(IValue cv, Map<String, Integer> unknownSigs,
|
||||
List<ICPPUnknownBinding> unknowns) throws UnknownValueException {
|
||||
if (cv == Value.UNKNOWN)
|
||||
throw UNKNOWN_EX;
|
||||
|
||||
|
@ -564,7 +570,9 @@ public class Value implements IValue {
|
|||
return buf.toString();
|
||||
}
|
||||
|
||||
private static Object evaluateUnaryExpression(IASTUnaryExpression ue, Map<String, Integer> unknownSigs, List<ICPPUnknownBinding> unknowns, int maxdepth) throws UnknownValueException {
|
||||
private static Object evaluateUnaryExpression(IASTUnaryExpression ue,
|
||||
Map<String, Integer> unknownSigs, List<ICPPUnknownBinding> unknowns, int maxdepth)
|
||||
throws UnknownValueException {
|
||||
final int unaryOp= ue.getOperator();
|
||||
|
||||
if (unaryOp == IASTUnaryExpression.op_sizeof) {
|
||||
|
@ -626,7 +634,8 @@ public class Value implements IValue {
|
|||
}
|
||||
|
||||
private static Object evaluateBinaryExpression(IASTBinaryExpression be,
|
||||
Map<String, Integer> unknownSigs, List<ICPPUnknownBinding> unknowns, int maxdepth) throws UnknownValueException {
|
||||
Map<String, Integer> unknownSigs, List<ICPPUnknownBinding> unknowns, int maxdepth)
|
||||
throws UnknownValueException {
|
||||
final Object o1= evaluate(be.getOperand1(), unknownSigs, unknowns, maxdepth);
|
||||
final Object o2= evaluate(be.getOperand2(), unknownSigs, unknowns, maxdepth);
|
||||
|
||||
|
@ -634,7 +643,8 @@ public class Value implements IValue {
|
|||
return combineBinary(op, o1, o2);
|
||||
}
|
||||
|
||||
private static Object combineBinary(final int op, final Object o1, final Object o2) throws UnknownValueException {
|
||||
private static Object combineBinary(final int op, final Object o1, final Object o2)
|
||||
throws UnknownValueException {
|
||||
if (o1 instanceof Number && o2 instanceof Number) {
|
||||
long v1= ((Number) o1).longValue();
|
||||
long v2= ((Number) o2).longValue();
|
||||
|
@ -721,7 +731,8 @@ public class Value implements IValue {
|
|||
return "" + BINARY_OP_CHAR + op + SEPARATOR + o1.toString() + SEPARATOR + o2.toString(); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
public static IValue reevaluate(IValue val, int packOffset, IBinding[] resolvedUnknowns, ICPPTemplateParameterMap map, int maxdepth) {
|
||||
public static IValue reevaluate(IValue val, int packOffset, IBinding[] resolvedUnknowns,
|
||||
ICPPTemplateParameterMap map, int maxdepth) {
|
||||
try {
|
||||
Map<String, Integer> unknownSigs= new HashMap<String, Integer>();
|
||||
List<ICPPUnknownBinding> unknown= new ArrayList<ICPPUnknownBinding>();
|
||||
|
@ -783,7 +794,8 @@ public class Value implements IValue {
|
|||
}
|
||||
return po;
|
||||
}
|
||||
return "" + CONDITIONAL_CHAR + SEPARATOR + cond.toString() + SEPARATOR + po.toString() + SEPARATOR + neg.toString(); //$NON-NLS-1$
|
||||
return "" + CONDITIONAL_CHAR + SEPARATOR + cond.toString() + SEPARATOR + //$NON-NLS-1$
|
||||
po.toString() + SEPARATOR + neg.toString();
|
||||
case REFERENCE_CHAR:
|
||||
int num= parseNonNegative(buf, idx + 1);
|
||||
final IBinding[] resolvedUnknowns= reeval.fResolvedUnknown;
|
||||
|
|
|
@ -19,7 +19,6 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
|||
|
||||
/**
|
||||
* @author Emanuel Graf IFS
|
||||
*
|
||||
*/
|
||||
public class OffsetHelper {
|
||||
|
||||
|
@ -35,7 +34,8 @@ public class OffsetHelper {
|
|||
} else {
|
||||
offset = location.asFileLocation().getNodeOffset();
|
||||
}
|
||||
if(offset < nodeStart) nodeStart = offset;
|
||||
if (offset < nodeStart)
|
||||
nodeStart = offset;
|
||||
}
|
||||
} else {
|
||||
nodeStart = node.getFileLocation().getNodeOffset();
|
||||
|
@ -62,7 +62,6 @@ public class OffsetHelper {
|
|||
}
|
||||
} else {
|
||||
IASTFileLocation loc = node.getFileLocation();
|
||||
|
||||
fileOffset = loc.getNodeOffset();
|
||||
length = loc.getNodeLength();
|
||||
}
|
||||
|
@ -75,7 +74,7 @@ public class OffsetHelper {
|
|||
}
|
||||
|
||||
public static int getLengthIncludingComment(IASTNode node) {
|
||||
return OffsetHelper.getEndOffsetIncludingComments(node) - OffsetHelper.getOffsetIncludingComment(node);
|
||||
return getEndOffsetIncludingComments(node) - getOffsetIncludingComment(node);
|
||||
}
|
||||
|
||||
public static int getNodeOffset(ASTNode node) {
|
||||
|
@ -93,5 +92,4 @@ public class OffsetHelper {
|
|||
public static int getEndingLineNumber(IASTNode node) {
|
||||
return node.getFileLocation().getEndingLineNumber();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue