add Context.onAfterGenerate to register macros that run after code generation