Module context

Do not review yet, I'm expecting failures.
I think maybe this field should be in the data structures somewhere, rather than making this visitor stateful.