Skip to content

Commit a1394c3

Browse files
committed
more consistent naming of predicates
1 parent 2974c49 commit a1394c3

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

javascript/ql/src/Declarations/DeadStoreOfProperty.ql

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,22 @@ predicate maybeAccessesProperty(Expr e, string name) {
9898
*/
9999
predicate isDeadAssignment(string name, DataFlow::PropWrite assign1, DataFlow::PropWrite assign2) {
100100
(
101-
assign2.getWriteNode() = getANodeWithNoPropAccessBetweenInsideBlock(name, assign1) and
102-
postDominatedPropWrite(name, assign1, assign2, true)
103-
or
104-
noPropAccessBetweenGlobal(name, assign1, assign2)
101+
noPropAccessBetweenInsideBasicBlock(name, assign1, assign2) or
102+
noPropAccessBetweenAcrossBasicBlocks(name, assign1, assign2)
105103
) and
106104
not isDOMProperty(name)
107105
}
108106

107+
/**
108+
* Holds if `assign1` and `assign2` are in the same basicblock and both assign property `name`, and the assigned property is not accessed between the two assignments.
109+
*/
110+
predicate noPropAccessBetweenInsideBasicBlock(
111+
string name, DataFlow::PropWrite assign1, DataFlow::PropWrite assign2
112+
) {
113+
assign2.getWriteNode() = getANodeWithNoPropAccessBetweenInsideBlock(name, assign1) and
114+
postDominatedPropWrite(name, assign1, assign2, true)
115+
}
116+
109117
/**
110118
* Holds if `assign` assigns a property that may be accessed somewhere else in the same block,
111119
* `after` indicates if the access happens before or after the node for `assign`.
@@ -234,7 +242,7 @@ ControlFlowNode getANodeWithNoPropAccessBetweenInsideBlock(string name, DataFlow
234242
* Holds if `assign1` and `assign2` are in different basicblocks and both assign property `name`, and the assigned property is not accessed between the two assignments.
235243
*/
236244
pragma[nomagic]
237-
predicate noPropAccessBetweenGlobal(
245+
predicate noPropAccessBetweenAcrossBasicBlocks(
238246
string name, DataFlow::PropWrite assign1, DataFlow::PropWrite assign2
239247
) {
240248
exists(

0 commit comments

Comments
 (0)