mirror of
https://github.com/github/codeql.git
synced 2025-12-17 17:23:36 +01:00
43 lines
1.1 KiB
C#
43 lines
1.1 KiB
C#
using Semmle.Extraction.Kinds;
|
|
using System.Linq;
|
|
using System.IO;
|
|
using Semmle.Extraction.Entities;
|
|
|
|
namespace Semmle.Extraction.CSharp.Entities.Statements
|
|
{
|
|
internal class GlobalStatementsBlock : Statement
|
|
{
|
|
private readonly Method parent;
|
|
|
|
private GlobalStatementsBlock(Context cx, Method parent)
|
|
: base(cx, StmtKind.BLOCK, parent, 0)
|
|
{
|
|
this.parent = parent;
|
|
}
|
|
|
|
public override Microsoft.CodeAnalysis.Location? ReportingLocation
|
|
{
|
|
get
|
|
{
|
|
return parent.Symbol
|
|
?.DeclaringSyntaxReferences
|
|
.FirstOrDefault()
|
|
?.GetSyntax()
|
|
.GetLocation();
|
|
}
|
|
}
|
|
|
|
public static GlobalStatementsBlock Create(Context cx, Method parent)
|
|
{
|
|
var ret = new GlobalStatementsBlock(cx, parent);
|
|
ret.TryPopulate();
|
|
return ret;
|
|
}
|
|
|
|
protected override void PopulateStatement(TextWriter trapFile)
|
|
{
|
|
trapFile.stmt_location(this, Context.CreateLocation(ReportingLocation));
|
|
}
|
|
}
|
|
}
|