Add generics to NodeVisitor (enables optimization passes)