Skip to content

Question: How to determine declared function names? #1199

Answered by lahma
sandreas asked this question in Q&A
Discussion options

You must be logged in to vote

You need to go through the AST tree produced by Esprima. Get Script instance from JavaScriptParser's Parse, then walk it recursive. Here's an example of that.

A simpler solution might be just inheriting from AstVisitor and override the VisitFunctionDeclaration, that will be called for every function.

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by sandreas
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1198 on June 19, 2022 06:33.