Currently, there is constant folding logic spread around the whole compiler. The parser does constand folding for .. operators and the code generator does some constant folding in the parameters of numeric for loops.
Perhaps these would belong together in a separate constant folding subroutine?