mirror of
https://github.com/github/codeql.git
synced 2026-05-05 21:55:19 +02:00
JS: Use defSourceNode from getRhsNode
This commit is contained in:
@@ -527,20 +527,7 @@ class SsaExplicitDefinition extends SsaDefinition, TExplicitDef {
|
||||
* if any.
|
||||
*/
|
||||
DataFlow::Node getRhsNode() {
|
||||
exists(VarDef def | def = getDef() |
|
||||
result = def.getSource().flow()
|
||||
or
|
||||
exists(VarRef ref |
|
||||
ref = getSourceVariable().getAReference() and
|
||||
def.getTarget().(BindingPattern).getABindingVarRef() = ref and
|
||||
result = DataFlow::patternPropRead(ref)
|
||||
)
|
||||
or
|
||||
result = DataFlow::parameterNode(def)
|
||||
or
|
||||
// Handle class, function, namespace, and enum declaration statement
|
||||
result.getAstNode() = def.(Stmt)
|
||||
)
|
||||
result = DataFlow::defSourceNode(getDef(), getSourceVariable())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1318,10 +1318,12 @@ module DataFlow {
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL. DO NOT USE.
|
||||
*
|
||||
* Gets the data flow node representing the source of the definition of `v` at `def`,
|
||||
* if any.
|
||||
*/
|
||||
private Node defSourceNode(VarDef def, SsaSourceVariable v) {
|
||||
Node defSourceNode(VarDef def, SsaSourceVariable v) {
|
||||
exists(BindingPattern lhs, VarRef r |
|
||||
lhs = def.getTarget() and r = lhs.getABindingVarRef() and r.getVariable() = v
|
||||
|
|
||||
|
||||
Reference in New Issue
Block a user