66 lines
3.5 KiB
C#
66 lines
3.5 KiB
C#
using System;
|
|
using System.Collections.Immutable;
|
|
|
|
namespace Microsoft.CodeAnalysis.CSharp.Symbols;
|
|
|
|
internal sealed class SynthesizedParameterSymbol : SynthesizedParameterSymbolBase
|
|
{
|
|
internal sealed 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 sealed override bool IsMetadataOut => (int)RefKind == 2;
|
|
|
|
public override ImmutableArray<CustomModifier> RefCustomModifiers => ImmutableArray<CustomModifier>.Empty;
|
|
|
|
internal override MarshalPseudoCustomAttributeData? MarshallingInformation => null;
|
|
|
|
internal override bool HasUnscopedRefAttribute => false;
|
|
|
|
private SynthesizedParameterSymbol(Symbol? container, TypeWithAnnotations type, int ordinal, RefKind refKind, ScopedKind scope, string name)
|
|
: 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)
|
|
|
|
|
|
public static ParameterSymbol Create(Symbol? container, TypeWithAnnotations type, int ordinal, RefKind refKind, string name = "", ScopedKind scope = (ScopedKind)0, ConstantValue? defaultValue = null, ImmutableArray<CustomModifier> refCustomModifiers = default(ImmutableArray<CustomModifier>), SourceComplexParameterSymbolBase? baseParameterForAttributes = null, bool isParams = false, bool hasUnscopedRefAttribute = false)
|
|
{
|
|
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
|
|
if (!isParams && refCustomModifiers.IsDefaultOrEmpty && (object)baseParameterForAttributes == null && defaultValue == null && !hasUnscopedRefAttribute)
|
|
{
|
|
return new SynthesizedParameterSymbol(container, type, ordinal, refKind, scope, name);
|
|
}
|
|
return new SynthesizedComplexParameterSymbol(container, type, ordinal, refKind, scope, defaultValue, name, ImmutableArrayExtensions.NullToEmpty<CustomModifier>(refCustomModifiers), baseParameterForAttributes, isParams, hasUnscopedRefAttribute);
|
|
}
|
|
|
|
internal static ImmutableArray<ParameterSymbol> DeriveParameters(MethodSymbol sourceMethod, MethodSymbol destinationMethod)
|
|
{
|
|
return ImmutableArrayExtensions.SelectAsArray<ParameterSymbol, MethodSymbol, ParameterSymbol>(sourceMethod.Parameters, (Func<ParameterSymbol, MethodSymbol, ParameterSymbol>)((ParameterSymbol oldParam, MethodSymbol destination) => DeriveParameter(destination, oldParam)), destinationMethod);
|
|
}
|
|
|
|
internal static ParameterSymbol DeriveParameter(Symbol destination, ParameterSymbol oldParam)
|
|
{
|
|
//IL_000e: 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)
|
|
return Create(destination, oldParam.TypeWithAnnotations, oldParam.Ordinal, oldParam.RefKind, oldParam.Name, oldParam.EffectiveScope, oldParam.ExplicitDefaultConstantValue, oldParam.RefCustomModifiers);
|
|
}
|
|
}
|