Clean up generator checks for filtering on target types
Several code paths duplicate the same target type checks over and over because there is a semantic meaning behind that particular check. Factor out two of these checks into dedicated helper methods with names reflecting the underlying semantic meaning. While at it, polish a few other target type checks I noticed while performing this sweep.