@@ -107,6 +107,9 @@ predicate isDeadAssignment(string name, DataFlow::PropWrite assign1, DataFlow::P
107107/**
108108 * Holds if `assign` assigns a property that may be accessed somewhere else in the same block,
109109 * `after` indicates if the access happens before or after the node for `assign`.
110+ *
111+ * The access can either be a direct property access of the same name,
112+ * or an impure expression where we assume that the expression can access the property.
110113 */
111114predicate maybeAssignsAccessedPropInBlock ( DataFlow:: PropWrite assign , boolean after ) {
112115 (
@@ -116,6 +119,7 @@ predicate maybeAssignsAccessedPropInBlock(DataFlow::PropWrite assign, boolean af
116119 after = false and postDominatedPropWrite ( _, _, assign , false )
117120 ) and
118121 (
122+ // direct property write before/after assign
119123 exists ( ReachableBasicBlock block , int i , int j , Expr e , string name |
120124 i = getRank ( block , assign .getWriteNode ( ) , name ) and
121125 j = getRank ( block , e , name ) and
@@ -126,6 +130,7 @@ predicate maybeAssignsAccessedPropInBlock(DataFlow::PropWrite assign, boolean af
126130 after = false and j < i
127131 )
128132 or
133+ // impure expression that might access the property before/after assign
129134 exists ( ReachableBasicBlock block | assign .getWriteNode ( ) .getBasicBlock ( ) = block |
130135 after = true and isBeforeImpure ( assign , block )
131136 or
0 commit comments