File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
ruby/ql/src/queries/analysis Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -65,17 +65,19 @@ newtype DefLoc =
6565 not exists ( MethodBase m | m .getAChild + ( ) = write )
6666 }
6767
68+ pragma [ noinline]
69+ ConstantWriteAccess definitionOf0 ( string fqn ) {
70+ fqn = resolveConstant ( _) and
71+ result =
72+ min ( ConstantWriteAccess w | w .getQualifiedName ( ) = fqn | w order by w .getLocation ( ) .toString ( ) )
73+ }
74+
6875/**
6976 * Gets the constant write that defines the given constant.
7077 * Modules often don't have a unique definition, as they are opened multiple times in different
7178 * files. In these cases we arbitrarily pick the definition with the lexicographically least
7279 * location.
7380 */
7481ConstantWriteAccess definitionOf ( ConstantReadAccess r ) {
75- result =
76- min ( ConstantWriteAccess w |
77- w .getQualifiedName ( ) = resolveConstant ( r )
78- |
79- w order by w .getLocation ( ) .toString ( )
80- )
82+ result = definitionOf0 ( resolveConstant ( r ) )
8183}
You can’t perform that action at this time.
0 commit comments