Files
2026-08-27 10:56:38 -06:00

156 lines
5.3 KiB
C#

using System.Collections.Immutable;
using System.Linq;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.CSharp.Symbols;
internal sealed class FunctionPointerParameterSymbol : ParameterSymbol
{
private readonly FunctionPointerMethodSymbol _containingSymbol;
public override TypeWithAnnotations TypeWithAnnotations { get; }
public override RefKind RefKind { get; }
public override int Ordinal { get; }
public override Symbol ContainingSymbol => _containingSymbol;
public override ImmutableArray<CustomModifier> RefCustomModifiers { get; }
internal override ScopedKind EffectiveScope
{
get
{
if (ParameterHelpers.IsRefScopedByDefault(this))
{
return (ScopedKind)1;
}
return (ScopedKind)0;
}
}
internal override bool HasUnscopedRefAttribute => false;
internal override bool UseUpdatedEscapeRules => _containingSymbol.UseUpdatedEscapeRules;
public override ImmutableArray<Location> Locations => ImmutableArray<Location>.Empty;
public override ImmutableArray<SyntaxReference> DeclaringSyntaxReferences => ImmutableArray<SyntaxReference>.Empty;
public override bool IsDiscard => false;
public override bool IsParams => false;
public override bool IsImplicitlyDeclared => true;
internal override MarshalPseudoCustomAttributeData? MarshallingInformation => null;
internal override bool IsMetadataOptional => false;
internal override bool IsMetadataIn
{
get
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Invalid comparison between Unknown and I4
RefKind refKind = RefKind;
if (refKind - 3 <= 1)
{
return true;
}
return false;
}
}
internal override bool IsMetadataOut => (int)RefKind == 2;
internal override ConstantValue? ExplicitDefaultConstantValue => null;
internal override bool IsIDispatchConstant => false;
internal override bool IsIUnknownConstant => false;
internal override bool IsCallerFilePath => false;
internal override bool IsCallerLineNumber => false;
internal override bool IsCallerMemberName => false;
internal override int CallerArgumentExpressionParameterIndex => -1;
internal override FlowAnalysisAnnotations FlowAnalysisAnnotations => FlowAnalysisAnnotations.None;
internal override ImmutableHashSet<string> NotNullIfParameterNotNull => ImmutableHashSet<string>.Empty;
internal override ImmutableArray<int> InterpolatedStringHandlerArgumentIndexes => ImmutableArray<int>.Empty;
internal override bool HasInterpolatedStringHandlerArgumentError => false;
public FunctionPointerParameterSymbol(TypeWithAnnotations typeWithAnnotations, RefKind refKind, int ordinal, FunctionPointerMethodSymbol containingSymbol, ImmutableArray<CustomModifier> refCustomModifiers)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
TypeWithAnnotations = typeWithAnnotations;
RefKind = refKind;
Ordinal = ordinal;
_containingSymbol = containingSymbol;
RefCustomModifiers = refCustomModifiers;
}
public override bool Equals(Symbol other, TypeCompareKind compareKind)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
if ((object)this == other)
{
return true;
}
if (!(other is FunctionPointerParameterSymbol other2))
{
return false;
}
return Equals(other2, compareKind);
}
internal bool Equals(FunctionPointerParameterSymbol other, TypeCompareKind compareKind)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
if (other.Ordinal == Ordinal)
{
return _containingSymbol.Equals(other._containingSymbol, compareKind);
}
return false;
}
internal bool MethodEqualityChecks(FunctionPointerParameterSymbol other, TypeCompareKind compareKind)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
if (FunctionPointerTypeSymbol.RefKindEquals(compareKind, RefKind, other.RefKind) && ((compareKind & 1) != 0 || RefCustomModifiers.SequenceEqual(other.RefCustomModifiers)))
{
return TypeWithAnnotations.Equals(other.TypeWithAnnotations, compareKind);
}
return false;
}
public override int GetHashCode()
{
return Hash.Combine(_containingSymbol.GetHashCode(), Ordinal + 1);
}
internal int MethodHashCode()
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Expected I4, but got Unknown
return Hash.Combine(TypeWithAnnotations.GetHashCode(), ((int)FunctionPointerTypeSymbol.GetRefKindForHashCode(RefKind)).GetHashCode());
}
}