You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Esprima can include source code comments in its AST. For example, when parsing this code with the comment:true flag:
functionf(){/*hello*///world}
Esprima returns this AST:
{"type": "Program","body": [/* omitted to save space */],"comments": [{"type": "Block","value": "hello"},{"type": "Line","value": "world"},]}
It would be helpful for estraverse to visit the comment nodes. Currently it does not.
(I believe comments are an Esprima extension to the Spidermonkey API, so this may be non-standard. But it would be really useful for downstream projects. For example, I'm currently trying to write a linting rule for ESLint that deals with comments, and fixing this issue is a prerequisite.)
The text was updated successfully, but these errors were encountered:
mamacdon
added a commit
to mamacdon/estraverse
that referenced
this issue
Jul 25, 2013
Just use escodegen's attachComments and access the leadingComments member of the nodes as you visit them in a regular traversal. In your PR (#10), they are treated as regular nodes (not desirable) and just stuck on the end of the traversal (also not desirable).
Esprima can include source code comments in its AST. For example, when parsing this code with the
comment:true
flag:Esprima returns this AST:
It would be helpful for estraverse to visit the comment nodes. Currently it does not.
(I believe comments are an Esprima extension to the Spidermonkey API, so this may be non-standard. But it would be really useful for downstream projects. For example, I'm currently trying to write a linting rule for ESLint that deals with comments, and fixing this issue is a prerequisite.)
The text was updated successfully, but these errors were encountered: