Refactoring of the constraint evaluation code gen, using with statements