Fix description and improve predicate name of VarWrite.

This commit is contained in:
Chris Smowton
2023-10-24 12:59:57 +01:00
committed by GitHub
parent ede17585a6
commit 011666b48c
2 changed files with 6 additions and 3 deletions

View File

@@ -1850,7 +1850,7 @@ class VarWrite extends VarAccess {
VarWrite() { this.isVarWrite() }
/**
* Gets the right-hand side of the assignment that executes this variable write.
* Gets a source of the assignment that executes this variable write.
*
* For assignments using the `=` operator, the source expression
* is simply the RHS of the assignment.
@@ -1859,7 +1859,10 @@ class VarWrite extends VarAccess {
* (such as (`+=`), both the RHS and the LHS of the compound assignment
* are source expressions of the assignment.
*/
Expr getRhs() { exists(Assignment e | e.getDest() = this and e.getSource() = result) }
Expr getASource() { exists(Assignment e | e.getDest() = this and e.getSource() = result) }
/** DEPRECATED: (Inaccurately-named) alias for `getASource` */
deprecated Expr getRhs() { result = this.getASource() }
}
/** DEPRECATED: Alias for `VarWrite`. */

View File

@@ -333,7 +333,7 @@ predicate interpretInputSpecific(string c, InterpretNode mid, InterpretNode n) {
exists(FieldWrite fw |
c = "" and
fw.getField() = mid.asElement() and
n.asNode().asExpr() = fw.getRhs()
n.asNode().asExpr() = fw.getASource()
)
}