Store compilation environment in functions