Skip to content

[JS] Mapping DataFlow::Node to PrintAstNode #8379

Answered by erik-krogh
Naman-ntc asked this question in Q&A
Discussion options

You must be logged in to vote

I see. Seeing the TJSXAttributesNode and TJSXBodyElementsNode classes, I assumed that PrintAstNode is more complete and handles such cases.

I think of it as a different view of the same data.
The TJSXAttributesNode and the TJSXBodyElementsNode classes just makes sure we have 2 print-nodes for some expressions.
An JSXElement instance (an expression) is represented both by the JSXNodeNode and JSXAttributesNode classes in PrintAst.qll.
And I don't think you want the same thing to show up twice for your use.

Based on your suggestion, I created a custom copy of PrintAST.qll that operates solely on ASTNode and prints ast node type using the getQlClass function.

That sounds like an OK solution.

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@Naman-ntc
Comment options

Comment options

You must be logged in to vote
2 replies
@Naman-ntc
Comment options

@erik-krogh
Comment options

Answer selected by Naman-ntc
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