Move files to ruby subfolder

This commit is contained in:
Arthur Baars
2021-10-14 12:14:50 +02:00
parent 1cf90858cc
commit 976daddd36
537 changed files with 1 additions and 1 deletions

View File

@@ -0,0 +1,154 @@
calls.rb:
# 102| Hash
#-----| super -> Object
# 77| Integer
#-----| super -> Numeric
# 86| Kernel
# 90| Module
#-----| super -> Object
# 97| Object
#-----| include -> Kernel
#-----| super -> BasicObject
# 106| Array
#-----| super -> Object
#-----| BasicObject
#-----| Class
#-----| super -> Module
#-----| Complex
#-----| super -> Numeric
#-----| FalseClass
#-----| super -> Object
#-----| Float
#-----| super -> Numeric
#-----| NilClass
#-----| super -> Object
#-----| Numeric
#-----| super -> Object
#-----| Proc
#-----| Rational
#-----| super -> Numeric
#-----| Symbol
#-----| TrueClass
#-----| super -> Object
# 15| M
private.rb:
# 1| C
#-----| super -> Object
#-----| include -> M
calls.rb:
# 51| D
#-----| super -> C
# 82| String
#-----| super -> Object
# 144| S
#-----| super -> Object
# 150| A
#-----| super -> S
# 155| B
#-----| super -> S
hello.rb:
# 1| EnglishWords
# 11| Greeting
#-----| super -> Object
#-----| include -> EnglishWords
# 18| HelloWorld
#-----| super -> Greeting
modules.rb:
# 1| Empty
# 4| Foo
# 37| Bar
#-----| super -> Object
# 60| MyModuleInGlobalScope
# 63| Test
# 83| Other
# 88| IncludeTest
#-----| include -> Test
# 95| IncludeTest2
#-----| include -> Test
# 101| PrependTest
#-----| prepend -> Test
# 107| MM
# 112| YY
#-----| super -> Object
# 115| XX
# 5| Foo::Bar
# 19| Foo::ClassInFoo
#-----| super -> Object
# 30| Foo::ClassInAnotherDefinitionOfFoo
#-----| super -> Object
# 116| XX::YY
#-----| super -> YY
# 65| Test::Foo1
# 70| Test::Foo2
# 76| Test::Foo3
# 84| Other::Foo1
# 6| Foo::Bar::ClassInFooBar
#-----| super -> Object
# 71| Test::Foo2::Foo2
# 108| MM::MM
# 49| Foo::Bar::ClassInAnotherDefinitionOfFooBar
#-----| super -> Object
# 66| Test::Foo1::Bar
#-----| super -> Object
# 91| Test::Foo1::Y
# 97| Test::Foo1::Z
# 103| Test::Foo2::Y
# 72| Test::Foo2::Foo2::Bar
#-----| super -> Object
# 120| Test::Foo1::Bar::Baz

View File

@@ -0,0 +1,21 @@
/**
* @kind graph
* @id rb/test/ancestors
*/
import ruby
query predicate nodes(Module node, string key, string value) {
key = "semmle.label" and value = node.toString()
}
query predicate edges(Module source, Module target, string key, string value) {
key = "semmle.label" and
(
target = source.getSuperClass() and value = "super"
or
target = source.getAPrependedModule() and value = "prepend"
or
target = source.getAnIncludedModule() and value = "include"
)
}

View File

@@ -0,0 +1,129 @@
getTarget
| calls.rb:2:5:2:14 | call to puts | calls.rb:87:5:87:17 | puts |
| calls.rb:5:1:5:3 | call to foo | calls.rb:1:1:3:3 | foo |
| calls.rb:5:1:5:3 | call to foo | calls.rb:71:1:75:3 | foo |
| calls.rb:8:5:8:14 | call to puts | calls.rb:87:5:87:17 | puts |
| calls.rb:11:1:11:8 | call to bar | calls.rb:7:1:9:3 | bar |
| calls.rb:13:1:13:8 | call to foo | calls.rb:1:1:3:3 | foo |
| calls.rb:13:1:13:8 | call to foo | calls.rb:71:1:75:3 | foo |
| calls.rb:22:5:22:15 | call to singleton_m | calls.rb:17:5:17:29 | singleton_m |
| calls.rb:23:5:23:20 | call to singleton_m | calls.rb:17:5:17:29 | singleton_m |
| calls.rb:27:1:27:13 | call to singleton_m | calls.rb:17:5:17:29 | singleton_m |
| calls.rb:30:5:30:13 | call to include | calls.rb:92:5:92:20 | include |
| calls.rb:38:9:38:18 | call to instance_m | calls.rb:16:5:16:23 | instance_m |
| calls.rb:39:9:39:23 | call to instance_m | calls.rb:16:5:16:23 | instance_m |
| calls.rb:46:5:46:9 | call to new | calls.rb:99:5:99:16 | new |
| calls.rb:47:1:47:5 | call to baz | calls.rb:37:5:43:7 | baz |
| calls.rb:49:1:49:12 | call to instance_m | calls.rb:16:5:16:23 | instance_m |
| calls.rb:53:9:53:13 | call to super | calls.rb:37:5:43:7 | baz |
| calls.rb:57:5:57:9 | call to new | calls.rb:99:5:99:16 | new |
| calls.rb:58:1:58:5 | call to baz | calls.rb:52:5:54:7 | baz |
| calls.rb:60:1:60:12 | call to instance_m | calls.rb:16:5:16:23 | instance_m |
| calls.rb:63:5:63:16 | call to bit_length | calls.rb:78:5:78:23 | bit_length |
| calls.rb:64:5:64:16 | call to bit_length | calls.rb:78:5:78:23 | bit_length |
| calls.rb:68:5:68:11 | yield ... | calls.rb:74:16:74:29 | { ... } |
| calls.rb:68:5:68:11 | yield ... | calls.rb:141:10:141:28 | { ... } |
| calls.rb:72:11:72:18 | call to new | calls.rb:99:5:99:16 | new |
| calls.rb:73:5:73:10 | ...[...] | calls.rb:103:5:103:15 | [] |
| calls.rb:74:5:74:29 | call to call_block | calls.rb:67:1:69:3 | call_block |
| calls.rb:74:22:74:27 | ...[...] | calls.rb:103:5:103:15 | [] |
| calls.rb:98:5:98:18 | call to include | calls.rb:92:5:92:20 | include |
| calls.rb:112:15:112:25 | call to length | calls.rb:108:3:108:17 | length |
| calls.rb:113:9:113:24 | yield ... | calls.rb:129:23:129:62 | { ... } |
| calls.rb:113:9:113:24 | yield ... | calls.rb:131:17:131:35 | { ... } |
| calls.rb:113:9:113:24 | yield ... | calls.rb:133:17:133:40 | { ... } |
| calls.rb:113:9:113:24 | yield ... | calls.rb:135:18:135:37 | { ... } |
| calls.rb:113:18:113:24 | ...[...] | calls.rb:107:3:107:13 | [] |
| calls.rb:120:5:120:20 | yield ... | calls.rb:123:7:123:30 | { ... } |
| calls.rb:123:1:123:30 | call to funny | calls.rb:119:1:121:3 | funny |
| calls.rb:123:13:123:29 | call to puts | calls.rb:87:5:87:17 | puts |
| calls.rb:123:18:123:29 | call to capitalize | calls.rb:83:5:83:23 | capitalize |
| calls.rb:125:1:125:14 | call to capitalize | calls.rb:83:5:83:23 | capitalize |
| calls.rb:126:1:126:12 | call to bit_length | calls.rb:78:5:78:23 | bit_length |
| calls.rb:127:1:127:5 | call to abs | calls.rb:79:5:79:16 | abs |
| calls.rb:129:1:129:62 | call to foreach | calls.rb:110:3:116:5 | foreach |
| calls.rb:129:32:129:61 | call to puts | calls.rb:87:5:87:17 | puts |
| calls.rb:131:1:131:35 | call to foreach | calls.rb:110:3:116:5 | foreach |
| calls.rb:131:23:131:34 | call to bit_length | calls.rb:78:5:78:23 | bit_length |
| calls.rb:133:1:133:40 | call to foreach | calls.rb:110:3:116:5 | foreach |
| calls.rb:133:23:133:39 | call to puts | calls.rb:87:5:87:17 | puts |
| calls.rb:135:1:135:37 | call to foreach | calls.rb:110:3:116:5 | foreach |
| calls.rb:135:27:135:36 | call to puts | calls.rb:87:5:87:17 | puts |
| calls.rb:138:5:138:17 | call to call_block | calls.rb:67:1:69:3 | call_block |
| calls.rb:141:1:141:28 | call to indirect | calls.rb:137:1:139:3 | indirect |
| calls.rb:141:16:141:27 | call to bit_length | calls.rb:78:5:78:23 | bit_length |
| calls.rb:146:9:146:17 | call to to_s | calls.rb:151:5:152:7 | to_s |
| calls.rb:146:9:146:17 | call to to_s | calls.rb:156:5:157:7 | to_s |
| calls.rb:160:1:160:5 | call to new | calls.rb:99:5:99:16 | new |
| calls.rb:160:1:160:14 | call to s_method | calls.rb:145:5:147:7 | s_method |
| calls.rb:161:1:161:5 | call to new | calls.rb:99:5:99:16 | new |
| calls.rb:161:1:161:14 | call to s_method | calls.rb:145:5:147:7 | s_method |
| calls.rb:162:1:162:5 | call to new | calls.rb:99:5:99:16 | new |
| calls.rb:162:1:162:14 | call to s_method | calls.rb:145:5:147:7 | s_method |
| calls.rb:167:1:167:15 | call to private_on_main | calls.rb:164:1:165:3 | private_on_main |
| hello.rb:12:5:12:24 | call to include | calls.rb:92:5:92:20 | include |
| hello.rb:14:16:14:20 | call to hello | hello.rb:2:5:4:7 | hello |
| hello.rb:20:16:20:20 | call to super | hello.rb:13:5:15:7 | message |
| hello.rb:20:30:20:34 | call to world | hello.rb:5:5:7:7 | world |
| modules.rb:12:5:12:26 | call to puts | calls.rb:87:5:87:17 | puts |
| modules.rb:22:3:22:19 | call to puts | calls.rb:87:5:87:17 | puts |
| modules.rb:33:3:33:25 | call to puts | calls.rb:87:5:87:17 | puts |
| modules.rb:44:3:44:19 | call to puts | calls.rb:87:5:87:17 | puts |
| modules.rb:55:3:55:30 | call to puts | calls.rb:87:5:87:17 | puts |
| modules.rb:89:3:89:16 | call to include | calls.rb:92:5:92:20 | include |
| modules.rb:90:3:90:38 | call to module_eval | calls.rb:91:5:91:24 | module_eval |
| modules.rb:90:24:90:36 | call to prepend | calls.rb:93:5:93:20 | prepend |
| modules.rb:96:3:96:14 | call to include | calls.rb:92:5:92:20 | include |
| modules.rb:102:3:102:16 | call to prepend | calls.rb:93:5:93:20 | prepend |
| private.rb:2:3:3:5 | call to private | calls.rb:94:5:94:20 | private |
| private.rb:10:3:10:19 | call to private | calls.rb:94:5:94:20 | private |
| private.rb:12:3:12:9 | call to private | calls.rb:94:5:94:20 | private |
| private.rb:24:1:24:5 | call to new | calls.rb:99:5:99:16 | new |
| private.rb:25:1:25:5 | call to new | calls.rb:99:5:99:16 | new |
| private.rb:26:1:26:5 | call to new | calls.rb:99:5:99:16 | new |
| private.rb:27:1:27:5 | call to new | calls.rb:99:5:99:16 | new |
| private.rb:28:1:28:5 | call to new | calls.rb:99:5:99:16 | new |
| private.rb:28:1:28:12 | call to public | private.rb:5:3:6:5 | public |
| private.rb:30:1:30:15 | call to private_on_main | private.rb:21:1:22:3 | private_on_main |
unresolvedCall
| calls.rb:19:5:19:14 | call to instance_m |
| calls.rb:20:5:20:19 | call to instance_m |
| calls.rb:26:1:26:12 | call to instance_m |
| calls.rb:31:5:31:14 | call to instance_m |
| calls.rb:32:5:32:19 | call to instance_m |
| calls.rb:34:5:34:15 | call to singleton_m |
| calls.rb:35:5:35:20 | call to singleton_m |
| calls.rb:41:9:41:19 | call to singleton_m |
| calls.rb:42:9:42:24 | call to singleton_m |
| calls.rb:48:1:48:13 | call to singleton_m |
| calls.rb:59:1:59:13 | call to singleton_m |
| calls.rb:112:11:112:25 | ... < ... |
| calls.rb:114:11:114:12 | ... + ... |
| calls.rb:129:1:129:13 | call to [] |
| calls.rb:129:48:129:59 | call to capitalize |
| calls.rb:131:1:131:7 | call to [] |
| calls.rb:133:1:133:7 | call to [] |
| calls.rb:133:28:133:39 | call to capitalize |
| calls.rb:135:1:135:8 | call to [] |
| calls.rb:135:4:135:5 | - ... |
| calls.rb:135:32:135:36 | call to abs |
| hello.rb:20:16:20:26 | ... + ... |
| hello.rb:20:16:20:34 | ... + ... |
| hello.rb:20:16:20:40 | ... + ... |
| private.rb:24:1:24:14 | call to private1 |
| private.rb:25:1:25:14 | call to private2 |
| private.rb:26:1:26:14 | call to private3 |
| private.rb:27:1:27:14 | call to private4 |
privateMethod
| calls.rb:1:1:3:3 | foo |
| calls.rb:62:1:65:3 | optional_arg |
| calls.rb:67:1:69:3 | call_block |
| calls.rb:71:1:75:3 | foo |
| calls.rb:119:1:121:3 | funny |
| calls.rb:137:1:139:3 | indirect |
| calls.rb:164:1:165:3 | private_on_main |
| private.rb:2:11:3:5 | private1 |
| private.rb:8:3:9:5 | private2 |
| private.rb:14:3:15:5 | private3 |
| private.rb:17:3:18:5 | private4 |
| private.rb:21:1:22:3 | private_on_main |

View File

@@ -0,0 +1,7 @@
import ruby
query Callable getTarget(Call call) { result = call.getATarget() }
query predicate unresolvedCall(Call call) { not exists(call.getATarget()) }
query predicate privateMethod(Method m) { m.isPrivate() }

View File

@@ -0,0 +1,167 @@
def foo
puts "foo"
end
foo
def self.bar
puts "bar"
end
self.bar
self.foo
module M
def instance_m; end
def self.singleton_m; end
instance_m # NoMethodError
self.instance_m # NoMethodError
singleton_m
self.singleton_m
end
M.instance_m # NoMethodError
M.singleton_m
class C
include M
instance_m # NoMethodError
self.instance_m # NoMethodError
singleton_m # NoMethodError
self.singleton_m # NoMethodError
def baz
instance_m
self.instance_m
singleton_m # NoMethodError
self.singleton_m # NoMethodError
end
end
c = C.new
c.baz
c.singleton_m # NoMethodError
c.instance_m
class D < C
def baz
super
end
end
d = D.new
d.baz
d.singleton_m # NoMethodError
d.instance_m
def optional_arg(a = 4, b: 5)
a.bit_length
b.bit_length
end
def call_block
yield 1
end
def foo()
var = Hash.new
var[1]
call_block { |x| var[x] }
end
class Integer
def bit_length; end
def abs; end
end
class String
def capitalize; end
end
module Kernel
def puts; end
end
class Module
def module_eval; end
def include; end
def prepend; end
def private; end
end
class Object < Module
include Kernel
def new; end
end
class Hash
def []; end
end
class Array
def []; end
def length; end
def foreach &body
x = 0
while x < self.length
yield x, self[x]
x += 1
end
end
end
def funny
yield "prefix: "
end
funny { |i| puts i.capitalize}
"a".capitalize
1.bit_length
1.abs
["a","b","c"].foreach { |i, v| puts "#{i} -> #{v.capitalize}"} # TODO should resolve to String.capitalize
[1,2,3].foreach { |i| i.bit_length}
[1,2,3].foreach { |i| puts i.capitalize} # NoMethodError
[1,-2,3].foreach { |_, v| puts v.abs} # TODO should resolve to Integer.abs
def indirect &b
call_block &b
end
indirect { |i| i.bit_length}
class S
def s_method
self.to_s
end
end
class A < S
def to_s
end
end
class B < S
def to_s
end
end
S.new.s_method
A.new.s_method
B.new.s_method
def private_on_main
end
private_on_main

View File

@@ -0,0 +1,22 @@
module EnglishWords
def hello
return "hello"
end
def world
return "world"
end
end
class Greeting
include EnglishWords
def message
return hello
end
end
class HelloWorld < Greeting
def message
return super + " " + world + "!"
end
end

View File

@@ -0,0 +1,223 @@
getMethod
| calls.rb:15:1:24:3 | M | instance_m | calls.rb:16:5:16:23 | instance_m |
| calls.rb:51:1:55:3 | D | baz | calls.rb:52:5:54:7 | baz |
| calls.rb:77:1:80:3 | Integer | abs | calls.rb:79:5:79:16 | abs |
| calls.rb:77:1:80:3 | Integer | bit_length | calls.rb:78:5:78:23 | bit_length |
| calls.rb:82:1:84:3 | String | capitalize | calls.rb:83:5:83:23 | capitalize |
| calls.rb:86:1:88:3 | Kernel | puts | calls.rb:87:5:87:17 | puts |
| calls.rb:90:1:95:3 | Module | include | calls.rb:92:5:92:20 | include |
| calls.rb:90:1:95:3 | Module | module_eval | calls.rb:91:5:91:24 | module_eval |
| calls.rb:90:1:95:3 | Module | prepend | calls.rb:93:5:93:20 | prepend |
| calls.rb:90:1:95:3 | Module | private | calls.rb:94:5:94:20 | private |
| calls.rb:97:1:100:3 | Object | call_block | calls.rb:67:1:69:3 | call_block |
| calls.rb:97:1:100:3 | Object | foo | calls.rb:1:1:3:3 | foo |
| calls.rb:97:1:100:3 | Object | foo | calls.rb:71:1:75:3 | foo |
| calls.rb:97:1:100:3 | Object | funny | calls.rb:119:1:121:3 | funny |
| calls.rb:97:1:100:3 | Object | indirect | calls.rb:137:1:139:3 | indirect |
| calls.rb:97:1:100:3 | Object | new | calls.rb:99:5:99:16 | new |
| calls.rb:97:1:100:3 | Object | optional_arg | calls.rb:62:1:65:3 | optional_arg |
| calls.rb:97:1:100:3 | Object | private_on_main | calls.rb:164:1:165:3 | private_on_main |
| calls.rb:97:1:100:3 | Object | private_on_main | private.rb:21:1:22:3 | private_on_main |
| calls.rb:102:1:104:3 | Hash | [] | calls.rb:103:5:103:15 | [] |
| calls.rb:106:1:117:3 | Array | [] | calls.rb:107:3:107:13 | [] |
| calls.rb:106:1:117:3 | Array | foreach | calls.rb:110:3:116:5 | foreach |
| calls.rb:106:1:117:3 | Array | length | calls.rb:108:3:108:17 | length |
| calls.rb:144:1:148:3 | S | s_method | calls.rb:145:5:147:7 | s_method |
| calls.rb:150:1:153:3 | A | to_s | calls.rb:151:5:152:7 | to_s |
| calls.rb:155:1:158:3 | B | to_s | calls.rb:156:5:157:7 | to_s |
| hello.rb:1:1:8:3 | EnglishWords | hello | hello.rb:2:5:4:7 | hello |
| hello.rb:1:1:8:3 | EnglishWords | world | hello.rb:5:5:7:7 | world |
| hello.rb:11:1:16:3 | Greeting | message | hello.rb:13:5:15:7 | message |
| hello.rb:18:1:22:3 | HelloWorld | message | hello.rb:19:5:21:7 | message |
| modules.rb:4:1:24:3 | Foo | method_in_another_definition_of_foo | modules.rb:27:3:28:5 | method_in_another_definition_of_foo |
| modules.rb:4:1:24:3 | Foo | method_in_foo | modules.rb:16:3:17:5 | method_in_foo |
| modules.rb:5:3:14:5 | Foo::Bar | method_in_another_definition_of_foo_bar | modules.rb:52:3:53:5 | method_in_another_definition_of_foo_bar |
| modules.rb:5:3:14:5 | Foo::Bar | method_in_foo_bar | modules.rb:9:5:10:7 | method_in_foo_bar |
| modules.rb:37:1:46:3 | Bar | method_a | modules.rb:38:3:39:5 | method_a |
| modules.rb:37:1:46:3 | Bar | method_b | modules.rb:41:3:42:5 | method_b |
| private.rb:1:1:19:3 | C | baz | calls.rb:37:5:43:7 | baz |
| private.rb:1:1:19:3 | C | private2 | private.rb:8:3:9:5 | private2 |
| private.rb:1:1:19:3 | C | private3 | private.rb:14:3:15:5 | private3 |
| private.rb:1:1:19:3 | C | private4 | private.rb:17:3:18:5 | private4 |
| private.rb:1:1:19:3 | C | public | private.rb:5:3:6:5 | public |
lookupMethod
| calls.rb:15:1:24:3 | M | instance_m | calls.rb:16:5:16:23 | instance_m |
| calls.rb:51:1:55:3 | D | baz | calls.rb:52:5:54:7 | baz |
| calls.rb:51:1:55:3 | D | call_block | calls.rb:67:1:69:3 | call_block |
| calls.rb:51:1:55:3 | D | foo | calls.rb:1:1:3:3 | foo |
| calls.rb:51:1:55:3 | D | foo | calls.rb:71:1:75:3 | foo |
| calls.rb:51:1:55:3 | D | funny | calls.rb:119:1:121:3 | funny |
| calls.rb:51:1:55:3 | D | indirect | calls.rb:137:1:139:3 | indirect |
| calls.rb:51:1:55:3 | D | instance_m | calls.rb:16:5:16:23 | instance_m |
| calls.rb:51:1:55:3 | D | new | calls.rb:99:5:99:16 | new |
| calls.rb:51:1:55:3 | D | optional_arg | calls.rb:62:1:65:3 | optional_arg |
| calls.rb:51:1:55:3 | D | private2 | private.rb:8:3:9:5 | private2 |
| calls.rb:51:1:55:3 | D | private3 | private.rb:14:3:15:5 | private3 |
| calls.rb:51:1:55:3 | D | private4 | private.rb:17:3:18:5 | private4 |
| calls.rb:51:1:55:3 | D | private_on_main | calls.rb:164:1:165:3 | private_on_main |
| calls.rb:51:1:55:3 | D | public | private.rb:5:3:6:5 | public |
| calls.rb:51:1:55:3 | D | puts | calls.rb:87:5:87:17 | puts |
| calls.rb:77:1:80:3 | Integer | abs | calls.rb:79:5:79:16 | abs |
| calls.rb:77:1:80:3 | Integer | bit_length | calls.rb:78:5:78:23 | bit_length |
| calls.rb:77:1:80:3 | Integer | new | calls.rb:99:5:99:16 | new |
| calls.rb:77:1:80:3 | Integer | puts | calls.rb:87:5:87:17 | puts |
| calls.rb:82:1:84:3 | String | call_block | calls.rb:67:1:69:3 | call_block |
| calls.rb:82:1:84:3 | String | capitalize | calls.rb:83:5:83:23 | capitalize |
| calls.rb:82:1:84:3 | String | foo | calls.rb:1:1:3:3 | foo |
| calls.rb:82:1:84:3 | String | foo | calls.rb:71:1:75:3 | foo |
| calls.rb:82:1:84:3 | String | funny | calls.rb:119:1:121:3 | funny |
| calls.rb:82:1:84:3 | String | indirect | calls.rb:137:1:139:3 | indirect |
| calls.rb:82:1:84:3 | String | new | calls.rb:99:5:99:16 | new |
| calls.rb:82:1:84:3 | String | optional_arg | calls.rb:62:1:65:3 | optional_arg |
| calls.rb:82:1:84:3 | String | private_on_main | calls.rb:164:1:165:3 | private_on_main |
| calls.rb:82:1:84:3 | String | puts | calls.rb:87:5:87:17 | puts |
| calls.rb:86:1:88:3 | Kernel | puts | calls.rb:87:5:87:17 | puts |
| calls.rb:90:1:95:3 | Module | call_block | calls.rb:67:1:69:3 | call_block |
| calls.rb:90:1:95:3 | Module | foo | calls.rb:1:1:3:3 | foo |
| calls.rb:90:1:95:3 | Module | foo | calls.rb:71:1:75:3 | foo |
| calls.rb:90:1:95:3 | Module | funny | calls.rb:119:1:121:3 | funny |
| calls.rb:90:1:95:3 | Module | include | calls.rb:92:5:92:20 | include |
| calls.rb:90:1:95:3 | Module | indirect | calls.rb:137:1:139:3 | indirect |
| calls.rb:90:1:95:3 | Module | module_eval | calls.rb:91:5:91:24 | module_eval |
| calls.rb:90:1:95:3 | Module | new | calls.rb:99:5:99:16 | new |
| calls.rb:90:1:95:3 | Module | optional_arg | calls.rb:62:1:65:3 | optional_arg |
| calls.rb:90:1:95:3 | Module | prepend | calls.rb:93:5:93:20 | prepend |
| calls.rb:90:1:95:3 | Module | private | calls.rb:94:5:94:20 | private |
| calls.rb:90:1:95:3 | Module | private_on_main | calls.rb:164:1:165:3 | private_on_main |
| calls.rb:90:1:95:3 | Module | puts | calls.rb:87:5:87:17 | puts |
| calls.rb:97:1:100:3 | Object | call_block | calls.rb:67:1:69:3 | call_block |
| calls.rb:97:1:100:3 | Object | foo | calls.rb:1:1:3:3 | foo |
| calls.rb:97:1:100:3 | Object | foo | calls.rb:71:1:75:3 | foo |
| calls.rb:97:1:100:3 | Object | funny | calls.rb:119:1:121:3 | funny |
| calls.rb:97:1:100:3 | Object | indirect | calls.rb:137:1:139:3 | indirect |
| calls.rb:97:1:100:3 | Object | new | calls.rb:99:5:99:16 | new |
| calls.rb:97:1:100:3 | Object | optional_arg | calls.rb:62:1:65:3 | optional_arg |
| calls.rb:97:1:100:3 | Object | private_on_main | calls.rb:164:1:165:3 | private_on_main |
| calls.rb:97:1:100:3 | Object | private_on_main | private.rb:21:1:22:3 | private_on_main |
| calls.rb:97:1:100:3 | Object | puts | calls.rb:87:5:87:17 | puts |
| calls.rb:102:1:104:3 | Hash | [] | calls.rb:103:5:103:15 | [] |
| calls.rb:102:1:104:3 | Hash | call_block | calls.rb:67:1:69:3 | call_block |
| calls.rb:102:1:104:3 | Hash | foo | calls.rb:1:1:3:3 | foo |
| calls.rb:102:1:104:3 | Hash | foo | calls.rb:71:1:75:3 | foo |
| calls.rb:102:1:104:3 | Hash | funny | calls.rb:119:1:121:3 | funny |
| calls.rb:102:1:104:3 | Hash | indirect | calls.rb:137:1:139:3 | indirect |
| calls.rb:102:1:104:3 | Hash | new | calls.rb:99:5:99:16 | new |
| calls.rb:102:1:104:3 | Hash | optional_arg | calls.rb:62:1:65:3 | optional_arg |
| calls.rb:102:1:104:3 | Hash | private_on_main | calls.rb:164:1:165:3 | private_on_main |
| calls.rb:102:1:104:3 | Hash | puts | calls.rb:87:5:87:17 | puts |
| calls.rb:106:1:117:3 | Array | [] | calls.rb:107:3:107:13 | [] |
| calls.rb:106:1:117:3 | Array | call_block | calls.rb:67:1:69:3 | call_block |
| calls.rb:106:1:117:3 | Array | foo | calls.rb:1:1:3:3 | foo |
| calls.rb:106:1:117:3 | Array | foo | calls.rb:71:1:75:3 | foo |
| calls.rb:106:1:117:3 | Array | foreach | calls.rb:110:3:116:5 | foreach |
| calls.rb:106:1:117:3 | Array | funny | calls.rb:119:1:121:3 | funny |
| calls.rb:106:1:117:3 | Array | indirect | calls.rb:137:1:139:3 | indirect |
| calls.rb:106:1:117:3 | Array | length | calls.rb:108:3:108:17 | length |
| calls.rb:106:1:117:3 | Array | new | calls.rb:99:5:99:16 | new |
| calls.rb:106:1:117:3 | Array | optional_arg | calls.rb:62:1:65:3 | optional_arg |
| calls.rb:106:1:117:3 | Array | private_on_main | calls.rb:164:1:165:3 | private_on_main |
| calls.rb:106:1:117:3 | Array | puts | calls.rb:87:5:87:17 | puts |
| calls.rb:144:1:148:3 | S | call_block | calls.rb:67:1:69:3 | call_block |
| calls.rb:144:1:148:3 | S | foo | calls.rb:1:1:3:3 | foo |
| calls.rb:144:1:148:3 | S | foo | calls.rb:71:1:75:3 | foo |
| calls.rb:144:1:148:3 | S | funny | calls.rb:119:1:121:3 | funny |
| calls.rb:144:1:148:3 | S | indirect | calls.rb:137:1:139:3 | indirect |
| calls.rb:144:1:148:3 | S | new | calls.rb:99:5:99:16 | new |
| calls.rb:144:1:148:3 | S | optional_arg | calls.rb:62:1:65:3 | optional_arg |
| calls.rb:144:1:148:3 | S | private_on_main | calls.rb:164:1:165:3 | private_on_main |
| calls.rb:144:1:148:3 | S | puts | calls.rb:87:5:87:17 | puts |
| calls.rb:144:1:148:3 | S | s_method | calls.rb:145:5:147:7 | s_method |
| calls.rb:150:1:153:3 | A | call_block | calls.rb:67:1:69:3 | call_block |
| calls.rb:150:1:153:3 | A | foo | calls.rb:1:1:3:3 | foo |
| calls.rb:150:1:153:3 | A | foo | calls.rb:71:1:75:3 | foo |
| calls.rb:150:1:153:3 | A | funny | calls.rb:119:1:121:3 | funny |
| calls.rb:150:1:153:3 | A | indirect | calls.rb:137:1:139:3 | indirect |
| calls.rb:150:1:153:3 | A | new | calls.rb:99:5:99:16 | new |
| calls.rb:150:1:153:3 | A | optional_arg | calls.rb:62:1:65:3 | optional_arg |
| calls.rb:150:1:153:3 | A | private_on_main | calls.rb:164:1:165:3 | private_on_main |
| calls.rb:150:1:153:3 | A | puts | calls.rb:87:5:87:17 | puts |
| calls.rb:150:1:153:3 | A | s_method | calls.rb:145:5:147:7 | s_method |
| calls.rb:150:1:153:3 | A | to_s | calls.rb:151:5:152:7 | to_s |
| calls.rb:155:1:158:3 | B | call_block | calls.rb:67:1:69:3 | call_block |
| calls.rb:155:1:158:3 | B | foo | calls.rb:1:1:3:3 | foo |
| calls.rb:155:1:158:3 | B | foo | calls.rb:71:1:75:3 | foo |
| calls.rb:155:1:158:3 | B | funny | calls.rb:119:1:121:3 | funny |
| calls.rb:155:1:158:3 | B | indirect | calls.rb:137:1:139:3 | indirect |
| calls.rb:155:1:158:3 | B | new | calls.rb:99:5:99:16 | new |
| calls.rb:155:1:158:3 | B | optional_arg | calls.rb:62:1:65:3 | optional_arg |
| calls.rb:155:1:158:3 | B | private_on_main | calls.rb:164:1:165:3 | private_on_main |
| calls.rb:155:1:158:3 | B | puts | calls.rb:87:5:87:17 | puts |
| calls.rb:155:1:158:3 | B | s_method | calls.rb:145:5:147:7 | s_method |
| calls.rb:155:1:158:3 | B | to_s | calls.rb:156:5:157:7 | to_s |
| file://:0:0:0:0 | Class | include | calls.rb:92:5:92:20 | include |
| file://:0:0:0:0 | Class | module_eval | calls.rb:91:5:91:24 | module_eval |
| file://:0:0:0:0 | Class | new | calls.rb:99:5:99:16 | new |
| file://:0:0:0:0 | Class | prepend | calls.rb:93:5:93:20 | prepend |
| file://:0:0:0:0 | Class | private | calls.rb:94:5:94:20 | private |
| file://:0:0:0:0 | Class | puts | calls.rb:87:5:87:17 | puts |
| file://:0:0:0:0 | Complex | new | calls.rb:99:5:99:16 | new |
| file://:0:0:0:0 | Complex | puts | calls.rb:87:5:87:17 | puts |
| file://:0:0:0:0 | FalseClass | new | calls.rb:99:5:99:16 | new |
| file://:0:0:0:0 | FalseClass | puts | calls.rb:87:5:87:17 | puts |
| file://:0:0:0:0 | Float | new | calls.rb:99:5:99:16 | new |
| file://:0:0:0:0 | Float | puts | calls.rb:87:5:87:17 | puts |
| file://:0:0:0:0 | NilClass | new | calls.rb:99:5:99:16 | new |
| file://:0:0:0:0 | NilClass | puts | calls.rb:87:5:87:17 | puts |
| file://:0:0:0:0 | Numeric | new | calls.rb:99:5:99:16 | new |
| file://:0:0:0:0 | Numeric | puts | calls.rb:87:5:87:17 | puts |
| file://:0:0:0:0 | Rational | new | calls.rb:99:5:99:16 | new |
| file://:0:0:0:0 | Rational | puts | calls.rb:87:5:87:17 | puts |
| file://:0:0:0:0 | TrueClass | new | calls.rb:99:5:99:16 | new |
| file://:0:0:0:0 | TrueClass | puts | calls.rb:87:5:87:17 | puts |
| hello.rb:1:1:8:3 | EnglishWords | hello | hello.rb:2:5:4:7 | hello |
| hello.rb:1:1:8:3 | EnglishWords | world | hello.rb:5:5:7:7 | world |
| hello.rb:11:1:16:3 | Greeting | hello | hello.rb:2:5:4:7 | hello |
| hello.rb:11:1:16:3 | Greeting | message | hello.rb:13:5:15:7 | message |
| hello.rb:11:1:16:3 | Greeting | new | calls.rb:99:5:99:16 | new |
| hello.rb:11:1:16:3 | Greeting | puts | calls.rb:87:5:87:17 | puts |
| hello.rb:11:1:16:3 | Greeting | world | hello.rb:5:5:7:7 | world |
| hello.rb:18:1:22:3 | HelloWorld | hello | hello.rb:2:5:4:7 | hello |
| hello.rb:18:1:22:3 | HelloWorld | message | hello.rb:19:5:21:7 | message |
| hello.rb:18:1:22:3 | HelloWorld | new | calls.rb:99:5:99:16 | new |
| hello.rb:18:1:22:3 | HelloWorld | puts | calls.rb:87:5:87:17 | puts |
| hello.rb:18:1:22:3 | HelloWorld | world | hello.rb:5:5:7:7 | world |
| modules.rb:4:1:24:3 | Foo | method_in_another_definition_of_foo | modules.rb:27:3:28:5 | method_in_another_definition_of_foo |
| modules.rb:4:1:24:3 | Foo | method_in_foo | modules.rb:16:3:17:5 | method_in_foo |
| modules.rb:5:3:14:5 | Foo::Bar | method_in_another_definition_of_foo_bar | modules.rb:52:3:53:5 | method_in_another_definition_of_foo_bar |
| modules.rb:5:3:14:5 | Foo::Bar | method_in_foo_bar | modules.rb:9:5:10:7 | method_in_foo_bar |
| modules.rb:6:5:7:7 | Foo::Bar::ClassInFooBar | new | calls.rb:99:5:99:16 | new |
| modules.rb:6:5:7:7 | Foo::Bar::ClassInFooBar | puts | calls.rb:87:5:87:17 | puts |
| modules.rb:19:3:20:5 | Foo::ClassInFoo | new | calls.rb:99:5:99:16 | new |
| modules.rb:19:3:20:5 | Foo::ClassInFoo | puts | calls.rb:87:5:87:17 | puts |
| modules.rb:30:3:31:5 | Foo::ClassInAnotherDefinitionOfFoo | new | calls.rb:99:5:99:16 | new |
| modules.rb:30:3:31:5 | Foo::ClassInAnotherDefinitionOfFoo | puts | calls.rb:87:5:87:17 | puts |
| modules.rb:37:1:46:3 | Bar | method_a | modules.rb:38:3:39:5 | method_a |
| modules.rb:37:1:46:3 | Bar | method_b | modules.rb:41:3:42:5 | method_b |
| modules.rb:37:1:46:3 | Bar | new | calls.rb:99:5:99:16 | new |
| modules.rb:37:1:46:3 | Bar | puts | calls.rb:87:5:87:17 | puts |
| modules.rb:49:3:50:5 | Foo::Bar::ClassInAnotherDefinitionOfFooBar | new | calls.rb:99:5:99:16 | new |
| modules.rb:49:3:50:5 | Foo::Bar::ClassInAnotherDefinitionOfFooBar | puts | calls.rb:87:5:87:17 | puts |
| modules.rb:66:5:67:7 | Test::Foo1::Bar | new | calls.rb:99:5:99:16 | new |
| modules.rb:66:5:67:7 | Test::Foo1::Bar | puts | calls.rb:87:5:87:17 | puts |
| modules.rb:72:5:73:7 | Test::Foo2::Foo2::Bar | new | calls.rb:99:5:99:16 | new |
| modules.rb:72:5:73:7 | Test::Foo2::Foo2::Bar | puts | calls.rb:87:5:87:17 | puts |
| modules.rb:112:1:113:3 | YY | new | calls.rb:99:5:99:16 | new |
| modules.rb:112:1:113:3 | YY | puts | calls.rb:87:5:87:17 | puts |
| modules.rb:116:7:117:9 | XX::YY | new | calls.rb:99:5:99:16 | new |
| modules.rb:116:7:117:9 | XX::YY | puts | calls.rb:87:5:87:17 | puts |
| private.rb:1:1:19:3 | C | baz | calls.rb:37:5:43:7 | baz |
| private.rb:1:1:19:3 | C | call_block | calls.rb:67:1:69:3 | call_block |
| private.rb:1:1:19:3 | C | foo | calls.rb:1:1:3:3 | foo |
| private.rb:1:1:19:3 | C | foo | calls.rb:71:1:75:3 | foo |
| private.rb:1:1:19:3 | C | funny | calls.rb:119:1:121:3 | funny |
| private.rb:1:1:19:3 | C | indirect | calls.rb:137:1:139:3 | indirect |
| private.rb:1:1:19:3 | C | instance_m | calls.rb:16:5:16:23 | instance_m |
| private.rb:1:1:19:3 | C | new | calls.rb:99:5:99:16 | new |
| private.rb:1:1:19:3 | C | optional_arg | calls.rb:62:1:65:3 | optional_arg |
| private.rb:1:1:19:3 | C | private2 | private.rb:8:3:9:5 | private2 |
| private.rb:1:1:19:3 | C | private3 | private.rb:14:3:15:5 | private3 |
| private.rb:1:1:19:3 | C | private4 | private.rb:17:3:18:5 | private4 |
| private.rb:1:1:19:3 | C | private_on_main | calls.rb:164:1:165:3 | private_on_main |
| private.rb:1:1:19:3 | C | private_on_main | private.rb:21:1:22:3 | private_on_main |
| private.rb:1:1:19:3 | C | public | private.rb:5:3:6:5 | public |
| private.rb:1:1:19:3 | C | puts | calls.rb:87:5:87:17 | puts |

View File

@@ -0,0 +1,8 @@
import ruby
import codeql.ruby.ast.internal.Module as M
query MethodBase getMethod(Module m, string name) {
result = M::ExposedForTestingOnly::getMethod(m, name)
}
query MethodBase lookupMethod(Module m, string name) { result = M::lookupMethod(m, name) }

View File

@@ -0,0 +1,152 @@
getModule
| calls.rb:15:1:24:3 | M |
| calls.rb:51:1:55:3 | D |
| calls.rb:77:1:80:3 | Integer |
| calls.rb:82:1:84:3 | String |
| calls.rb:86:1:88:3 | Kernel |
| calls.rb:90:1:95:3 | Module |
| calls.rb:97:1:100:3 | Object |
| calls.rb:102:1:104:3 | Hash |
| calls.rb:106:1:117:3 | Array |
| calls.rb:144:1:148:3 | S |
| calls.rb:150:1:153:3 | A |
| calls.rb:155:1:158:3 | B |
| file://:0:0:0:0 | BasicObject |
| file://:0:0:0:0 | Class |
| file://:0:0:0:0 | Complex |
| file://:0:0:0:0 | FalseClass |
| file://:0:0:0:0 | Float |
| file://:0:0:0:0 | NilClass |
| file://:0:0:0:0 | Numeric |
| file://:0:0:0:0 | Proc |
| file://:0:0:0:0 | Rational |
| file://:0:0:0:0 | Symbol |
| file://:0:0:0:0 | TrueClass |
| hello.rb:1:1:8:3 | EnglishWords |
| hello.rb:11:1:16:3 | Greeting |
| hello.rb:18:1:22:3 | HelloWorld |
| modules.rb:1:1:2:3 | Empty |
| modules.rb:4:1:24:3 | Foo |
| modules.rb:5:3:14:5 | Foo::Bar |
| modules.rb:6:5:7:7 | Foo::Bar::ClassInFooBar |
| modules.rb:19:3:20:5 | Foo::ClassInFoo |
| modules.rb:30:3:31:5 | Foo::ClassInAnotherDefinitionOfFoo |
| modules.rb:37:1:46:3 | Bar |
| modules.rb:49:3:50:5 | Foo::Bar::ClassInAnotherDefinitionOfFooBar |
| modules.rb:60:1:61:3 | MyModuleInGlobalScope |
| modules.rb:63:1:81:3 | Test |
| modules.rb:65:3:68:5 | Test::Foo1 |
| modules.rb:66:5:67:7 | Test::Foo1::Bar |
| modules.rb:70:3:74:5 | Test::Foo2 |
| modules.rb:71:5:71:19 | Test::Foo2::Foo2 |
| modules.rb:72:5:73:7 | Test::Foo2::Foo2::Bar |
| modules.rb:76:3:80:5 | Test::Foo3 |
| modules.rb:83:1:86:3 | Other |
| modules.rb:84:3:85:5 | Other::Foo1 |
| modules.rb:88:1:93:3 | IncludeTest |
| modules.rb:91:3:92:5 | Test::Foo1::Y |
| modules.rb:95:1:99:3 | IncludeTest2 |
| modules.rb:97:3:98:5 | Test::Foo1::Z |
| modules.rb:101:1:105:3 | PrependTest |
| modules.rb:103:3:104:5 | Test::Foo2::Y |
| modules.rb:107:1:110:3 | MM |
| modules.rb:108:3:109:5 | MM::MM |
| modules.rb:112:1:113:3 | YY |
| modules.rb:115:1:118:3 | XX |
| modules.rb:116:7:117:9 | XX::YY |
| modules.rb:120:1:121:3 | Test::Foo1::Bar::Baz |
| private.rb:1:1:19:3 | C |
getADeclaration
| calls.rb:15:1:24:3 | M | calls.rb:15:1:24:3 | M |
| calls.rb:51:1:55:3 | D | calls.rb:51:1:55:3 | D |
| calls.rb:77:1:80:3 | Integer | calls.rb:77:1:80:3 | Integer |
| calls.rb:82:1:84:3 | String | calls.rb:82:1:84:3 | String |
| calls.rb:86:1:88:3 | Kernel | calls.rb:86:1:88:3 | Kernel |
| calls.rb:90:1:95:3 | Module | calls.rb:90:1:95:3 | Module |
| calls.rb:97:1:100:3 | Object | calls.rb:1:1:167:16 | calls.rb |
| calls.rb:97:1:100:3 | Object | calls.rb:97:1:100:3 | Object |
| calls.rb:97:1:100:3 | Object | hello.rb:1:1:22:3 | hello.rb |
| calls.rb:97:1:100:3 | Object | modules.rb:1:1:122:1 | modules.rb |
| calls.rb:97:1:100:3 | Object | private.rb:1:1:30:15 | private.rb |
| calls.rb:102:1:104:3 | Hash | calls.rb:102:1:104:3 | Hash |
| calls.rb:106:1:117:3 | Array | calls.rb:106:1:117:3 | Array |
| calls.rb:144:1:148:3 | S | calls.rb:144:1:148:3 | S |
| calls.rb:150:1:153:3 | A | calls.rb:150:1:153:3 | A |
| calls.rb:155:1:158:3 | B | calls.rb:155:1:158:3 | B |
| hello.rb:1:1:8:3 | EnglishWords | hello.rb:1:1:8:3 | EnglishWords |
| hello.rb:11:1:16:3 | Greeting | hello.rb:11:1:16:3 | Greeting |
| hello.rb:18:1:22:3 | HelloWorld | hello.rb:18:1:22:3 | HelloWorld |
| modules.rb:1:1:2:3 | Empty | modules.rb:1:1:2:3 | Empty |
| modules.rb:4:1:24:3 | Foo | modules.rb:4:1:24:3 | Foo |
| modules.rb:4:1:24:3 | Foo | modules.rb:26:1:35:3 | Foo |
| modules.rb:5:3:14:5 | Foo::Bar | modules.rb:5:3:14:5 | Bar |
| modules.rb:5:3:14:5 | Foo::Bar | modules.rb:48:1:57:3 | Bar |
| modules.rb:6:5:7:7 | Foo::Bar::ClassInFooBar | modules.rb:6:5:7:7 | ClassInFooBar |
| modules.rb:19:3:20:5 | Foo::ClassInFoo | modules.rb:19:3:20:5 | ClassInFoo |
| modules.rb:30:3:31:5 | Foo::ClassInAnotherDefinitionOfFoo | modules.rb:30:3:31:5 | ClassInAnotherDefinitionOfFoo |
| modules.rb:37:1:46:3 | Bar | modules.rb:37:1:46:3 | Bar |
| modules.rb:37:1:46:3 | Bar | modules.rb:78:5:79:7 | Bar |
| modules.rb:49:3:50:5 | Foo::Bar::ClassInAnotherDefinitionOfFooBar | modules.rb:49:3:50:5 | ClassInAnotherDefinitionOfFooBar |
| modules.rb:60:1:61:3 | MyModuleInGlobalScope | modules.rb:60:1:61:3 | MyModuleInGlobalScope |
| modules.rb:63:1:81:3 | Test | modules.rb:63:1:81:3 | Test |
| modules.rb:65:3:68:5 | Test::Foo1 | modules.rb:65:3:68:5 | Foo1 |
| modules.rb:66:5:67:7 | Test::Foo1::Bar | modules.rb:66:5:67:7 | Bar |
| modules.rb:70:3:74:5 | Test::Foo2 | modules.rb:70:3:74:5 | Foo2 |
| modules.rb:71:5:71:19 | Test::Foo2::Foo2 | modules.rb:71:5:71:19 | Foo2 |
| modules.rb:72:5:73:7 | Test::Foo2::Foo2::Bar | modules.rb:72:5:73:7 | Bar |
| modules.rb:76:3:80:5 | Test::Foo3 | modules.rb:76:3:80:5 | Foo3 |
| modules.rb:83:1:86:3 | Other | modules.rb:83:1:86:3 | Other |
| modules.rb:84:3:85:5 | Other::Foo1 | modules.rb:84:3:85:5 | Foo1 |
| modules.rb:88:1:93:3 | IncludeTest | modules.rb:88:1:93:3 | IncludeTest |
| modules.rb:91:3:92:5 | Test::Foo1::Y | modules.rb:91:3:92:5 | Y |
| modules.rb:95:1:99:3 | IncludeTest2 | modules.rb:95:1:99:3 | IncludeTest2 |
| modules.rb:97:3:98:5 | Test::Foo1::Z | modules.rb:97:3:98:5 | Z |
| modules.rb:101:1:105:3 | PrependTest | modules.rb:101:1:105:3 | PrependTest |
| modules.rb:103:3:104:5 | Test::Foo2::Y | modules.rb:103:3:104:5 | Y |
| modules.rb:107:1:110:3 | MM | modules.rb:107:1:110:3 | MM |
| modules.rb:108:3:109:5 | MM::MM | modules.rb:108:3:109:5 | MM |
| modules.rb:112:1:113:3 | YY | modules.rb:112:1:113:3 | YY |
| modules.rb:115:1:118:3 | XX | modules.rb:115:1:118:3 | XX |
| modules.rb:116:7:117:9 | XX::YY | modules.rb:116:7:117:9 | YY |
| modules.rb:120:1:121:3 | Test::Foo1::Bar::Baz | modules.rb:120:1:121:3 | Baz |
| private.rb:1:1:19:3 | C | calls.rb:29:1:44:3 | C |
| private.rb:1:1:19:3 | C | private.rb:1:1:19:3 | C |
getSuperClass
| calls.rb:51:1:55:3 | D | private.rb:1:1:19:3 | C |
| calls.rb:77:1:80:3 | Integer | file://:0:0:0:0 | Numeric |
| calls.rb:82:1:84:3 | String | calls.rb:97:1:100:3 | Object |
| calls.rb:90:1:95:3 | Module | calls.rb:97:1:100:3 | Object |
| calls.rb:97:1:100:3 | Object | file://:0:0:0:0 | BasicObject |
| calls.rb:102:1:104:3 | Hash | calls.rb:97:1:100:3 | Object |
| calls.rb:106:1:117:3 | Array | calls.rb:97:1:100:3 | Object |
| calls.rb:144:1:148:3 | S | calls.rb:97:1:100:3 | Object |
| calls.rb:150:1:153:3 | A | calls.rb:144:1:148:3 | S |
| calls.rb:155:1:158:3 | B | calls.rb:144:1:148:3 | S |
| file://:0:0:0:0 | Class | calls.rb:90:1:95:3 | Module |
| file://:0:0:0:0 | Complex | file://:0:0:0:0 | Numeric |
| file://:0:0:0:0 | FalseClass | calls.rb:97:1:100:3 | Object |
| file://:0:0:0:0 | Float | file://:0:0:0:0 | Numeric |
| file://:0:0:0:0 | NilClass | calls.rb:97:1:100:3 | Object |
| file://:0:0:0:0 | Numeric | calls.rb:97:1:100:3 | Object |
| file://:0:0:0:0 | Rational | file://:0:0:0:0 | Numeric |
| file://:0:0:0:0 | TrueClass | calls.rb:97:1:100:3 | Object |
| hello.rb:11:1:16:3 | Greeting | calls.rb:97:1:100:3 | Object |
| hello.rb:18:1:22:3 | HelloWorld | hello.rb:11:1:16:3 | Greeting |
| modules.rb:6:5:7:7 | Foo::Bar::ClassInFooBar | calls.rb:97:1:100:3 | Object |
| modules.rb:19:3:20:5 | Foo::ClassInFoo | calls.rb:97:1:100:3 | Object |
| modules.rb:30:3:31:5 | Foo::ClassInAnotherDefinitionOfFoo | calls.rb:97:1:100:3 | Object |
| modules.rb:37:1:46:3 | Bar | calls.rb:97:1:100:3 | Object |
| modules.rb:49:3:50:5 | Foo::Bar::ClassInAnotherDefinitionOfFooBar | calls.rb:97:1:100:3 | Object |
| modules.rb:66:5:67:7 | Test::Foo1::Bar | calls.rb:97:1:100:3 | Object |
| modules.rb:72:5:73:7 | Test::Foo2::Foo2::Bar | calls.rb:97:1:100:3 | Object |
| modules.rb:112:1:113:3 | YY | calls.rb:97:1:100:3 | Object |
| modules.rb:116:7:117:9 | XX::YY | modules.rb:112:1:113:3 | YY |
| private.rb:1:1:19:3 | C | calls.rb:97:1:100:3 | Object |
getAPrependedModule
| modules.rb:101:1:105:3 | PrependTest | modules.rb:63:1:81:3 | Test |
getAnIncludedModule
| calls.rb:97:1:100:3 | Object | calls.rb:86:1:88:3 | Kernel |
| hello.rb:11:1:16:3 | Greeting | hello.rb:1:1:8:3 | EnglishWords |
| modules.rb:88:1:93:3 | IncludeTest | modules.rb:63:1:81:3 | Test |
| modules.rb:95:1:99:3 | IncludeTest2 | modules.rb:63:1:81:3 | Test |
| private.rb:1:1:19:3 | C | calls.rb:15:1:24:3 | M |

View File

@@ -0,0 +1,11 @@
import ruby
query Module getModule() { any() }
query ModuleBase getADeclaration(Module m) { result = m.getADeclaration() }
query Module getSuperClass(Module m) { result = m.getSuperClass() }
query Module getAPrependedModule(Module m) { result = m.getAPrependedModule() }
query Module getAnIncludedModule(Module m) { result = m.getAnIncludedModule() }

View File

@@ -0,0 +1,122 @@
module Empty
end
module Foo
module Bar
class ClassInFooBar
end
def method_in_foo_bar
end
puts 'module Foo::Bar'
$global_var = 0
end
def method_in_foo
end
class ClassInFoo
end
puts 'module Foo'
$global_var = 1
end
module Foo
def method_in_another_definition_of_foo
end
class ClassInAnotherDefinitionOfFoo
end
puts 'module Foo again'
$global_var = 2
end
module Bar
def method_a
end
def method_b
end
puts 'module Bar'
$global_var = 3
end
module Foo::Bar
class ClassInAnotherDefinitionOfFooBar
end
def method_in_another_definition_of_foo_bar
end
puts 'module Foo::Bar again'
$global_var = 4
end
# a module where the name is a scope resolution using the global scope
module ::MyModuleInGlobalScope
end
module Test
module Foo1
class Foo1::Bar
end
end
module Foo2
module Foo2 end
class Foo2::Bar
end
end
module Foo3
Foo3 = Object
class Foo3::Bar
end
end
end
module Other
module Foo1
end
end
module IncludeTest
include ::Test
Object.module_eval { prepend Other }
module Foo1::Y
end
end
module IncludeTest2
include Test
module Foo1::Z
end
end
module PrependTest
prepend ::Test
module Foo2::Y
end
end
module MM
module MM::MM
end
end
class YY
end
module XX
class YY < YY
end
end
module Test::Foo1::Bar::Baz
end

View File

@@ -0,0 +1,30 @@
class C
private def private1
end
def public
end
def private2
end
private :private2
private
def private3
end
def private4
end
end
def private_on_main
end
C.new.private1
C.new.private2
C.new.private3
C.new.private4
C.new.public
private_on_main

View File

@@ -0,0 +1,148 @@
calls.rb:
# 102| Hash
#-----| -> Object
# 77| Integer
#-----| -> Numeric
# 86| Kernel
# 90| Module
#-----| -> Object
# 97| Object
#-----| -> BasicObject
# 106| Array
#-----| -> Object
#-----| BasicObject
#-----| Class
#-----| -> Module
#-----| Complex
#-----| -> Numeric
#-----| FalseClass
#-----| -> Object
#-----| Float
#-----| -> Numeric
#-----| NilClass
#-----| -> Object
#-----| Numeric
#-----| -> Object
#-----| Proc
#-----| Rational
#-----| -> Numeric
#-----| Symbol
#-----| TrueClass
#-----| -> Object
# 15| M
private.rb:
# 1| C
#-----| -> Object
calls.rb:
# 51| D
#-----| -> C
# 82| String
#-----| -> Object
# 144| S
#-----| -> Object
# 150| A
#-----| -> S
# 155| B
#-----| -> S
hello.rb:
# 1| EnglishWords
# 11| Greeting
#-----| -> Object
# 18| HelloWorld
#-----| -> Greeting
modules.rb:
# 1| Empty
# 4| Foo
# 37| Bar
#-----| -> Object
# 60| MyModuleInGlobalScope
# 63| Test
# 83| Other
# 88| IncludeTest
# 95| IncludeTest2
# 101| PrependTest
# 107| MM
# 112| YY
#-----| -> Object
# 115| XX
# 5| Foo::Bar
# 19| Foo::ClassInFoo
#-----| -> Object
# 30| Foo::ClassInAnotherDefinitionOfFoo
#-----| -> Object
# 116| XX::YY
#-----| -> YY
# 65| Test::Foo1
# 70| Test::Foo2
# 76| Test::Foo3
# 84| Other::Foo1
# 6| Foo::Bar::ClassInFooBar
#-----| -> Object
# 71| Test::Foo2::Foo2
# 108| MM::MM
# 49| Foo::Bar::ClassInAnotherDefinitionOfFooBar
#-----| -> Object
# 66| Test::Foo1::Bar
#-----| -> Object
# 91| Test::Foo1::Y
# 97| Test::Foo1::Z
# 103| Test::Foo2::Y
# 72| Test::Foo2::Foo2::Bar
#-----| -> Object
# 120| Test::Foo1::Bar::Baz

View File

@@ -0,0 +1,12 @@
/**
* @kind graph
* @id rb/test/supertypes
*/
import ruby
query predicate nodes(Module node, string key, string value) {
key = "semmle.label" and value = node.toString()
}
query predicate edges(Module source, Module target) { target = source.getSuperClass() }