mirror of
https://github.com/github/codeql.git
synced 2025-12-19 10:23:15 +01:00
31 lines
860 B
C#
31 lines
860 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, bool isOutput)
|
|
{
|
|
assembly = symbol;
|
|
filepath = path;
|
|
IsGlobalScope = isOutput;
|
|
}
|
|
|
|
public bool IsGlobalScope { get; }
|
|
|
|
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;
|
|
}
|
|
}
|