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 {
106106 exists ( string qname | qname = resolveConstant ( r ) and result = TResolved ( qname ) )
107107 }
108108
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+
109118 /**
110119 * Resolve constant access (class, module or otherwise) to a qualified module name.
111120 * `resolveScopeExpr/1` picks the best (lowest priority number) result of
@@ -121,11 +130,7 @@ private module Cached {
121130 isDefinedConstant ( qn ) and
122131 qn = resolveScopeExpr ( r , p ) and
123132 // 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 )
129134 |
130135 qn order by p
131136 )
You can’t perform that action at this time.
0 commit comments