Nodes and their locations: Implicit nodes #1405
konradweiss
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
A node in the CPG graph gets the location of a
rawNode
handed over by some parser. However, not all nodes we create have arawNode
in the representation of the original parser AST, e.g.,Block
orKeyValueExpression
in Python. Currently, we can hand over a differentrawNode
e.g., the parent or omit it entirely, . The first results in having the code and location of the different nodes, and the second results in nolocation
orcode
bring set in the final CPG node.Problem: This can result in confusing representations, e.g., a block also has code and location spanning the function header.
Proposed Solution:
rawNode
is specified, either as a regular AST parser node for the CPG Node or replacement: Nothing changesrawNode
is specified and the CPG Node has AST Children, the location and code are extracted from the AST children, spanning the code and location of the children.Beta Was this translation helpful? Give feedback.
All reactions