Keeping track of scope correctly during code generation.