Skip to content

Commit 7a27ccd

Browse files
committed
JS: Move a comment
1 parent ea563f8 commit 7a27ccd

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

javascript/ql/src/Declarations/DeadStoreOfLocal.ql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ import DeadStore
1616
/**
1717
* Holds if `vd` is a definition of variable `v` that is dead, that is,
1818
* the value it assigns to `v` is not read.
19+
*
20+
* Captured variables may be read by closures, so we restrict this to
21+
* purely local variables.
1922
*/
2023
predicate deadStoreOfLocal(VarDef vd, PurelyLocalVariable v) {
2124
v = vd.getAVariable() and
@@ -26,7 +29,7 @@ predicate deadStoreOfLocal(VarDef vd, PurelyLocalVariable v) {
2629
not exists(SsaExplicitDefinition ssa | ssa.defines(vd, v))
2730
}
2831

29-
from VarDef dead, PurelyLocalVariable v, string msg // captured variables may be read by closures, so don't flag them
32+
from VarDef dead, PurelyLocalVariable v, string msg
3033
where
3134
deadStoreOfLocal(dead, v) and
3235
// the variable should be accessed somewhere; otherwise it will be flagged by UnusedVariable

0 commit comments

Comments
 (0)