Files
2026-08-27 10:56:38 -06:00

327 lines
13 KiB
C#

using System;
using System.Collections.Generic;
using Microsoft.CodeAnalysis.Syntax.InternalSyntax;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax;
internal sealed class PropertyDeclarationSyntax : BasePropertyDeclarationSyntax
{
internal readonly GreenNode? attributeLists;
internal readonly GreenNode? modifiers;
internal readonly TypeSyntax type;
internal readonly ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier;
internal readonly SyntaxToken identifier;
internal readonly AccessorListSyntax? accessorList;
internal readonly ArrowExpressionClauseSyntax? expressionBody;
internal readonly EqualsValueClauseSyntax? initializer;
internal readonly SyntaxToken? semicolonToken;
public override SyntaxList<AttributeListSyntax> AttributeLists => new SyntaxList<AttributeListSyntax>(attributeLists);
public override SyntaxList<SyntaxToken> Modifiers => new SyntaxList<SyntaxToken>(modifiers);
public override TypeSyntax Type => type;
public override ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => explicitInterfaceSpecifier;
public SyntaxToken Identifier => identifier;
public override AccessorListSyntax? AccessorList => accessorList;
public ArrowExpressionClauseSyntax? ExpressionBody => expressionBody;
public EqualsValueClauseSyntax? Initializer => initializer;
public SyntaxToken? SemicolonToken => semicolonToken;
internal PropertyDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
((GreenNode)this).SlotCount = 9;
if (attributeLists != null)
{
((GreenNode)this).AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
((GreenNode)this).AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)type);
this.type = type;
if (explicitInterfaceSpecifier != null)
{
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)explicitInterfaceSpecifier);
this.explicitInterfaceSpecifier = explicitInterfaceSpecifier;
}
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)identifier);
this.identifier = identifier;
if (accessorList != null)
{
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)accessorList);
this.accessorList = accessorList;
}
if (expressionBody != null)
{
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)expressionBody);
this.expressionBody = expressionBody;
}
if (initializer != null)
{
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)initializer);
this.initializer = initializer;
}
if (semicolonToken != null)
{
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal PropertyDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer, SyntaxToken? semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
SetFactoryContext(context);
((GreenNode)this).SlotCount = 9;
if (attributeLists != null)
{
((GreenNode)this).AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
((GreenNode)this).AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)type);
this.type = type;
if (explicitInterfaceSpecifier != null)
{
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)explicitInterfaceSpecifier);
this.explicitInterfaceSpecifier = explicitInterfaceSpecifier;
}
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)identifier);
this.identifier = identifier;
if (accessorList != null)
{
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)accessorList);
this.accessorList = accessorList;
}
if (expressionBody != null)
{
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)expressionBody);
this.expressionBody = expressionBody;
}
if (initializer != null)
{
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)initializer);
this.initializer = initializer;
}
if (semicolonToken != null)
{
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal PropertyDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer, SyntaxToken? semicolonToken)
: base(kind)
{
((GreenNode)this).SlotCount = 9;
if (attributeLists != null)
{
((GreenNode)this).AdjustFlagsAndWidth(attributeLists);
this.attributeLists = attributeLists;
}
if (modifiers != null)
{
((GreenNode)this).AdjustFlagsAndWidth(modifiers);
this.modifiers = modifiers;
}
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)type);
this.type = type;
if (explicitInterfaceSpecifier != null)
{
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)explicitInterfaceSpecifier);
this.explicitInterfaceSpecifier = explicitInterfaceSpecifier;
}
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)identifier);
this.identifier = identifier;
if (accessorList != null)
{
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)accessorList);
this.accessorList = accessorList;
}
if (expressionBody != null)
{
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)expressionBody);
this.expressionBody = expressionBody;
}
if (initializer != null)
{
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)initializer);
this.initializer = initializer;
}
if (semicolonToken != null)
{
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)semicolonToken);
this.semicolonToken = semicolonToken;
}
}
internal override GreenNode? GetSlot(int index)
{
return (GreenNode?)(index switch
{
0 => attributeLists,
1 => modifiers,
2 => type,
3 => explicitInterfaceSpecifier,
4 => identifier,
5 => accessorList,
6 => expressionBody,
7 => initializer,
8 => semicolonToken,
_ => null,
});
}
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position)
{
return (SyntaxNode)(object)new Microsoft.CodeAnalysis.CSharp.Syntax.PropertyDeclarationSyntax(this, parent, position);
}
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, SyntaxList<SyntaxToken> 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_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: 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 || 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);
DiagnosticInfo[] diagnostics = ((GreenNode)this).GetDiagnostics();
if (diagnostics != null && diagnostics.Length != 0)
{
propertyDeclarationSyntax = GreenNodeExtensions.WithDiagnosticsGreen<PropertyDeclarationSyntax>(propertyDeclarationSyntax, diagnostics);
}
SyntaxAnnotation[] annotations = ((GreenNode)this).GetAnnotations();
if (annotations != null && annotations.Length != 0)
{
propertyDeclarationSyntax = GreenNodeExtensions.WithAnnotationsGreen<PropertyDeclarationSyntax>(propertyDeclarationSyntax, (IEnumerable<SyntaxAnnotation>)annotations);
}
return propertyDeclarationSyntax;
}
return this;
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
{
return (GreenNode)(object)new PropertyDeclarationSyntax(base.Kind, attributeLists, modifiers, type, explicitInterfaceSpecifier, identifier, accessorList, expressionBody, initializer, semicolonToken, diagnostics, ((GreenNode)this).GetAnnotations());
}
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
{
return (GreenNode)(object)new PropertyDeclarationSyntax(base.Kind, attributeLists, modifiers, type, explicitInterfaceSpecifier, identifier, accessorList, expressionBody, initializer, semicolonToken, ((GreenNode)this).GetDiagnostics(), annotations);
}
internal PropertyDeclarationSyntax(ObjectReader reader)
: base(reader)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Expected O, but got Unknown
((GreenNode)this).SlotCount = 9;
GreenNode val = (GreenNode)reader.ReadValue();
if (val != null)
{
((GreenNode)this).AdjustFlagsAndWidth(val);
attributeLists = val;
}
GreenNode val2 = (GreenNode)reader.ReadValue();
if (val2 != null)
{
((GreenNode)this).AdjustFlagsAndWidth(val2);
modifiers = val2;
}
TypeSyntax typeSyntax = (TypeSyntax)reader.ReadValue();
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)typeSyntax);
type = typeSyntax;
ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifierSyntax = (ExplicitInterfaceSpecifierSyntax)reader.ReadValue();
if (explicitInterfaceSpecifierSyntax != null)
{
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)explicitInterfaceSpecifierSyntax);
explicitInterfaceSpecifier = explicitInterfaceSpecifierSyntax;
}
SyntaxToken syntaxToken = (SyntaxToken)reader.ReadValue();
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)syntaxToken);
identifier = syntaxToken;
AccessorListSyntax accessorListSyntax = (AccessorListSyntax)reader.ReadValue();
if (accessorListSyntax != null)
{
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)accessorListSyntax);
accessorList = accessorListSyntax;
}
ArrowExpressionClauseSyntax arrowExpressionClauseSyntax = (ArrowExpressionClauseSyntax)reader.ReadValue();
if (arrowExpressionClauseSyntax != null)
{
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)arrowExpressionClauseSyntax);
expressionBody = arrowExpressionClauseSyntax;
}
EqualsValueClauseSyntax equalsValueClauseSyntax = (EqualsValueClauseSyntax)reader.ReadValue();
if (equalsValueClauseSyntax != null)
{
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)equalsValueClauseSyntax);
initializer = equalsValueClauseSyntax;
}
SyntaxToken syntaxToken2 = (SyntaxToken)reader.ReadValue();
if (syntaxToken2 != null)
{
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)syntaxToken2);
semicolonToken = syntaxToken2;
}
}
internal override void WriteTo(ObjectWriter writer)
{
((GreenNode)this).WriteTo(writer);
writer.WriteValue((IObjectWritable)(object)attributeLists);
writer.WriteValue((IObjectWritable)(object)modifiers);
writer.WriteValue((IObjectWritable)(object)type);
writer.WriteValue((IObjectWritable)(object)explicitInterfaceSpecifier);
writer.WriteValue((IObjectWritable)(object)identifier);
writer.WriteValue((IObjectWritable)(object)accessorList);
writer.WriteValue((IObjectWritable)(object)expressionBody);
writer.WriteValue((IObjectWritable)(object)initializer);
writer.WriteValue((IObjectWritable)(object)semicolonToken);
}
static PropertyDeclarationSyntax()
{
ObjectBinder.RegisterTypeReader(typeof(PropertyDeclarationSyntax), (Func<ObjectReader, IObjectWritable>)((ObjectReader r) => (IObjectWritable)(object)new PropertyDeclarationSyntax(r)));
}
}