Factor out constant constraint detection into common method