codegen, tests/closure: pick up env vars from let values