Occasionally it is useful to visit bad nodes during an AST traversal. For example, in slang_main.cpp::printJson, the ASTSerializer is used to dump the JSON representation of a slang AST whether or not that AST has bad nodes or not. That serializer does not use the generic ASTVisitor infrastructure, instead rewriting similar traversal logic in the member function template ASTSerializer.cpp::ASTSerializer::visit. It may be the case that this traversal could be rewritten to use ASTVisitor now that it supports bad nodes (but the author is not sure).
Since this functionality is introduced by a trailing default template parameter (with default false), this commit changes no functionality, and can only be turned on by explicitly asking for it by specifying true as the value of VisitBad.
Occasionally it is useful to visit bad nodes during an AST traversal. For example, in slang_main.cpp::printJson, the ASTSerializer is used to dump the JSON representation of a slang AST whether or not that AST has bad nodes or not. That serializer does not use the generic ASTVisitor infrastructure, instead rewriting similar traversal logic in the member function template ASTSerializer.cpp::ASTSerializer::visit. It may be the case that this traversal could be rewritten to use ASTVisitor now that it supports bad nodes (but the author is not sure).
Since this functionality is introduced by a trailing default template parameter (with default false), this commit changes no functionality, and can only be turned on by explicitly asking for it by specifying true as the value of VisitBad.