107 lines
2.8 KiB
C#
107 lines
2.8 KiB
C#
using Microsoft.CodeAnalysis.CSharp.Symbols;
|
|
|
|
namespace Microsoft.CodeAnalysis.CSharp;
|
|
|
|
internal readonly struct MethodGroupResolution
|
|
{
|
|
public readonly MethodGroup MethodGroup;
|
|
|
|
public readonly Symbol OtherSymbol;
|
|
|
|
public readonly OverloadResolutionResult<MethodSymbol> OverloadResolutionResult;
|
|
|
|
public readonly AnalyzedArguments AnalyzedArguments;
|
|
|
|
public readonly ImmutableBindingDiagnostic<AssemblySymbol> Diagnostics;
|
|
|
|
public readonly LookupResultKind ResultKind;
|
|
|
|
public bool IsEmpty
|
|
{
|
|
get
|
|
{
|
|
if (MethodGroup == null)
|
|
{
|
|
return (object)OtherSymbol == null;
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public bool HasAnyErrors => ImmutableArrayExtensions.HasAnyErrors<Diagnostic>(Diagnostics.Diagnostics);
|
|
|
|
public bool HasAnyApplicableMethod
|
|
{
|
|
get
|
|
{
|
|
if (MethodGroup != null && ResultKind == LookupResultKind.Viable)
|
|
{
|
|
if (OverloadResolutionResult != null)
|
|
{
|
|
return OverloadResolutionResult.HasAnyApplicableMember;
|
|
}
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public bool IsExtensionMethodGroup
|
|
{
|
|
get
|
|
{
|
|
if (MethodGroup != null)
|
|
{
|
|
return MethodGroup.IsExtensionMethodGroup;
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public bool IsLocalFunctionInvocation
|
|
{
|
|
get
|
|
{
|
|
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0034: Invalid comparison between Unknown and I4
|
|
MethodGroup methodGroup = MethodGroup;
|
|
if (methodGroup != null && methodGroup.Methods.Count == 1)
|
|
{
|
|
return (int)MethodGroup.Methods[0].MethodKind == 17;
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public MethodGroupResolution(MethodGroup methodGroup, ImmutableBindingDiagnostic<AssemblySymbol> diagnostics)
|
|
: this(methodGroup, null, null, null, methodGroup.ResultKind, diagnostics)
|
|
{
|
|
}//IL_000b: Unknown result type (might be due to invalid IL or missing references)
|
|
|
|
|
|
public MethodGroupResolution(Symbol otherSymbol, LookupResultKind resultKind, ImmutableBindingDiagnostic<AssemblySymbol> diagnostics)
|
|
: this(null, otherSymbol, null, null, resultKind, diagnostics)
|
|
{
|
|
}//IL_0006: Unknown result type (might be due to invalid IL or missing references)
|
|
|
|
|
|
public MethodGroupResolution(MethodGroup methodGroup, Symbol otherSymbol, OverloadResolutionResult<MethodSymbol> overloadResolutionResult, AnalyzedArguments analyzedArguments, LookupResultKind resultKind, ImmutableBindingDiagnostic<AssemblySymbol> diagnostics)
|
|
{
|
|
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
|
|
MethodGroup = methodGroup;
|
|
OtherSymbol = otherSymbol;
|
|
OverloadResolutionResult = overloadResolutionResult;
|
|
AnalyzedArguments = analyzedArguments;
|
|
ResultKind = resultKind;
|
|
Diagnostics = diagnostics;
|
|
}
|
|
|
|
public void Free()
|
|
{
|
|
AnalyzedArguments?.Free();
|
|
MethodGroup?.Free();
|
|
OverloadResolutionResult?.Free();
|
|
}
|
|
}
|