You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
that would benefit from this. The core problem is that (a + b) + c and c + b + a are represented differently in the model, even though they are effectively the same.
There are some cases where this is not true, like for a != null && a.getValue() == 5 && b == 3, where the a != nullmust be before the other uses, because of short-circuiting and potential side-effects.
The idea is to introduce a class like this
recordBinaryOperatorView(List<CtExpression<?>> operands, BinaryOperatorKindoperator) {
// TODO: Maybe save the original expression internally in the class?
}
That can then be used to group operands, when they match certain criteria and join the remainder.
The class would be constructed from a given CtBinaryOperator. It should ideally support translating a - b + c to a + (-b) + c, which can then be optimized if necessary.
The text was updated successfully, but these errors were encountered:
Description
There are some issues like
PartialEvaluator
#494SomeListing.of(1, 2, 6, ...).contains(c)
in place ofc == 1 || c == 2 || c == 6 ....
#555that would benefit from this. The core problem is that
(a + b) + c
andc + b + a
are represented differently in the model, even though they are effectively the same.There are some cases where this is not true, like for
a != null && a.getValue() == 5 && b == 3
, where thea != null
must be before the other uses, because of short-circuiting and potential side-effects.The idea is to introduce a class like this
That can then be used to group operands, when they match certain criteria and join the remainder.
The class would be constructed from a given
CtBinaryOperator
. It should ideally support translatinga - b + c
toa + (-b) + c
, which can then be optimized if necessary.The text was updated successfully, but these errors were encountered: