Skip to content

Commit deae925

Browse files
committed
add convenience method to API graphs
1 parent 60c310d commit deae925

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

javascript/ql/src/semmle/javascript/ApiGraphs.qll

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,17 @@ module API {
3535
)
3636
}
3737

38+
/**
39+
* Gets a source-node corresponding to a use of the API component represented by this node.
40+
*
41+
* For example, `require('fs').readFileSync` is a use of the function `readFileSync` from the
42+
* `fs` module, and `require('fs').readFileSync(file)` is a use of the result of that function.
43+
*
44+
* As another example, in the assignment `exports.plusOne = (x) => x+1` the two references to
45+
* `x` are uses of the first parameter of `plusOne`.
46+
*/
47+
DataFlow::SourceNode getASourceUse() { Impl::use(this, result) }
48+
3849
/**
3950
* Gets a data-flow node corresponding to the right-hand side of a definition of the API
4051
* component represented by this node.

0 commit comments

Comments
 (0)