Use each_with_object() in code gen. ftw