Added recognition logic of generator functions.

Signed-off-by: Jakob Brandsborg Ehmsen <jakobehmsen.github@gmail.com>