154 lines
5.7 KiB
C#
154 lines
5.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax;
|
|
|
|
namespace Microsoft.CodeAnalysis.CSharp.Syntax;
|
|
|
|
public sealed class FunctionPointerParameterSyntax : BaseParameterSyntax
|
|
{
|
|
private SyntaxNode? attributeLists;
|
|
|
|
private TypeSyntax? type;
|
|
|
|
public override SyntaxList<AttributeListSyntax> AttributeLists => new SyntaxList<AttributeListSyntax>(((SyntaxNode)this).GetRed(ref attributeLists, 0));
|
|
|
|
public override SyntaxTokenList Modifiers
|
|
{
|
|
get
|
|
{
|
|
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
|
|
GreenNode slot = ((SyntaxNode)this).Green.GetSlot(1);
|
|
if (slot == null)
|
|
{
|
|
return default(SyntaxTokenList);
|
|
}
|
|
return new SyntaxTokenList((SyntaxNode)(object)this, slot, ((SyntaxNode)this).GetChildPosition(1), ((SyntaxNode)this).GetChildIndex(1));
|
|
}
|
|
}
|
|
|
|
public override TypeSyntax Type => ((SyntaxNode)this).GetRed<TypeSyntax>(ref type, 2);
|
|
|
|
internal FunctionPointerParameterSyntax(Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position)
|
|
: base(green, parent, position)
|
|
{
|
|
}
|
|
|
|
internal override SyntaxNode? GetNodeSlot(int index)
|
|
{
|
|
return (SyntaxNode?)(index switch
|
|
{
|
|
0 => ((SyntaxNode)this).GetRedAtZero(ref attributeLists),
|
|
2 => ((SyntaxNode)this).GetRed<TypeSyntax>(ref type, 2),
|
|
_ => null,
|
|
});
|
|
}
|
|
|
|
internal override SyntaxNode? GetCachedSlot(int index)
|
|
{
|
|
return (SyntaxNode?)(index switch
|
|
{
|
|
0 => attributeLists,
|
|
2 => type,
|
|
_ => null,
|
|
});
|
|
}
|
|
|
|
public override void Accept(CSharpSyntaxVisitor visitor)
|
|
{
|
|
visitor.VisitFunctionPointerParameter(this);
|
|
}
|
|
|
|
public override TResult? Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor)
|
|
{
|
|
return visitor.VisitFunctionPointerParameter(this);
|
|
}
|
|
|
|
public FunctionPointerParameterSyntax Update(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, TypeSyntax type)
|
|
{
|
|
//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_0025: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
|
|
if (attributeLists != AttributeLists || modifiers != Modifiers || type != Type)
|
|
{
|
|
FunctionPointerParameterSyntax functionPointerParameterSyntax = SyntaxFactory.FunctionPointerParameter(attributeLists, modifiers, type);
|
|
SyntaxAnnotation[] annotations = ((SyntaxNode)this).GetAnnotations();
|
|
if (annotations == null || annotations.Length == 0)
|
|
{
|
|
return functionPointerParameterSyntax;
|
|
}
|
|
return functionPointerParameterSyntax.WithAnnotations(annotations);
|
|
}
|
|
return this;
|
|
}
|
|
|
|
internal override BaseParameterSyntax WithAttributeListsCore(SyntaxList<AttributeListSyntax> attributeLists)
|
|
{
|
|
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
|
|
return WithAttributeLists(attributeLists);
|
|
}
|
|
|
|
public new FunctionPointerParameterSyntax WithAttributeLists(SyntaxList<AttributeListSyntax> attributeLists)
|
|
{
|
|
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
|
|
return Update(attributeLists, Modifiers, Type);
|
|
}
|
|
|
|
internal override BaseParameterSyntax WithModifiersCore(SyntaxTokenList modifiers)
|
|
{
|
|
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
|
|
return WithModifiers(modifiers);
|
|
}
|
|
|
|
public new FunctionPointerParameterSyntax WithModifiers(SyntaxTokenList modifiers)
|
|
{
|
|
//IL_0002: 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)
|
|
return Update(AttributeLists, modifiers, Type);
|
|
}
|
|
|
|
internal override BaseParameterSyntax WithTypeCore(TypeSyntax? type)
|
|
{
|
|
return WithType(type ?? throw new ArgumentNullException("type"));
|
|
}
|
|
|
|
public new FunctionPointerParameterSyntax WithType(TypeSyntax type)
|
|
{
|
|
//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)
|
|
return Update(AttributeLists, Modifiers, type);
|
|
}
|
|
|
|
internal override BaseParameterSyntax AddAttributeListsCore(params AttributeListSyntax[] items)
|
|
{
|
|
return AddAttributeLists(items);
|
|
}
|
|
|
|
public new FunctionPointerParameterSyntax AddAttributeLists(params AttributeListSyntax[] items)
|
|
{
|
|
//IL_0002: 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_000b: Unknown result type (might be due to invalid IL or missing references)
|
|
return WithAttributeLists(AttributeLists.AddRange((IEnumerable<AttributeListSyntax>)items));
|
|
}
|
|
|
|
internal override BaseParameterSyntax AddModifiersCore(params SyntaxToken[] items)
|
|
{
|
|
return AddModifiers(items);
|
|
}
|
|
|
|
public new FunctionPointerParameterSyntax AddModifiers(params SyntaxToken[] items)
|
|
{
|
|
//IL_0002: 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_000b: Unknown result type (might be due to invalid IL or missing references)
|
|
SyntaxTokenList modifiers = Modifiers;
|
|
return WithModifiers(((SyntaxTokenList)(ref modifiers)).AddRange((IEnumerable<SyntaxToken>)items));
|
|
}
|
|
}
|