Store keys alongside values in identity dict
Lookup init type when generating code for class definition

This also fixes a scoping issue: arguments to init should not be
in scope of class definition body