C#: Streamline the partial implementation for properties and events.

This commit is contained in:
Michael Nebel
2026-02-20 16:32:54 +01:00
parent 03a54bfbf9
commit 003b539287
5 changed files with 17 additions and 21 deletions

View File

@@ -15,8 +15,8 @@ namespace Semmle.Extraction.CSharp.Entities
protected CachedSymbol(Context cx, T init)
: base(cx, init)
{
blockLazy = new Lazy<BlockSyntax?>(() => GetBlock(BodyDeclaringSymbol));
expressionBodyLazy = new Lazy<ExpressionSyntax?>(() => GetExpressionBody(BodyDeclaringSymbol));
blockLazy = new Lazy<BlockSyntax?>(() => GetBlock(Symbol));
expressionBodyLazy = new Lazy<ExpressionSyntax?>(() => GetExpressionBody(Symbol));
}
public virtual Type? ContainingType => Symbol.ContainingType is not null
@@ -92,8 +92,6 @@ namespace Semmle.Extraction.CSharp.Entities
Context.BindComments(this, FullLocation);
}
protected virtual T BodyDeclaringSymbol => Symbol;
private static BlockSyntax? GetBlock(T symbol)
{
return symbol.DeclaringSyntaxReferences