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

Member predicate DataFlow::ConstRef::getConstant

Gets a constant reference that may resolve to a member of this node.

For example DataFlow::getConstant("A").getConstant("B") finds the following:

A::B # simple reference

module A
  B # in scope
  module X
    B # in nested scope
  end
end

module X
  include A
  B # via inclusion
end

class X < A
  B # via subclassing
end
ConstRef getConstant(string name)