Files
codeql/ql/test/query-tests/analysis/Definitions.rb
Harry Maclean 8901eba978 Include constants in jump-to-def query
The previous version of this query inadvertently excluded constants
which weren't classes or modules. This version includes them, by
introducing a laxer version of `resolveScopeExpr` that doesn't require
the result to be a `TResolved`.
2021-08-31 15:42:06 +01:00

47 lines
418 B
Ruby

module A
SOME_CONSTANT = 1
class B
def f
g SOME_CONSTANT
end
def g x
x
end
def h
f
end
end
end
module C
@@a = 1
def self.a
@@a
end
class D
@@b = 2
def initialize
@e = 1
x, y = [1, 2]
y
end
def h y
A::B.new.g y
UnknownClass.some_method
@f = 2
@e
@f
@@b
end
end
end
C::D.new