Skip to content

Commit

Permalink
Correct the FILE node documentation to the reflect status quo. (#1757)
Browse files Browse the repository at this point in the history
  • Loading branch information
ml86 authored Feb 22, 2024
1 parent f83f193 commit d825dfd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,19 +98,11 @@ languages like Javascript, it is common that we may know the (short-) name
was generated. File nodes serve as indices, that is, they allow looking up all
elements of the code by file.
For each file, the graph MUST contain exactly one File node.
For each file, the graph CAN contain exactly one File node, if not File nodes
are created as indicated by `FILENAME` property of other nodes.
As file nodes are root nodes of abstract syntax tress, they are AstNodes and
their order field is set to 0. This is because they have no sibling nodes,
not because they are the first node of the AST.
Each CPG MUST contain a special file node with name set to
`<unknown>`. This node is a placeholder used in cases where a file cannot be
determined at compile time. As an example, consider external library functions.
As their code is not available on CPG construction, the file name is unknown.
File nodes MUST NOT be created by the language frontend. Instead, the language
frontend is assumed to fill out the `FILENAME` field wherever possible,
allowing File nodes to be created automatically upon first loading the CPG. */
not because they are the first node of the AST. */
public static final String FILE = "FILE";

/** Finding nodes may be used to store analysis results in the graph
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,19 +97,11 @@ object FileSystem extends SchemaBase {
|was generated. File nodes serve as indices, that is, they allow looking up all
|elements of the code by file.
|
|For each file, the graph MUST contain exactly one File node.
|For each file, the graph CAN contain exactly one File node, if not File nodes
|are created as indicated by `FILENAME` property of other nodes.
|As file nodes are root nodes of abstract syntax tress, they are AstNodes and
|their order field is set to 0. This is because they have no sibling nodes,
|not because they are the first node of the AST.
|
|Each CPG MUST contain a special file node with name set to
|`<unknown>`. This node is a placeholder used in cases where a file cannot be
|determined at compile time. As an example, consider external library functions.
|As their code is not available on CPG construction, the file name is unknown.
|
|File nodes MUST NOT be created by the language frontend. Instead, the language
|frontend is assumed to fill out the `FILENAME` field wherever possible,
|allowing File nodes to be created automatically upon first loading the CPG.
|""".stripMargin
)
.protoId(38)
Expand Down

0 comments on commit d825dfd

Please sign in to comment.