Separate the generic coroutine implementation from generator.