251 lines
6.7 KiB
C#
251 lines
6.7 KiB
C#
using System.Collections.Immutable;
|
|||
|
|
using System.Linq;
|
||
|
|
using Roslyn.Utilities;
|
||
|
|
|
||
|
|
namespace Microsoft.CodeAnalysis.CSharp.Symbols;
|
||
|
|
|
||
|
|
internal sealed class SignatureOnlyParameterSymbol : ParameterSymbol
|
||
|
|
{
|
||
|
|
private readonly TypeWithAnnotations _type;
|
||
|
|
|
||
|
|
private readonly ImmutableArray<CustomModifier> _refCustomModifiers;
|
||
|
|
|
||
|
|
private readonly bool _isParams;
|
||
|
|
|
||
|
|
private readonly RefKind _refKind;
|
||
|
|
|
||
|
|
public override TypeWithAnnotations TypeWithAnnotations => _type;
|
||
|
|
|
||
|
|
public override ImmutableArray<CustomModifier> RefCustomModifiers => _refCustomModifiers;
|
||
|
|
|
||
|
|
public override bool IsParams => _isParams;
|
||
|
|
|
||
|
|
public override RefKind RefKind => _refKind;
|
||
|
|
|
||
|
|
public override string Name => "";
|
||
|
|
|
||
|
|
public override bool IsImplicitlyDeclared => true;
|
||
|
|
|
||
|
|
public override bool IsDiscard => false;
|
||
|
|
|
||
|
|
internal override ScopedKind EffectiveScope
|
||
|
|
{
|
||
|
|
get
|
||
|
|
{
|
||
|
|
if (ParameterHelpers.IsRefScopedByDefault(this))
|
||
|
|
{
|
||
|
|
return (ScopedKind)1;
|
||
|
|
}
|
||
|
|
return (ScopedKind)0;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
internal override bool HasUnscopedRefAttribute => false;
|
||
|
|
|
||
|
|
internal override bool UseUpdatedEscapeRules => false;
|
||
|
|
|
||
|
|
internal override bool IsMetadataIn
|
||
|
|
{
|
||
|
|
get
|
||
|
|
{
|
||
|
|
throw ExceptionUtilities.Unreachable("/_/src/Compilers/CSharp/Portable/Symbols/SignatureOnlyParameterSymbol.cs", 60);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
internal override bool IsMetadataOut
|
||
|
|
{
|
||
|
|
get
|
||
|
|
{
|
||
|
|
throw ExceptionUtilities.Unreachable("/_/src/Compilers/CSharp/Portable/Symbols/SignatureOnlyParameterSymbol.cs", 62);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
internal override MarshalPseudoCustomAttributeData MarshallingInformation
|
||
|
|
{
|
||
|
|
get
|
||
|
|
{
|
||
|
|
throw ExceptionUtilities.Unreachable("/_/src/Compilers/CSharp/Portable/Symbols/SignatureOnlyParameterSymbol.cs", 64);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public override int Ordinal
|
||
|
|
{
|
||
|
|
get
|
||
|
|
{
|
||
|
|
throw ExceptionUtilities.Unreachable("/_/src/Compilers/CSharp/Portable/Symbols/SignatureOnlyParameterSymbol.cs", 66);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
internal override bool IsMetadataOptional
|
||
|
|
{
|
||
|
|
get
|
||
|
|
{
|
||
|
|
throw ExceptionUtilities.Unreachable("/_/src/Compilers/CSharp/Portable/Symbols/SignatureOnlyParameterSymbol.cs", 68);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
internal override ConstantValue ExplicitDefaultConstantValue
|
||
|
|
{
|
||
|
|
get
|
||
|
|
{
|
||
|
|
throw ExceptionUtilities.Unreachable("/_/src/Compilers/CSharp/Portable/Symbols/SignatureOnlyParameterSymbol.cs", 70);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
internal override bool IsIDispatchConstant
|
||
|
|
{
|
||
|
|
get
|
||
|
|
{
|
||
|
|
throw ExceptionUtilities.Unreachable("/_/src/Compilers/CSharp/Portable/Symbols/SignatureOnlyParameterSymbol.cs", 72);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
internal override bool IsIUnknownConstant
|
||
|
|
{
|
||
|
|
get
|
||
|
|
{
|
||
|
|
throw ExceptionUtilities.Unreachable("/_/src/Compilers/CSharp/Portable/Symbols/SignatureOnlyParameterSymbol.cs", 74);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
internal override bool IsCallerFilePath
|
||
|
|
{
|
||
|
|
get
|
||
|
|
{
|
||
|
|
throw ExceptionUtilities.Unreachable("/_/src/Compilers/CSharp/Portable/Symbols/SignatureOnlyParameterSymbol.cs", 76);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
internal override bool IsCallerLineNumber
|
||
|
|
{
|
||
|
|
get
|
||
|
|
{
|
||
|
|
throw ExceptionUtilities.Unreachable("/_/src/Compilers/CSharp/Portable/Symbols/SignatureOnlyParameterSymbol.cs", 78);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
internal override bool IsCallerMemberName
|
||
|
|
{
|
||
|
|
get
|
||
|
|
{
|
||
|
|
throw ExceptionUtilities.Unreachable("/_/src/Compilers/CSharp/Portable/Symbols/SignatureOnlyParameterSymbol.cs", 80);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
internal override int CallerArgumentExpressionParameterIndex
|
||
|
|
{
|
||
|
|
get
|
||
|
|
{
|
||
|
|
throw ExceptionUtilities.Unreachable("/_/src/Compilers/CSharp/Portable/Symbols/SignatureOnlyParameterSymbol.cs", 82);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
internal override FlowAnalysisAnnotations FlowAnalysisAnnotations
|
||
|
|
{
|
||
|
|
get
|
||
|
|
{
|
||
|
|
throw ExceptionUtilities.Unreachable("/_/src/Compilers/CSharp/Portable/Symbols/SignatureOnlyParameterSymbol.cs", 84);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
internal override ImmutableHashSet<string> NotNullIfParameterNotNull
|
||
|
|
{
|
||
|
|
get
|
||
|
|
{
|
||
|
|
throw ExceptionUtilities.Unreachable("/_/src/Compilers/CSharp/Portable/Symbols/SignatureOnlyParameterSymbol.cs", 86);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public override Symbol ContainingSymbol
|
||
|
|
{
|
||
|
|
get
|
||
|
|
{
|
||
|
|
throw ExceptionUtilities.Unreachable("/_/src/Compilers/CSharp/Portable/Symbols/SignatureOnlyParameterSymbol.cs", 88);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public override ImmutableArray<Location> Locations
|
||
|
|
{
|
||
|
|
get
|
||
|
|
{
|
||
|
|
throw ExceptionUtilities.Unreachable("/_/src/Compilers/CSharp/Portable/Symbols/SignatureOnlyParameterSymbol.cs", 90);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public override ImmutableArray<SyntaxReference> DeclaringSyntaxReferences
|
||
|
|
{
|
||
|
|
get
|
||
|
|
{
|
||
|
|
throw ExceptionUtilities.Unreachable("/_/src/Compilers/CSharp/Portable/Symbols/SignatureOnlyParameterSymbol.cs", 92);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public override AssemblySymbol ContainingAssembly
|
||
|
|
{
|
||
|
|
get
|
||
|
|
{
|
||
|
|
throw ExceptionUtilities.Unreachable("/_/src/Compilers/CSharp/Portable/Symbols/SignatureOnlyParameterSymbol.cs", 94);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
internal override ModuleSymbol ContainingModule
|
||
|
|
{
|
||
|
|
get
|
||
|
|
{
|
||
|
|
throw ExceptionUtilities.Unreachable("/_/src/Compilers/CSharp/Portable/Symbols/SignatureOnlyParameterSymbol.cs", 96);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
internal override ImmutableArray<int> InterpolatedStringHandlerArgumentIndexes
|
||
|
|
{
|
||
|
|
get
|
||
|
|
{
|
||
|
|
throw ExceptionUtilities.Unreachable("/_/src/Compilers/CSharp/Portable/Symbols/SignatureOnlyParameterSymbol.cs", 98);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
internal override bool HasInterpolatedStringHandlerArgumentError
|
||
|
|
{
|
||
|
|
get
|
||
|
|
{
|
||
|
|
throw ExceptionUtilities.Unreachable("/_/src/Compilers/CSharp/Portable/Symbols/SignatureOnlyParameterSymbol.cs", 100);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public SignatureOnlyParameterSymbol(TypeWithAnnotations type, ImmutableArray<CustomModifier> refCustomModifiers, bool isParams, RefKind refKind)
|
||
|
|
{
|
||
|
|
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
|
||
|
|
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
|
||
|
|
_type = type;
|
||
|
|
_refCustomModifiers = refCustomModifiers;
|
||
|
|
_isParams = isParams;
|
||
|
|
_refKind = refKind;
|
||
|
|
}
|
||
|
|
|
||
|
|
public override bool Equals(Symbol obj, TypeCompareKind compareKind)
|
||
|
|
{
|
||
|
|
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
|
||
|
|
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
|
||
|
|
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
|
||
|
|
if ((object)this == obj)
|
||
|
|
{
|
||
|
|
return true;
|
||
|
|
}
|
||
|
|
if (obj is SignatureOnlyParameterSymbol signatureOnlyParameterSymbol && TypeSymbol.Equals(_type.Type, signatureOnlyParameterSymbol._type.Type, compareKind) && _type.CustomModifiers.Equals(signatureOnlyParameterSymbol._type.CustomModifiers) && _refCustomModifiers.SequenceEqual(signatureOnlyParameterSymbol._refCustomModifiers) && _isParams == signatureOnlyParameterSymbol._isParams)
|
||
|
|
{
|
||
|
|
return _refKind == signatureOnlyParameterSymbol._refKind;
|
||
|
|
}
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
|
||
|
|
public override int GetHashCode()
|
||
|
|
{
|
||
|
|
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
|
||
|
|
//IL_003a: Expected I4, but got Unknown
|
||
|
|
int hashCode = _type.Type.GetHashCode();
|
||
|
|
int num = Hash.CombineValues<CustomModifier>(_type.CustomModifiers, int.MaxValue);
|
||
|
|
bool isParams = _isParams;
|
||
|
|
return Hash.Combine(hashCode, Hash.Combine(num, Hash.Combine(isParams.GetHashCode(), ((int)_refKind).GetHashCode())));
|
||
|
|
}
|
||
|
|
}
|