mirror of
https://github.com/github/codeql.git
synced 2026-04-28 02:05:14 +02:00
C#: Respect the context when extracting locations for type parameters and tuple typles.
This commit is contained in:
@@ -554,6 +554,18 @@ namespace Semmle.Extraction.CSharp
|
||||
SymbolEqualityComparer.Default.Equals(symbol, symbol.OriginalDefinition) &&
|
||||
scope.InScope(symbol);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the locations of the symbol that are either
|
||||
/// (1) In assemblies.
|
||||
/// (2) In the current context.
|
||||
/// </summary>
|
||||
/// <param name="symbol">The symbol</param>
|
||||
/// <returns>List of locations</returns>
|
||||
public IEnumerable<Entities.Location> GetLocations(ISymbol symbol) =>
|
||||
symbol.Locations
|
||||
.Where(l => !l.IsInSource || IsLocationInContext(l))
|
||||
.Select(CreateLocation);
|
||||
|
||||
public bool IsLocationInContext(Location location) =>
|
||||
location.SourceTree == SourceTree;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user