mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
Rework global statement extraction without DB scheme change
This commit is contained in:
@@ -51,11 +51,6 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
Overrides(trapFile);
|
||||
ExtractRefReturn(trapFile, symbol, this);
|
||||
ExtractCompilerGenerated(trapFile);
|
||||
|
||||
if (SymbolEqualityComparer.Default.Equals(symbol, Context.Compilation.GetEntryPoint(System.Threading.CancellationToken.None)))
|
||||
{
|
||||
trapFile.entry_methods(this);
|
||||
}
|
||||
}
|
||||
|
||||
public static new OrdinaryMethod Create(Context cx, IMethodSymbol method) => OrdinaryMethodFactory.Instance.CreateEntityFromSymbol(cx, method);
|
||||
|
||||
@@ -7,16 +7,19 @@ 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) { }
|
||||
: base(cx, StmtKind.BLOCK, parent, 0)
|
||||
{
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public override Microsoft.CodeAnalysis.Location ReportingLocation
|
||||
{
|
||||
get
|
||||
{
|
||||
// We only create a `GlobalStatementsBlock` if there are global statements. This also means that the
|
||||
// entry point is going to be the generated method around those global statements
|
||||
return cx.Compilation.GetEntryPoint(System.Threading.CancellationToken.None)
|
||||
return parent.symbol
|
||||
?.DeclaringSyntaxReferences
|
||||
.FirstOrDefault()
|
||||
?.GetSyntax()
|
||||
@@ -33,8 +36,6 @@ namespace Semmle.Extraction.CSharp.Entities.Statements
|
||||
|
||||
protected override void PopulateStatement(TextWriter trapFile)
|
||||
{
|
||||
trapFile.global_stmt_block(this);
|
||||
|
||||
trapFile.stmt_location(this, cx.CreateLocation(ReportingLocation));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user