How to use visitors correctly? #1841
Unanswered
GoogleFeud
asked this question in
Q&A
Replies: 2 comments 2 replies
-
I figured it out! Turns out all I needed is an object which implements the |
Beta Was this translation helpful? Give feedback.
1 reply
-
Ah, I just realised that visitors do not in fact "visit" AST nodes as they get created, but afterwards. Is there any way to visit nodes as they are being parsed? The reason I need this is because I need to get the comments above the a specific node, and I think collecting comments along with nodes would be better than guessing based on the position of the comments and nodes. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello! I need to use the swc parser for a project, and I need to traverse the AST as it's getting created, I think visitors are exactly what I need, but I am not exactly sure how to use them. I already have a struct which implements the
Visit
trait, but I am not sure how to tell the parser to use it! I've been searching the docs for a while and I'm not able to find anything!Beta Was this translation helpful? Give feedback.
All reactions