File tree Expand file tree Collapse file tree 3 files changed +19
-0
lines changed
src/queries/modeling/internal Expand file tree Collapse file tree 3 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -173,6 +173,11 @@ class Module extends TModule {
173
173
result .getParentModule ( ) = this and
174
174
result .getOwnModuleName ( ) = name
175
175
}
176
+
177
+ /**
178
+ * Holds if this is a built-in module, e.g. `Object`.
179
+ */
180
+ predicate isBuiltin ( ) { isBuiltinModule ( this ) }
176
181
}
177
182
178
183
/**
Original file line number Diff line number Diff line change @@ -42,6 +42,9 @@ private module Cached {
42
42
result = getAnAssumedGlobalNamespacePrefix ( n )
43
43
}
44
44
45
+ cached
46
+ predicate isBuiltinModule ( Module m ) { m = TResolved ( builtin ( ) ) }
47
+
45
48
cached
46
49
Module getSuperClass ( Module cls ) {
47
50
cls = TResolved ( "Object" ) and result = TResolved ( "BasicObject" )
Original file line number Diff line number Diff line change 6
6
private import ruby
7
7
private import codeql.ruby.ApiGraphs
8
8
private import Util as Util
9
+ private import codeql.ruby.ast.Module
10
+ private import codeql.ruby.ast.internal.Module
9
11
10
12
/**
11
13
* Contains predicates for generating `typeModel`s that contain typing
@@ -42,5 +44,14 @@ module Types {
42
44
valueHasTypeName ( node .getAValueReachingSink ( ) , type1 ) and
43
45
Util:: pathToNode ( node , type2 , path , true )
44
46
)
47
+ or
48
+ // class Type2 < Type1
49
+ // class Type2; include Type1
50
+ // class Type2; extend Type1
51
+ exists ( Module m1 , Module m2 |
52
+ m2 .getAnImmediateAncestor ( ) = m1 and not m2 .isBuiltin ( ) and not m1 .isBuiltin ( )
53
+ |
54
+ m1 .getQualifiedName ( ) = type1 and m2 .getQualifiedName ( ) = type2 and path = ""
55
+ )
45
56
}
46
57
}
You can’t perform that action at this time.
0 commit comments