mirror of
https://github.com/github/codeql.git
synced 2026-01-08 20:20:34 +01:00
28 lines
763 B
C#
28 lines
763 B
C#
using Microsoft.CodeAnalysis;
|
|
|
|
namespace Semmle.Extraction
|
|
{
|
|
/// <summary>
|
|
/// The scope of symbols in an assembly.
|
|
/// </summary>
|
|
public class AssemblyScope : IExtractionScope
|
|
{
|
|
private readonly IAssemblySymbol assembly;
|
|
private readonly string filepath;
|
|
|
|
public AssemblyScope(IAssemblySymbol symbol, string path)
|
|
{
|
|
assembly = symbol;
|
|
filepath = path;
|
|
}
|
|
|
|
public bool InFileScope(string path) => path == filepath;
|
|
|
|
public bool InScope(ISymbol symbol) =>
|
|
SymbolEqualityComparer.Default.Equals(symbol.ContainingAssembly, assembly) ||
|
|
SymbolEqualityComparer.Default.Equals(symbol, assembly);
|
|
|
|
public bool FromSource => false;
|
|
}
|
|
}
|