generators: add pass for generators - and rough cut of how it should work, untested