301 lines
15 KiB
C#
301 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 PropertyDeclarationSyntax : BasePropertyDeclarationSyntax
|
|
{
|
|
private SyntaxNode? attributeLists;
|
|
|
|
private TypeSyntax? type;
|
|
|
|
private ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier;
|
|
|
|
private AccessorListSyntax? accessorList;
|
|
|
|
private ArrowExpressionClauseSyntax? expressionBody;
|
|
|
|
private EqualsValueClauseSyntax? initializer;
|
|
|
|
[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 Identifier => new SyntaxToken((SyntaxNode)(object)this, (GreenNode)(object)((Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.PropertyDeclarationSyntax)(object)((SyntaxNode)this).Green).identifier, ((SyntaxNode)this).GetChildPosition(4), ((SyntaxNode)this).GetChildIndex(4));
|
|
|
|
public override AccessorListSyntax? AccessorList => ((SyntaxNode)this).GetRed<AccessorListSyntax>(ref accessorList, 5);
|
|
|
|
public ArrowExpressionClauseSyntax? ExpressionBody => ((SyntaxNode)this).GetRed<ArrowExpressionClauseSyntax>(ref expressionBody, 6);
|
|
|
|
public EqualsValueClauseSyntax? Initializer => ((SyntaxNode)this).GetRed<EqualsValueClauseSyntax>(ref initializer, 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.PropertyDeclarationSyntax)(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 PropertyDeclarationSyntax WithSemicolon(SyntaxToken semicolon)
|
|
{
|
|
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
|
|
return WithSemicolonToken(semicolon);
|
|
}
|
|
|
|
internal PropertyDeclarationSyntax(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<AccessorListSyntax>(ref accessorList, 5),
|
|
6 => ((SyntaxNode)this).GetRed<ArrowExpressionClauseSyntax>(ref expressionBody, 6),
|
|
7 => ((SyntaxNode)this).GetRed<EqualsValueClauseSyntax>(ref initializer, 7),
|
|
_ => null,
|
|
});
|
|
}
|
|
|
|
internal override SyntaxNode? GetCachedSlot(int index)
|
|
{
|
|
return (SyntaxNode?)(index switch
|
|
{
|
|
0 => attributeLists,
|
|
2 => type,
|
|
3 => explicitInterfaceSpecifier,
|
|
5 => accessorList,
|
|
6 => expressionBody,
|
|
7 => initializer,
|
|
_ => null,
|
|
});
|
|
}
|
|
|
|
public override void Accept(CSharpSyntaxVisitor visitor)
|
|
{
|
|
visitor.VisitPropertyDeclaration(this);
|
|
}
|
|
|
|
public override TResult? Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor)
|
|
{
|
|
return visitor.VisitPropertyDeclaration(this);
|
|
}
|
|
|
|
public PropertyDeclarationSyntax Update(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer, 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 || identifier != Identifier || accessorList != AccessorList || expressionBody != ExpressionBody || initializer != Initializer || semicolonToken != SemicolonToken)
|
|
{
|
|
PropertyDeclarationSyntax propertyDeclarationSyntax = SyntaxFactory.PropertyDeclaration(attributeLists, modifiers, type, explicitInterfaceSpecifier, identifier, accessorList, expressionBody, initializer, semicolonToken);
|
|
SyntaxAnnotation[] annotations = ((SyntaxNode)this).GetAnnotations();
|
|
if (annotations == null || annotations.Length == 0)
|
|
{
|
|
return propertyDeclarationSyntax;
|
|
}
|
|
return propertyDeclarationSyntax.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 PropertyDeclarationSyntax 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, Identifier, AccessorList, ExpressionBody, Initializer, 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 PropertyDeclarationSyntax 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, Identifier, AccessorList, ExpressionBody, Initializer, SemicolonToken);
|
|
}
|
|
|
|
internal override BasePropertyDeclarationSyntax WithTypeCore(TypeSyntax type)
|
|
{
|
|
return WithType(type);
|
|
}
|
|
|
|
public new PropertyDeclarationSyntax 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, Identifier, AccessorList, ExpressionBody, Initializer, SemicolonToken);
|
|
}
|
|
|
|
internal override BasePropertyDeclarationSyntax WithExplicitInterfaceSpecifierCore(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier)
|
|
{
|
|
return WithExplicitInterfaceSpecifier(explicitInterfaceSpecifier);
|
|
}
|
|
|
|
public new PropertyDeclarationSyntax 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, Identifier, AccessorList, ExpressionBody, Initializer, SemicolonToken);
|
|
}
|
|
|
|
public PropertyDeclarationSyntax WithIdentifier(SyntaxToken identifier)
|
|
{
|
|
//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, identifier, AccessorList, ExpressionBody, Initializer, SemicolonToken);
|
|
}
|
|
|
|
internal override BasePropertyDeclarationSyntax WithAccessorListCore(AccessorListSyntax? accessorList)
|
|
{
|
|
return WithAccessorList(accessorList);
|
|
}
|
|
|
|
public new PropertyDeclarationSyntax 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, Identifier, accessorList, ExpressionBody, Initializer, SemicolonToken);
|
|
}
|
|
|
|
public PropertyDeclarationSyntax 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, Identifier, AccessorList, expressionBody, Initializer, SemicolonToken);
|
|
}
|
|
|
|
public PropertyDeclarationSyntax WithInitializer(EqualsValueClauseSyntax? initializer)
|
|
{
|
|
//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, Identifier, AccessorList, ExpressionBody, initializer, SemicolonToken);
|
|
}
|
|
|
|
public PropertyDeclarationSyntax 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, Identifier, AccessorList, ExpressionBody, Initializer, semicolonToken);
|
|
}
|
|
|
|
internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items)
|
|
{
|
|
return AddAttributeLists(items);
|
|
}
|
|
|
|
public new PropertyDeclarationSyntax 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 PropertyDeclarationSyntax 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));
|
|
}
|
|
|
|
internal override BasePropertyDeclarationSyntax AddAccessorListAccessorsCore(params AccessorDeclarationSyntax[] items)
|
|
{
|
|
return AddAccessorListAccessors(items);
|
|
}
|
|
|
|
public new PropertyDeclarationSyntax 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)));
|
|
}
|
|
}
|