Skip to content

Commit 87df3a0

Browse files
committed
Minor refactor
1 parent aa86070 commit 87df3a0

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

ruby/ql/lib/codeql/ruby/dataflow/internal/SsaImplSpecific.qll

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,14 @@ class SourceVariable = LocalVariable;
2323
*/
2424
predicate variableWrite(BasicBlock bb, int i, SourceVariable v, boolean certain) {
2525
(
26-
// We consider the `self` variable to have a single write at the entry to a method block...
27-
v.(SelfVariable).getDeclaringScope() = bb.(BasicBlocks::EntryBasicBlock).getScope() and
28-
i = 0
29-
or
30-
// ...or a class or module block.
31-
bb.getNode(i).getNode() =
32-
v.(SelfVariable).getDeclaringScope().(ModuleBase).getAControlFlowEntryNode()
26+
exists(Scope scope | scope = v.(SelfVariable).getDeclaringScope() |
27+
// We consider the `self` variable to have a single write at the entry to a method block...
28+
scope = bb.(BasicBlocks::EntryBasicBlock).getScope() and
29+
i = 0
30+
or
31+
// ...or a class or module block.
32+
bb.getNode(i).getNode() = scope.(ModuleBase).getAControlFlowEntryNode()
33+
)
3334
or
3435
SsaImpl::uninitializedWrite(bb, i, v)
3536
or

0 commit comments

Comments
 (0)