Skip to content

Commit b720bfd

Browse files
erik-kroghasgerf
andcommitted
Apply suggestions from code review
Co-authored-by: Asger F <asgerf@github.com>
1 parent e0b2579 commit b720bfd

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ module API {
2121
*/
2222
class Node extends Impl::TApiNode {
2323
/**
24-
* Gets a data-flow corresponding to a use of the API component represented by this node.
24+
* Gets a data-flow node corresponding to a use of the API component represented by this node.
2525
*
2626
* For example, `require('fs').readFileSync` is a use of the function `readFileSync` from the
2727
* `fs` module, and `require('fs').readFileSync(file)` is a use of the return of that function.
2828
*
29-
* The use is type-tracked, meaning that in `f(obj.foo); function f(x) {};` both `obj.foo` and
30-
* `x` are uses of the `foo` member from `obj`.
29+
* This includes indirect uses found via data flow, meaning that in
30+
* `f(obj.foo); function f(x) {};` both `obj.foo` and `x` are uses of the `foo` member from `obj`.
3131
*
3232
* As another example, in the assignment `exports.plusOne = (x) => x+1` the two references to
3333
* `x` are uses of the first parameter of `plusOne`.
@@ -44,9 +44,10 @@ module API {
4444
* For example, `require('fs').readFileSync` is a reference to the `readFileSync` member from the
4545
* `fs` module.
4646
*
47-
* No local data-flow or type-tracking happens on the result, which means that in
48-
* `const x = fs.readFile` only `fs.readFile` is a reference to the `readFile` member of `fs`,
49-
* neither `x` nor any node that `x` flows to is a reference to this API component.
47+
* Unlike `getAUse()`, this predicate only gets the immediate references, not the indirect uses
48+
* found via data flow. This means that in `const x = fs.readFile` only `fs.readFile` is a reference
49+
* to the `readFile` member of `fs`, neither `x` nor any node that `x` flows to is a reference to
50+
* this API component.
5051
*/
5152
DataFlow::SourceNode getAReference() { Impl::use(this, result) }
5253

@@ -56,7 +57,7 @@ module API {
5657
DataFlow::CallNode getACall() { result = getReturn().getAReference() }
5758

5859
/**
59-
* Gets an instantiation of the function represented by this API component.
60+
* Gets a `new` call to the function represented by this API component.
6061
*/
6162
DataFlow::NewNode getAnInstantiation() { result = getInstance().getAReference() }
6263

0 commit comments

Comments
 (0)