Skip to content

Commit 37a3085

Browse files
author
Max Schaefer
authored
Merge pull request #993 from asger-semmle/getacallee
JS: document new behavior of overriding InvokeNode.getACallee()
2 parents d857f52 + eaf3f52 commit 37a3085

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

change-notes/1.20/analysis-javascript.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,5 @@
5858
* `DataFlow::SourceNode` is no longer an abstract class; to add new source nodes, extend `DataFlow::SourceNode::Range` instead.
5959
* Subclasses of `DataFlow::PropRead` are no longer automatically made source nodes; you now need to additionally define a corresponding subclass of `DataFlow::SourceNode::Range` to achieve this.
6060
* The deprecated libraries `semmle.javascript.DataFlow` and `semmle.javascript.dataflow.CallGraph` have been removed; they are both superseded by `semmle.javascript.dataflow.DataFlow`.
61+
* Overriding `DataFlow::InvokeNode.getACallee()` no longer affects the call graph seen by the interprocedural data flow libraries. To do this, the 1-argument version `getACallee(int imprecision)` can be overridden instead.
6162
* The predicate `DataFlow::returnedPropWrite` was intended for internal use only and is no longer available.

javascript/ql/src/semmle/javascript/dataflow/Nodes.qll

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,12 @@ class InvokeNode extends DataFlow::SourceNode {
8383
/** Gets an abstract value representing possible callees of this call site. */
8484
AbstractValue getACalleeValue() { result = InvokeNode::getACalleeValue(this) }
8585

86-
/** Gets a potential callee of this call site. */
86+
/**
87+
* Gets a potential callee of this call site.
88+
*
89+
* To alter the call graph as seen by the interprocedural data flow libraries, override
90+
* the `getACallee(int imprecision)` predicate instead.
91+
*/
8792
Function getACallee() { result = InvokeNode::getACallee(this) }
8893

8994
/**
@@ -93,6 +98,9 @@ class InvokeNode extends DataFlow::SourceNode {
9398
*
9499
* Callees with imprecision zero, in particular, have either been derived without
95100
* considering global variables, or are calls to a global variable within the same file.
101+
*
102+
* This predicate can be overridden to alter the call graph used by the interprocedural
103+
* data flow libraries.
96104
*/
97105
Function getACallee(int imprecision) { result = InvokeNode::getACallee(this, imprecision) }
98106

0 commit comments

Comments
 (0)