Skip to content

Commit ac00e02

Browse files
committed
JS: Add API::Node.getAValueReachingRhs
1 parent 3b5ff73 commit ac00e02

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,12 @@ module API {
8282
*/
8383
DataFlow::Node getARhs() { Impl::rhs(this, result) }
8484

85+
/**
86+
* Gets a data-flow node that may interprocedurally flow to the right-hand side of a definition
87+
* of the API component represented by this node.
88+
*/
89+
DataFlow::Node getAValueReachingRhs() { result = Impl::trackDefNode(getARhs()) }
90+
8591
/**
8692
* Gets a node representing member `m` of this API component.
8793
*
@@ -825,9 +831,10 @@ module API {
825831
}
826832

827833
/** Gets the API node a parameter of this invocation. */
828-
Node getAParameter() {
829-
result = getParameter(_)
830-
}
834+
Node getAParameter() { result = getParameter(_) }
835+
836+
/** Gets the API node for the last parameter of this invocation. */
837+
Node getLastParameter() { result = getParameter(getNumArgument() - 1) }
831838

832839
/** Gets the API node for the return value of this call. */
833840
Node getReturn() { result.getAnImmediateUse() = this }

0 commit comments

Comments
 (0)