CodeQL library for Ruby
codeql/ruby-all 0.8.15-dev (changelog, source)
Search

Member predicate Ssa::Definition::hasAdjacentReads

Holds if read1 and read2 are adjacent reads of this SSA definition. That is, read2 can be reached from read1 without passing through another read.

Example:

def m b
  i = 0        # defines i_0
  puts i       # reads i_0 (read1)
  puts i + 1   # reads i_0 (read2)
  if b
    i = 1      # defines i_1
    puts i     # reads i_1 (read1)
    puts i + 1 # reads i_1 (read2)
  else
    i = 2      # defines i_2
    puts i     # reads i_2 (read1)
    puts i + 1 # reads i_2 (read2)
  end
  puts i
end
predicate hasAdjacentReads(VariableReadAccessCfgNode read1, VariableReadAccessCfgNode read2)