73 lines
2.2 KiB
C#
73 lines
2.2 KiB
C#
using System;
|
|
using System.Collections.Immutable;
|
|
using System.Threading;
|
|
|
|
namespace Microsoft.CodeAnalysis.CSharp.Symbols.PublicModel;
|
|
|
|
internal sealed class ParameterSymbol : Symbol, IParameterSymbol, ISymbol, IEquatable<ISymbol?>
|
|
{
|
|
private readonly Microsoft.CodeAnalysis.CSharp.Symbols.ParameterSymbol _underlying;
|
|
|
|
private ITypeSymbol _lazyType;
|
|
|
|
internal override Microsoft.CodeAnalysis.CSharp.Symbol UnderlyingSymbol => _underlying;
|
|
|
|
ITypeSymbol IParameterSymbol.Type
|
|
{
|
|
get
|
|
{
|
|
if (_lazyType == null)
|
|
{
|
|
Interlocked.CompareExchange(ref _lazyType, _underlying.TypeWithAnnotations.GetPublicSymbol(), null);
|
|
}
|
|
return _lazyType;
|
|
}
|
|
}
|
|
|
|
NullableAnnotation IParameterSymbol.NullableAnnotation => _underlying.TypeWithAnnotations.ToPublicAnnotation();
|
|
|
|
ImmutableArray<CustomModifier> IParameterSymbol.CustomModifiers => _underlying.TypeWithAnnotations.CustomModifiers;
|
|
|
|
ImmutableArray<CustomModifier> IParameterSymbol.RefCustomModifiers => _underlying.RefCustomModifiers;
|
|
|
|
IParameterSymbol IParameterSymbol.OriginalDefinition => _underlying.OriginalDefinition.GetPublicSymbol();
|
|
|
|
RefKind IParameterSymbol.RefKind => _underlying.RefKind;
|
|
|
|
ScopedKind IParameterSymbol.ScopedKind => _underlying.EffectiveScope;
|
|
|
|
bool IParameterSymbol.IsDiscard => _underlying.IsDiscard;
|
|
|
|
bool IParameterSymbol.IsParams => _underlying.IsParams;
|
|
|
|
bool IParameterSymbol.IsOptional => _underlying.IsOptional;
|
|
|
|
bool IParameterSymbol.IsThis => _underlying.IsThis;
|
|
|
|
int IParameterSymbol.Ordinal => _underlying.Ordinal;
|
|
|
|
bool IParameterSymbol.HasExplicitDefaultValue => _underlying.HasExplicitDefaultValue;
|
|
|
|
object IParameterSymbol.ExplicitDefaultValue => _underlying.ExplicitDefaultValue;
|
|
|
|
public ParameterSymbol(Microsoft.CodeAnalysis.CSharp.Symbols.ParameterSymbol underlying)
|
|
{
|
|
_underlying = underlying;
|
|
}
|
|
|
|
protected override void Accept(SymbolVisitor visitor)
|
|
{
|
|
visitor.VisitParameter((IParameterSymbol)(object)this);
|
|
}
|
|
|
|
protected override TResult Accept<TResult>(SymbolVisitor<TResult> visitor)
|
|
{
|
|
return visitor.VisitParameter((IParameterSymbol)(object)this);
|
|
}
|
|
|
|
protected override TResult Accept<TArgument, TResult>(SymbolVisitor<TArgument, TResult> visitor, TArgument argument)
|
|
{
|
|
return visitor.VisitParameter((IParameterSymbol)(object)this, argument);
|
|
}
|
|
}
|