309 lines
15 KiB
C#
309 lines
15 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax;
|
|
|
|
namespace Microsoft.CodeAnalysis.CSharp.Syntax;
|
|
|
|
public sealed class IndexerDeclarationSyntax : BasePropertyDeclarationSyntax
|
|
{
|
|
private SyntaxNode? attributeLists;
|
|
|
|
private TypeSyntax? type;
|
|
|
|
private ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier;
|
|
|
|
private BracketedParameterListSyntax? parameterList;
|
|
|
|
private AccessorListSyntax? accessorList;
|
|
|
|
private ArrowExpressionClauseSyntax? expressionBody;
|
|
|
|
[EditorBrowsable(EditorBrowsableState.Never)]
|
|
[Obsolete("This member is obsolete.", true)]
|
|
public SyntaxToken Semicolon => SemicolonToken;
|
|
|
|
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);
|
|
|
|
public override ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => ((SyntaxNode)this).GetRed<ExplicitInterfaceSpecifierSyntax>(ref explicitInterfaceSpecifier, 3);
|
|
|
|
public SyntaxToken ThisKeyword => new SyntaxToken((SyntaxNode)(object)this, (GreenNode)(object)((Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.IndexerDeclarationSyntax)(object)((SyntaxNode)this).Green).thisKeyword, ((SyntaxNode)this).GetChildPosition(4), ((SyntaxNode)this).GetChildIndex(4));
|
|
|
|
public BracketedParameterListSyntax ParameterList => ((SyntaxNode)this).GetRed<BracketedParameterListSyntax>(ref parameterList, 5);
|
|
|
|
public override AccessorListSyntax? AccessorList => ((SyntaxNode)this).GetRed<AccessorListSyntax>(ref accessorList, 6);
|
|
|
|
public ArrowExpressionClauseSyntax? ExpressionBody => ((SyntaxNode)this).GetRed<ArrowExpressionClauseSyntax>(ref expressionBody, 7);
|
|
|
|
public SyntaxToken SemicolonToken
|
|
{
|
|
get
|
|
{
|
|
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0016: 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)
|
|
SyntaxToken semicolonToken = ((Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.IndexerDeclarationSyntax)(object)((SyntaxNode)this).Green).semicolonToken;
|
|
if (semicolonToken == null)
|
|
{
|
|
return default(SyntaxToken);
|
|
}
|
|
return new SyntaxToken((SyntaxNode)(object)this, (GreenNode)(object)semicolonToken, ((SyntaxNode)this).GetChildPosition(8), ((SyntaxNode)this).GetChildIndex(8));
|
|
}
|
|
}
|
|
|
|
[EditorBrowsable(EditorBrowsableState.Never)]
|
|
[Obsolete("This member is obsolete.", true)]
|
|
public IndexerDeclarationSyntax WithSemicolon(SyntaxToken semicolon)
|
|
{
|
|
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
|
|
return WithSemicolonToken(semicolon);
|
|
}
|
|
|
|
internal IndexerDeclarationSyntax(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),
|
|
3 => ((SyntaxNode)this).GetRed<ExplicitInterfaceSpecifierSyntax>(ref explicitInterfaceSpecifier, 3),
|
|
5 => ((SyntaxNode)this).GetRed<BracketedParameterListSyntax>(ref parameterList, 5),
|
|
6 => ((SyntaxNode)this).GetRed<AccessorListSyntax>(ref accessorList, 6),
|
|
7 => ((SyntaxNode)this).GetRed<ArrowExpressionClauseSyntax>(ref expressionBody, 7),
|
|
_ => null,
|
|
});
|
|
}
|
|
|
|
internal override SyntaxNode? GetCachedSlot(int index)
|
|
{
|
|
return (SyntaxNode?)(index switch
|
|
{
|
|
0 => attributeLists,
|
|
2 => type,
|
|
3 => explicitInterfaceSpecifier,
|
|
5 => parameterList,
|
|
6 => accessorList,
|
|
7 => expressionBody,
|
|
_ => null,
|
|
});
|
|
}
|
|
|
|
public override void Accept(CSharpSyntaxVisitor visitor)
|
|
{
|
|
visitor.VisitIndexerDeclaration(this);
|
|
}
|
|
|
|
public override TResult? Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor)
|
|
{
|
|
return visitor.VisitIndexerDeclaration(this);
|
|
}
|
|
|
|
public IndexerDeclarationSyntax Update(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken)
|
|
{
|
|
//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_006b: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0078: 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)
|
|
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
|
|
if (attributeLists != AttributeLists || modifiers != Modifiers || type != Type || explicitInterfaceSpecifier != ExplicitInterfaceSpecifier || thisKeyword != ThisKeyword || parameterList != ParameterList || accessorList != AccessorList || expressionBody != ExpressionBody || semicolonToken != SemicolonToken)
|
|
{
|
|
IndexerDeclarationSyntax indexerDeclarationSyntax = SyntaxFactory.IndexerDeclaration(attributeLists, modifiers, type, explicitInterfaceSpecifier, thisKeyword, parameterList, accessorList, expressionBody, semicolonToken);
|
|
SyntaxAnnotation[] annotations = ((SyntaxNode)this).GetAnnotations();
|
|
if (annotations == null || annotations.Length == 0)
|
|
{
|
|
return indexerDeclarationSyntax;
|
|
}
|
|
return indexerDeclarationSyntax.WithAnnotations(annotations);
|
|
}
|
|
return this;
|
|
}
|
|
|
|
internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList<AttributeListSyntax> attributeLists)
|
|
{
|
|
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
|
|
return WithAttributeLists(attributeLists);
|
|
}
|
|
|
|
public new IndexerDeclarationSyntax 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)
|
|
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
|
|
return Update(attributeLists, Modifiers, Type, ExplicitInterfaceSpecifier, ThisKeyword, ParameterList, AccessorList, ExpressionBody, SemicolonToken);
|
|
}
|
|
|
|
internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers)
|
|
{
|
|
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
|
|
return WithModifiers(modifiers);
|
|
}
|
|
|
|
public new IndexerDeclarationSyntax 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)
|
|
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
|
|
return Update(AttributeLists, modifiers, Type, ExplicitInterfaceSpecifier, ThisKeyword, ParameterList, AccessorList, ExpressionBody, SemicolonToken);
|
|
}
|
|
|
|
internal override BasePropertyDeclarationSyntax WithTypeCore(TypeSyntax type)
|
|
{
|
|
return WithType(type);
|
|
}
|
|
|
|
public new IndexerDeclarationSyntax 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)
|
|
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
|
|
return Update(AttributeLists, Modifiers, type, ExplicitInterfaceSpecifier, ThisKeyword, ParameterList, AccessorList, ExpressionBody, SemicolonToken);
|
|
}
|
|
|
|
internal override BasePropertyDeclarationSyntax WithExplicitInterfaceSpecifierCore(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier)
|
|
{
|
|
return WithExplicitInterfaceSpecifier(explicitInterfaceSpecifier);
|
|
}
|
|
|
|
public new IndexerDeclarationSyntax WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier)
|
|
{
|
|
//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)
|
|
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
|
|
return Update(AttributeLists, Modifiers, Type, explicitInterfaceSpecifier, ThisKeyword, ParameterList, AccessorList, ExpressionBody, SemicolonToken);
|
|
}
|
|
|
|
public IndexerDeclarationSyntax WithThisKeyword(SyntaxToken thisKeyword)
|
|
{
|
|
//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)
|
|
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
|
|
return Update(AttributeLists, Modifiers, Type, ExplicitInterfaceSpecifier, thisKeyword, ParameterList, AccessorList, ExpressionBody, SemicolonToken);
|
|
}
|
|
|
|
public IndexerDeclarationSyntax WithParameterList(BracketedParameterListSyntax parameterList)
|
|
{
|
|
//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)
|
|
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
|
|
return Update(AttributeLists, Modifiers, Type, ExplicitInterfaceSpecifier, ThisKeyword, parameterList, AccessorList, ExpressionBody, SemicolonToken);
|
|
}
|
|
|
|
internal override BasePropertyDeclarationSyntax WithAccessorListCore(AccessorListSyntax? accessorList)
|
|
{
|
|
return WithAccessorList(accessorList);
|
|
}
|
|
|
|
public new IndexerDeclarationSyntax WithAccessorList(AccessorListSyntax? accessorList)
|
|
{
|
|
//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)
|
|
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
|
|
return Update(AttributeLists, Modifiers, Type, ExplicitInterfaceSpecifier, ThisKeyword, ParameterList, accessorList, ExpressionBody, SemicolonToken);
|
|
}
|
|
|
|
public IndexerDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody)
|
|
{
|
|
//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)
|
|
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
|
|
return Update(AttributeLists, Modifiers, Type, ExplicitInterfaceSpecifier, ThisKeyword, ParameterList, AccessorList, expressionBody, SemicolonToken);
|
|
}
|
|
|
|
public IndexerDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken)
|
|
{
|
|
//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)
|
|
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
|
|
return Update(AttributeLists, Modifiers, Type, ExplicitInterfaceSpecifier, ThisKeyword, ParameterList, AccessorList, ExpressionBody, semicolonToken);
|
|
}
|
|
|
|
internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items)
|
|
{
|
|
return AddAttributeLists(items);
|
|
}
|
|
|
|
public new IndexerDeclarationSyntax 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 MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items)
|
|
{
|
|
return AddModifiers(items);
|
|
}
|
|
|
|
public new IndexerDeclarationSyntax 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));
|
|
}
|
|
|
|
public IndexerDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items)
|
|
{
|
|
//IL_000d: 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_0016: Unknown result type (might be due to invalid IL or missing references)
|
|
return WithParameterList(ParameterList.WithParameters(ParameterList.Parameters.AddRange((IEnumerable<ParameterSyntax>)items)));
|
|
}
|
|
|
|
internal override BasePropertyDeclarationSyntax AddAccessorListAccessorsCore(params AccessorDeclarationSyntax[] items)
|
|
{
|
|
return AddAccessorListAccessors(items);
|
|
}
|
|
|
|
public new IndexerDeclarationSyntax AddAccessorListAccessors(params AccessorDeclarationSyntax[] items)
|
|
{
|
|
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0021: 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_000c: 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)
|
|
AccessorListSyntax accessorListSyntax = AccessorList ?? SyntaxFactory.AccessorList();
|
|
return WithAccessorList(accessorListSyntax.WithAccessors(accessorListSyntax.Accessors.AddRange((IEnumerable<AccessorDeclarationSyntax>)items)));
|
|
}
|
|
}
|