Skip to content

Commit d35a501

Browse files
authored
Merge pull request github#5583 from lcartey/cs/restrict-jump-to-def
C#: Exclude jump-to-def information for elements with too many locations
2 parents 310a2c8 + 480ce39 commit d35a501

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

csharp/ql/src/definitions.qll

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,5 +187,11 @@ cached
187187
Declaration definitionOf(Use use, string kind) {
188188
result = use.getDefinition() and
189189
result.fromSource() and
190-
kind = use.getUseType()
190+
kind = use.getUseType() and
191+
// Some entities have many locations. This can arise for files that
192+
// are duplicated multiple times in the database at different
193+
// locations. Rather than letting the result set explode, we just
194+
// exclude results that are "too ambiguous" -- we could also arbitrarily
195+
// pick one location later on.
196+
strictcount(result.getLocation()) < 10
191197
}

0 commit comments

Comments
 (0)