Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What's the difference between TraverseForStmt and VisitForStmt? #19

Open
zhou-shulin opened this issue Sep 1, 2021 · 1 comment
Open

Comments

@zhou-shulin
Copy link

Hi,

I am learning the excellent tutorial, and I have some confusion in UnusedForLoopVar Tool. In UnusedForLoopVar especially in the implementation of RecursiveASTVisitor, the TraverseForStmt() is used to visit the ForStmt in AST, rather than VisitForStmt(). What's the difference between these two methods on visiting the AST nodes? Why would UnusedForLoopVar use TraverseForStmt() rather than VisitForStmt()?

Thank you very much!!!

@banach-space
Copy link
Owner

Hello @zhou-shulin , thank you for stopping by :) Apologies for the delay, I was away for a couple of weeks.

The difference between these methods is documented here. It's a bit dense, so let me know if it's still unclear and I will try to clarify.

Best,
-Andrzej

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants