cxx2js: reorganize code into Visit* callbacks (cleaner)