50 lines
1.3 KiB
C#
50 lines
1.3 KiB
C#
using Microsoft.CodeAnalysis.Text;
|
|||
|
|
|
||
|
|
namespace Microsoft.CodeAnalysis.CSharp;
|
||
|
|
|
||
|
|
internal readonly struct RegionAnalysisContext
|
||
|
|
{
|
||
|
|
public readonly CSharpCompilation Compilation;
|
||
|
|
|
||
|
|
public readonly Symbol Member;
|
||
|
|
|
||
|
|
public readonly BoundNode BoundNode;
|
||
|
|
|
||
|
|
public readonly BoundNode FirstInRegion;
|
||
|
|
|
||
|
|
public readonly BoundNode LastInRegion;
|
||
|
|
|
||
|
|
public readonly bool Failed;
|
||
|
|
|
||
|
|
public RegionAnalysisContext(CSharpCompilation compilation, Symbol member, BoundNode boundNode, BoundNode firstInRegion, BoundNode lastInRegion)
|
||
|
|
{
|
||
|
|
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
|
||
|
|
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
|
||
|
|
Compilation = compilation;
|
||
|
|
Member = member;
|
||
|
|
BoundNode = boundNode;
|
||
|
|
FirstInRegion = firstInRegion;
|
||
|
|
LastInRegion = lastInRegion;
|
||
|
|
int failed;
|
||
|
|
if (boundNode != null && firstInRegion != null && lastInRegion != null)
|
||
|
|
{
|
||
|
|
int spanStart = firstInRegion.Syntax.SpanStart;
|
||
|
|
TextSpan span = lastInRegion.Syntax.Span;
|
||
|
|
failed = ((spanStart > ((TextSpan)(ref span)).End) ? 1 : 0);
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
failed = 1;
|
||
|
|
}
|
||
|
|
Failed = (byte)failed != 0;
|
||
|
|
if (!Failed && firstInRegion == lastInRegion)
|
||
|
|
{
|
||
|
|
BoundKind kind = firstInRegion.Kind;
|
||
|
|
if (kind == BoundKind.TypeExpression || kind == BoundKind.NamespaceExpression)
|
||
|
|
{
|
||
|
|
Failed = true;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|