104 lines
4.5 KiB
C#
104 lines
4.5 KiB
C#
using System.Collections.Immutable;
|
|
|
|
namespace Microsoft.CodeAnalysis.CSharp.Symbols;
|
|
|
|
internal sealed class SynthesizedComplexParameterSymbol : SynthesizedParameterSymbolBase
|
|
{
|
|
private readonly ImmutableArray<CustomModifier> _refCustomModifiers;
|
|
|
|
private readonly SourceComplexParameterSymbolBase? _baseParameterForAttributes;
|
|
|
|
private readonly ConstantValue? _defaultValue;
|
|
|
|
private readonly bool _isParams;
|
|
|
|
private readonly bool _hasUnscopedRefAttribute;
|
|
|
|
public override ImmutableArray<CustomModifier> RefCustomModifiers => _refCustomModifiers;
|
|
|
|
public bool HasEnumeratorCancellationAttribute => _baseParameterForAttributes?.HasEnumeratorCancellationAttribute ?? false;
|
|
|
|
internal override MarshalPseudoCustomAttributeData? MarshallingInformation => _baseParameterForAttributes?.MarshallingInformation;
|
|
|
|
public override bool IsParams => _isParams;
|
|
|
|
internal override bool HasUnscopedRefAttribute => _hasUnscopedRefAttribute;
|
|
|
|
internal override bool IsMetadataOptional => _baseParameterForAttributes?.IsMetadataOptional ?? base.IsMetadataOptional;
|
|
|
|
internal override bool IsCallerLineNumber => _baseParameterForAttributes?.IsCallerLineNumber ?? false;
|
|
|
|
internal override bool IsCallerFilePath => _baseParameterForAttributes?.IsCallerFilePath ?? false;
|
|
|
|
internal override bool IsCallerMemberName => _baseParameterForAttributes?.IsCallerMemberName ?? 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)
|
|
{
|
|
SourceComplexParameterSymbolBase? baseParameterForAttributes = _baseParameterForAttributes;
|
|
if ((object)baseParameterForAttributes == null)
|
|
{
|
|
return false;
|
|
}
|
|
ParameterWellKnownAttributeData decodedWellKnownAttributeData = baseParameterForAttributes.GetDecodedWellKnownAttributeData();
|
|
return ((decodedWellKnownAttributeData != null) ? new bool?(((CommonParameterWellKnownAttributeData)decodedWellKnownAttributeData).HasInAttribute) : ((bool?)null)) == true;
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
|
|
internal override bool IsMetadataOut
|
|
{
|
|
get
|
|
{
|
|
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0007: Invalid comparison between Unknown and I4
|
|
if ((int)RefKind != 2)
|
|
{
|
|
SourceComplexParameterSymbolBase? baseParameterForAttributes = _baseParameterForAttributes;
|
|
if ((object)baseParameterForAttributes == null)
|
|
{
|
|
return false;
|
|
}
|
|
ParameterWellKnownAttributeData decodedWellKnownAttributeData = baseParameterForAttributes.GetDecodedWellKnownAttributeData();
|
|
return ((decodedWellKnownAttributeData != null) ? new bool?(((CommonParameterWellKnownAttributeData)decodedWellKnownAttributeData).HasOutAttribute) : ((bool?)null)) == true;
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
|
|
internal override ConstantValue? ExplicitDefaultConstantValue => _baseParameterForAttributes?.ExplicitDefaultConstantValue ?? _defaultValue;
|
|
|
|
internal override ConstantValue? DefaultValueFromAttributes => _baseParameterForAttributes?.DefaultValueFromAttributes;
|
|
|
|
internal override FlowAnalysisAnnotations FlowAnalysisAnnotations => base.FlowAnalysisAnnotations;
|
|
|
|
internal override ImmutableHashSet<string> NotNullIfParameterNotNull => base.NotNullIfParameterNotNull;
|
|
|
|
public SynthesizedComplexParameterSymbol(Symbol? container, TypeWithAnnotations type, int ordinal, RefKind refKind, ScopedKind scope, ConstantValue? defaultValue, string name, ImmutableArray<CustomModifier> refCustomModifiers, SourceComplexParameterSymbolBase? baseParameterForAttributes, bool isParams, bool hasUnscopedRefAttribute)
|
|
: base(container, type, ordinal, refKind, scope, name)
|
|
{
|
|
//IL_0004: 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)
|
|
_refCustomModifiers = refCustomModifiers;
|
|
_baseParameterForAttributes = baseParameterForAttributes;
|
|
_defaultValue = defaultValue;
|
|
_isParams = isParams;
|
|
_hasUnscopedRefAttribute = hasUnscopedRefAttribute;
|
|
}
|
|
|
|
public override ImmutableArray<CSharpAttributeData> GetAttributes()
|
|
{
|
|
return _baseParameterForAttributes?.GetAttributes() ?? ImmutableArray<CSharpAttributeData>.Empty;
|
|
}
|
|
}
|