mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
25 lines
558 B
C#
25 lines
558 B
C#
using System.Linq;
|
|
using Microsoft.CodeAnalysis;
|
|
|
|
|
|
namespace Semmle.Extraction
|
|
{
|
|
|
|
/// <summary>
|
|
/// The scope of symbols in a source file.
|
|
/// </summary>
|
|
public class SourceScope : IExtractionScope
|
|
{
|
|
public SyntaxTree SourceTree { get; }
|
|
|
|
public SourceScope(SyntaxTree tree)
|
|
{
|
|
SourceTree = tree;
|
|
}
|
|
|
|
public bool InFileScope(string path) => path == SourceTree.FilePath;
|
|
|
|
public bool InScope(ISymbol symbol) => symbol.Locations.Any(loc => loc.SourceTree == SourceTree);
|
|
}
|
|
}
|