File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
ruby/ql/lib/codeql/ruby/ast/internal Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -106,6 +106,15 @@ private module Cached {
106
106
exists ( string qname | qname = resolveConstant ( r ) and result = TResolved ( qname ) )
107
107
}
108
108
109
+ pragma [ nomagic]
110
+ private string constantDefinition1 ( ConstantReadAccess r ) {
111
+ exists ( ConstantWriteAccess w | result = constantDefinition0 ( w ) |
112
+ r = w .getScopeExpr ( )
113
+ or
114
+ r = w .( ClassDeclaration ) .getSuperclassExpr ( )
115
+ )
116
+ }
117
+
109
118
/**
110
119
* Resolve constant access (class, module or otherwise) to a qualified module name.
111
120
* `resolveScopeExpr/1` picks the best (lowest priority number) result of
@@ -121,11 +130,7 @@ private module Cached {
121
130
isDefinedConstant ( qn ) and
122
131
qn = resolveScopeExpr ( r , p ) and
123
132
// prevent classes/modules that contain/extend themselves
124
- not exists ( ConstantWriteAccess w | qn = constantDefinition0 ( w ) |
125
- r = w .getScopeExpr ( )
126
- or
127
- r = w .( ClassDeclaration ) .getSuperclassExpr ( )
128
- )
133
+ not qn = constantDefinition1 ( r )
129
134
|
130
135
qn order by p
131
136
)
You can’t perform that action at this time.
0 commit comments