Lines 316-323
Link Here
|
316 |
if (e instanceof IASTConditionalExpression) { |
316 |
if (e instanceof IASTConditionalExpression) { |
317 |
IASTConditionalExpression cexpr= (IASTConditionalExpression) e; |
317 |
IASTConditionalExpression cexpr= (IASTConditionalExpression) e; |
318 |
Object o= evaluate(cexpr.getLogicalConditionExpression(), unknownSigs, unknowns, maxdepth); |
318 |
Object o= evaluate(cexpr.getLogicalConditionExpression(), unknownSigs, unknowns, maxdepth); |
319 |
if (o instanceof Long) { |
319 |
if (o instanceof Number) { |
320 |
Long v= (Long) o; |
320 |
Number v= (Number) o; |
321 |
if (v.longValue() == 0) { |
321 |
if (v.longValue() == 0) { |
322 |
return evaluate(cexpr.getNegativeResultExpression(), unknownSigs, unknowns, maxdepth); |
322 |
return evaluate(cexpr.getNegativeResultExpression(), unknownSigs, unknowns, maxdepth); |
323 |
} |
323 |
} |
Lines 330-336
Link Here
|
330 |
final IASTExpression pe = cexpr.getPositiveResultExpression(); |
330 |
final IASTExpression pe = cexpr.getPositiveResultExpression(); |
331 |
Object po= pe == null ? o : evaluate(pe, unknownSigs, unknowns, maxdepth); |
331 |
Object po= pe == null ? o : evaluate(pe, unknownSigs, unknowns, maxdepth); |
332 |
Object neg= evaluate(cexpr.getNegativeResultExpression(), unknownSigs, unknowns, maxdepth); |
332 |
Object neg= evaluate(cexpr.getNegativeResultExpression(), unknownSigs, unknowns, maxdepth); |
333 |
return CONDITIONAL_CHAR + SEPARATOR + o.toString() + SEPARATOR + po.toString() + SEPARATOR + neg.toString(); |
333 |
return "" + CONDITIONAL_CHAR + SEPARATOR + o.toString() + SEPARATOR + po.toString() + SEPARATOR + neg.toString(); //$NON-NLS-1$ |
334 |
} |
334 |
} |
335 |
if (e instanceof IASTIdExpression) { |
335 |
if (e instanceof IASTIdExpression) { |
336 |
IBinding b= ((IASTIdExpression) e).getName().resolvePreBinding(); |
336 |
IBinding b= ((IASTIdExpression) e).getName().resolvePreBinding(); |
Lines 462-469
Link Here
|
462 |
return value; |
462 |
return value; |
463 |
} |
463 |
} |
464 |
|
464 |
|
465 |
if (value instanceof Long) { |
465 |
if (value instanceof Number) { |
466 |
long v= (Long) value; |
466 |
long v= ((Number) value).longValue(); |
467 |
switch(unaryOp) { |
467 |
switch(unaryOp) { |
468 |
case IASTUnaryExpression.op_prefixIncr: |
468 |
case IASTUnaryExpression.op_prefixIncr: |
469 |
case IASTUnaryExpression.op_postFixIncr: |
469 |
case IASTUnaryExpression.op_postFixIncr: |
Lines 504-512
Link Here
|
504 |
} |
504 |
} |
505 |
|
505 |
|
506 |
private static Object combineBinary(final int op, final Object o1, final Object o2) throws UnknownValueException { |
506 |
private static Object combineBinary(final int op, final Object o1, final Object o2) throws UnknownValueException { |
507 |
if (o1 instanceof Long && o2 instanceof Long) { |
507 |
if (o1 instanceof Number && o2 instanceof Number) { |
508 |
long v1= (Long) o1; |
508 |
long v1= ((Number) o1).longValue(); |
509 |
long v2= (Long) o2; |
509 |
long v2= ((Number) o2).longValue(); |
510 |
switch(op) { |
510 |
switch(op) { |
511 |
case IASTBinaryExpression.op_multiply: |
511 |
case IASTBinaryExpression.op_multiply: |
512 |
return v1*v2; |
512 |
return v1*v2; |
Lines 601-608
Link Here
|
601 |
if (reeval.pos != reeval.fExpression.length) |
601 |
if (reeval.pos != reeval.fExpression.length) |
602 |
return UNKNOWN; |
602 |
return UNKNOWN; |
603 |
|
603 |
|
604 |
if (obj instanceof Long) |
604 |
if (obj instanceof Number) |
605 |
return create(((Long) obj).longValue()); |
605 |
return create(((Number) obj).longValue()); |
606 |
|
606 |
|
607 |
ICPPUnknownBinding[] ua; |
607 |
ICPPUnknownBinding[] ua; |
608 |
if (unknown.isEmpty()) { |
608 |
if (unknown.isEmpty()) { |
Lines 645-652
Link Here
|
645 |
Object cond= reevaluate(reeval, maxdepth); |
645 |
Object cond= reevaluate(reeval, maxdepth); |
646 |
Object po= reevaluate(reeval, maxdepth); |
646 |
Object po= reevaluate(reeval, maxdepth); |
647 |
Object neg= reevaluate(reeval, maxdepth); |
647 |
Object neg= reevaluate(reeval, maxdepth); |
648 |
if (cond instanceof Long) { |
648 |
if (cond instanceof Number) { |
649 |
Long v= (Long) cond; |
649 |
Number v= (Number) cond; |
650 |
if (v.longValue() == 0) { |
650 |
if (v.longValue() == 0) { |
651 |
return neg; |
651 |
return neg; |
652 |
} |
652 |
} |