288 lines
11 KiB
C#
288 lines
11 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 EventDeclarationSyntax : BasePropertyDeclarationSyntax
|
|
{
|
|
internal readonly GreenNode? attributeLists;
|
|
|
|
internal readonly GreenNode? modifiers;
|
|
|
|
internal readonly SyntaxToken eventKeyword;
|
|
|
|
internal readonly TypeSyntax type;
|
|
|
|
internal readonly ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier;
|
|
|
|
internal readonly SyntaxToken identifier;
|
|
|
|
internal readonly AccessorListSyntax? accessorList;
|
|
|
|
internal readonly SyntaxToken? semicolonToken;
|
|
|
|
public override SyntaxList<AttributeListSyntax> AttributeLists => new SyntaxList<AttributeListSyntax>(attributeLists);
|
|
|
|
public override SyntaxList<SyntaxToken> Modifiers => new SyntaxList<SyntaxToken>(modifiers);
|
|
|
|
public SyntaxToken EventKeyword => eventKeyword;
|
|
|
|
public override TypeSyntax Type => type;
|
|
|
|
public override ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => explicitInterfaceSpecifier;
|
|
|
|
public SyntaxToken Identifier => identifier;
|
|
|
|
public override AccessorListSyntax? AccessorList => accessorList;
|
|
|
|
public SyntaxToken? SemicolonToken => semicolonToken;
|
|
|
|
internal EventDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
|
|
: base(kind, diagnostics, annotations)
|
|
{
|
|
((GreenNode)this).SlotCount = 8;
|
|
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)eventKeyword);
|
|
this.eventKeyword = eventKeyword;
|
|
((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 (semicolonToken != null)
|
|
{
|
|
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)semicolonToken);
|
|
this.semicolonToken = semicolonToken;
|
|
}
|
|
}
|
|
|
|
internal EventDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken? semicolonToken, SyntaxFactoryContext context)
|
|
: base(kind)
|
|
{
|
|
SetFactoryContext(context);
|
|
((GreenNode)this).SlotCount = 8;
|
|
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)eventKeyword);
|
|
this.eventKeyword = eventKeyword;
|
|
((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 (semicolonToken != null)
|
|
{
|
|
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)semicolonToken);
|
|
this.semicolonToken = semicolonToken;
|
|
}
|
|
}
|
|
|
|
internal EventDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken? semicolonToken)
|
|
: base(kind)
|
|
{
|
|
((GreenNode)this).SlotCount = 8;
|
|
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)eventKeyword);
|
|
this.eventKeyword = eventKeyword;
|
|
((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 (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 => eventKeyword,
|
|
3 => type,
|
|
4 => explicitInterfaceSpecifier,
|
|
5 => identifier,
|
|
6 => accessorList,
|
|
7 => semicolonToken,
|
|
_ => null,
|
|
});
|
|
}
|
|
|
|
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position)
|
|
{
|
|
return (SyntaxNode)(object)new Microsoft.CodeAnalysis.CSharp.Syntax.EventDeclarationSyntax(this, parent, position);
|
|
}
|
|
|
|
public override void Accept(CSharpSyntaxVisitor visitor)
|
|
{
|
|
visitor.VisitEventDeclaration(this);
|
|
}
|
|
|
|
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor)
|
|
{
|
|
return visitor.VisitEventDeclaration(this);
|
|
}
|
|
|
|
public EventDeclarationSyntax Update(SyntaxList<AttributeListSyntax> attributeLists, SyntaxList<SyntaxToken> modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax accessorList, 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_0057: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0058: 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 || eventKeyword != EventKeyword || type != Type || explicitInterfaceSpecifier != ExplicitInterfaceSpecifier || identifier != Identifier || accessorList != AccessorList || semicolonToken != SemicolonToken)
|
|
{
|
|
EventDeclarationSyntax eventDeclarationSyntax = SyntaxFactory.EventDeclaration(attributeLists, modifiers, eventKeyword, type, explicitInterfaceSpecifier, identifier, accessorList, semicolonToken);
|
|
DiagnosticInfo[] diagnostics = ((GreenNode)this).GetDiagnostics();
|
|
if (diagnostics != null && diagnostics.Length != 0)
|
|
{
|
|
eventDeclarationSyntax = GreenNodeExtensions.WithDiagnosticsGreen<EventDeclarationSyntax>(eventDeclarationSyntax, diagnostics);
|
|
}
|
|
SyntaxAnnotation[] annotations = ((GreenNode)this).GetAnnotations();
|
|
if (annotations != null && annotations.Length != 0)
|
|
{
|
|
eventDeclarationSyntax = GreenNodeExtensions.WithAnnotationsGreen<EventDeclarationSyntax>(eventDeclarationSyntax, (IEnumerable<SyntaxAnnotation>)annotations);
|
|
}
|
|
return eventDeclarationSyntax;
|
|
}
|
|
return this;
|
|
}
|
|
|
|
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
|
|
{
|
|
return (GreenNode)(object)new EventDeclarationSyntax(base.Kind, attributeLists, modifiers, eventKeyword, type, explicitInterfaceSpecifier, identifier, accessorList, semicolonToken, diagnostics, ((GreenNode)this).GetAnnotations());
|
|
}
|
|
|
|
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
|
|
{
|
|
return (GreenNode)(object)new EventDeclarationSyntax(base.Kind, attributeLists, modifiers, eventKeyword, type, explicitInterfaceSpecifier, identifier, accessorList, semicolonToken, ((GreenNode)this).GetDiagnostics(), annotations);
|
|
}
|
|
|
|
internal EventDeclarationSyntax(ObjectReader reader)
|
|
: base(reader)
|
|
{
|
|
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_001a: Expected O, but got Unknown
|
|
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0037: Expected O, but got Unknown
|
|
((GreenNode)this).SlotCount = 8;
|
|
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;
|
|
}
|
|
SyntaxToken syntaxToken = (SyntaxToken)reader.ReadValue();
|
|
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)syntaxToken);
|
|
eventKeyword = syntaxToken;
|
|
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 syntaxToken2 = (SyntaxToken)reader.ReadValue();
|
|
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)syntaxToken2);
|
|
identifier = syntaxToken2;
|
|
AccessorListSyntax accessorListSyntax = (AccessorListSyntax)reader.ReadValue();
|
|
if (accessorListSyntax != null)
|
|
{
|
|
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)accessorListSyntax);
|
|
accessorList = accessorListSyntax;
|
|
}
|
|
SyntaxToken syntaxToken3 = (SyntaxToken)reader.ReadValue();
|
|
if (syntaxToken3 != null)
|
|
{
|
|
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)syntaxToken3);
|
|
semicolonToken = syntaxToken3;
|
|
}
|
|
}
|
|
|
|
internal override void WriteTo(ObjectWriter writer)
|
|
{
|
|
((GreenNode)this).WriteTo(writer);
|
|
writer.WriteValue((IObjectWritable)(object)attributeLists);
|
|
writer.WriteValue((IObjectWritable)(object)modifiers);
|
|
writer.WriteValue((IObjectWritable)(object)eventKeyword);
|
|
writer.WriteValue((IObjectWritable)(object)type);
|
|
writer.WriteValue((IObjectWritable)(object)explicitInterfaceSpecifier);
|
|
writer.WriteValue((IObjectWritable)(object)identifier);
|
|
writer.WriteValue((IObjectWritable)(object)accessorList);
|
|
writer.WriteValue((IObjectWritable)(object)semicolonToken);
|
|
}
|
|
|
|
static EventDeclarationSyntax()
|
|
{
|
|
ObjectBinder.RegisterTypeReader(typeof(EventDeclarationSyntax), (Func<ObjectReader, IObjectWritable>)((ObjectReader r) => (IObjectWritable)(object)new EventDeclarationSyntax(r)));
|
|
}
|
|
}
|