This visitor conflates pushing down "NOT" with extracting the domains. It might be easier to read if you split it into two steps: first, push down NOT as far down as possible, returning a new expression; then, apply the logic for extracting domains.