Implemented constant folding for integral expressions

{nit} the whitespace in this whole method seems weird