nir/worklist: Rework the foreach macro