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

Member predicate Ssa::Definition::getAFirstRead

Gets a first control-flow node that reads the value of this SSA definition. That is, a read that can be reached from this definition without passing through other reads.

Example:

def m b        # defines b_0
  i = 0        # defines i_0
  puts i       # first read of i_0
  puts i + 1
  if b         # first read of b_0
    i = 1      # defines i_1
    puts i     # first read of i_1
    puts i + 1
  else
    i = 2      # defines i_2
    puts i     # first read of i_2
    puts i + 1
  end
               # defines i_3 = phi(i_1, i_2)
  puts i       # first read of i3
end
VariableReadAccessCfgNode getAFirstRead()