Add optimize methods for UnaExp and BinExp
Add const checking methods for UnaExp and BinExp
[refactor] Use const checking method for UnaExp and BinExp

Using a method for the const checking makes the code a bit easier to
read, as well as moves the const check implementation to a single piece
of code.
Unify optimize methods ...
Unify optimize methods ...
Unify optimize methods ...
Unify optimize methods ...
Unify optimize methods ...
Unify optimize methods ...
Unify optimize methods ... multiple