357 lines
15 KiB
C#
357 lines
15 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 ConversionOperatorDeclarationSyntax : BaseMethodDeclarationSyntax
|
|
{
|
|
internal readonly GreenNode? attributeLists;
|
|
|
|
internal readonly GreenNode? modifiers;
|
|
|
|
internal readonly SyntaxToken implicitOrExplicitKeyword;
|
|
|
|
internal readonly ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier;
|
|
|
|
internal readonly SyntaxToken operatorKeyword;
|
|
|
|
internal readonly SyntaxToken? checkedKeyword;
|
|
|
|
internal readonly TypeSyntax type;
|
|
|
|
internal readonly ParameterListSyntax parameterList;
|
|
|
|
internal readonly BlockSyntax? body;
|
|
|
|
internal readonly ArrowExpressionClauseSyntax? expressionBody;
|
|
|
|
internal readonly SyntaxToken? semicolonToken;
|
|
|
|
public override SyntaxList<AttributeListSyntax> AttributeLists => new SyntaxList<AttributeListSyntax>(attributeLists);
|
|
|
|
public override SyntaxList<SyntaxToken> Modifiers => new SyntaxList<SyntaxToken>(modifiers);
|
|
|
|
public SyntaxToken ImplicitOrExplicitKeyword => implicitOrExplicitKeyword;
|
|
|
|
public ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => explicitInterfaceSpecifier;
|
|
|
|
public SyntaxToken OperatorKeyword => operatorKeyword;
|
|
|
|
public SyntaxToken? CheckedKeyword => checkedKeyword;
|
|
|
|
public TypeSyntax Type => type;
|
|
|
|
public override ParameterListSyntax ParameterList => parameterList;
|
|
|
|
public override BlockSyntax? Body => body;
|
|
|
|
public override ArrowExpressionClauseSyntax? ExpressionBody => expressionBody;
|
|
|
|
public override SyntaxToken? SemicolonToken => semicolonToken;
|
|
|
|
internal ConversionOperatorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken implicitOrExplicitKeyword, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, TypeSyntax type, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
|
|
: base(kind, diagnostics, annotations)
|
|
{
|
|
((GreenNode)this).SlotCount = 11;
|
|
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)implicitOrExplicitKeyword);
|
|
this.implicitOrExplicitKeyword = implicitOrExplicitKeyword;
|
|
if (explicitInterfaceSpecifier != null)
|
|
{
|
|
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)explicitInterfaceSpecifier);
|
|
this.explicitInterfaceSpecifier = explicitInterfaceSpecifier;
|
|
}
|
|
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)operatorKeyword);
|
|
this.operatorKeyword = operatorKeyword;
|
|
if (checkedKeyword != null)
|
|
{
|
|
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)checkedKeyword);
|
|
this.checkedKeyword = checkedKeyword;
|
|
}
|
|
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)type);
|
|
this.type = type;
|
|
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)parameterList);
|
|
this.parameterList = parameterList;
|
|
if (body != null)
|
|
{
|
|
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)body);
|
|
this.body = body;
|
|
}
|
|
if (expressionBody != null)
|
|
{
|
|
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)expressionBody);
|
|
this.expressionBody = expressionBody;
|
|
}
|
|
if (semicolonToken != null)
|
|
{
|
|
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)semicolonToken);
|
|
this.semicolonToken = semicolonToken;
|
|
}
|
|
}
|
|
|
|
internal ConversionOperatorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken implicitOrExplicitKeyword, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, TypeSyntax type, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, SyntaxFactoryContext context)
|
|
: base(kind)
|
|
{
|
|
SetFactoryContext(context);
|
|
((GreenNode)this).SlotCount = 11;
|
|
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)implicitOrExplicitKeyword);
|
|
this.implicitOrExplicitKeyword = implicitOrExplicitKeyword;
|
|
if (explicitInterfaceSpecifier != null)
|
|
{
|
|
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)explicitInterfaceSpecifier);
|
|
this.explicitInterfaceSpecifier = explicitInterfaceSpecifier;
|
|
}
|
|
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)operatorKeyword);
|
|
this.operatorKeyword = operatorKeyword;
|
|
if (checkedKeyword != null)
|
|
{
|
|
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)checkedKeyword);
|
|
this.checkedKeyword = checkedKeyword;
|
|
}
|
|
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)type);
|
|
this.type = type;
|
|
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)parameterList);
|
|
this.parameterList = parameterList;
|
|
if (body != null)
|
|
{
|
|
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)body);
|
|
this.body = body;
|
|
}
|
|
if (expressionBody != null)
|
|
{
|
|
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)expressionBody);
|
|
this.expressionBody = expressionBody;
|
|
}
|
|
if (semicolonToken != null)
|
|
{
|
|
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)semicolonToken);
|
|
this.semicolonToken = semicolonToken;
|
|
}
|
|
}
|
|
|
|
internal ConversionOperatorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken implicitOrExplicitKeyword, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, TypeSyntax type, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken)
|
|
: base(kind)
|
|
{
|
|
((GreenNode)this).SlotCount = 11;
|
|
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)implicitOrExplicitKeyword);
|
|
this.implicitOrExplicitKeyword = implicitOrExplicitKeyword;
|
|
if (explicitInterfaceSpecifier != null)
|
|
{
|
|
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)explicitInterfaceSpecifier);
|
|
this.explicitInterfaceSpecifier = explicitInterfaceSpecifier;
|
|
}
|
|
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)operatorKeyword);
|
|
this.operatorKeyword = operatorKeyword;
|
|
if (checkedKeyword != null)
|
|
{
|
|
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)checkedKeyword);
|
|
this.checkedKeyword = checkedKeyword;
|
|
}
|
|
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)type);
|
|
this.type = type;
|
|
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)parameterList);
|
|
this.parameterList = parameterList;
|
|
if (body != null)
|
|
{
|
|
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)body);
|
|
this.body = body;
|
|
}
|
|
if (expressionBody != null)
|
|
{
|
|
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)expressionBody);
|
|
this.expressionBody = expressionBody;
|
|
}
|
|
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 => implicitOrExplicitKeyword,
|
|
3 => explicitInterfaceSpecifier,
|
|
4 => operatorKeyword,
|
|
5 => checkedKeyword,
|
|
6 => type,
|
|
7 => parameterList,
|
|
8 => body,
|
|
9 => expressionBody,
|
|
10 => semicolonToken,
|
|
_ => null,
|
|
});
|
|
}
|
|
|
|
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position)
|
|
{
|
|
return (SyntaxNode)(object)new Microsoft.CodeAnalysis.CSharp.Syntax.ConversionOperatorDeclarationSyntax(this, parent, position);
|
|
}
|
|
|
|
public override void Accept(CSharpSyntaxVisitor visitor)
|
|
{
|
|
visitor.VisitConversionOperatorDeclaration(this);
|
|
}
|
|
|
|
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor)
|
|
{
|
|
return visitor.VisitConversionOperatorDeclaration(this);
|
|
}
|
|
|
|
public ConversionOperatorDeclarationSyntax Update(SyntaxList<AttributeListSyntax> attributeLists, SyntaxList<SyntaxToken> modifiers, SyntaxToken implicitOrExplicitKeyword, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, TypeSyntax type, ParameterListSyntax parameterList, BlockSyntax body, 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_0075: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0076: 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 || implicitOrExplicitKeyword != ImplicitOrExplicitKeyword || explicitInterfaceSpecifier != ExplicitInterfaceSpecifier || operatorKeyword != OperatorKeyword || checkedKeyword != CheckedKeyword || type != Type || parameterList != ParameterList || body != Body || expressionBody != ExpressionBody || semicolonToken != SemicolonToken)
|
|
{
|
|
ConversionOperatorDeclarationSyntax conversionOperatorDeclarationSyntax = SyntaxFactory.ConversionOperatorDeclaration(attributeLists, modifiers, implicitOrExplicitKeyword, explicitInterfaceSpecifier, operatorKeyword, checkedKeyword, type, parameterList, body, expressionBody, semicolonToken);
|
|
DiagnosticInfo[] diagnostics = ((GreenNode)this).GetDiagnostics();
|
|
if (diagnostics != null && diagnostics.Length != 0)
|
|
{
|
|
conversionOperatorDeclarationSyntax = GreenNodeExtensions.WithDiagnosticsGreen<ConversionOperatorDeclarationSyntax>(conversionOperatorDeclarationSyntax, diagnostics);
|
|
}
|
|
SyntaxAnnotation[] annotations = ((GreenNode)this).GetAnnotations();
|
|
if (annotations != null && annotations.Length != 0)
|
|
{
|
|
conversionOperatorDeclarationSyntax = GreenNodeExtensions.WithAnnotationsGreen<ConversionOperatorDeclarationSyntax>(conversionOperatorDeclarationSyntax, (IEnumerable<SyntaxAnnotation>)annotations);
|
|
}
|
|
return conversionOperatorDeclarationSyntax;
|
|
}
|
|
return this;
|
|
}
|
|
|
|
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
|
|
{
|
|
return (GreenNode)(object)new ConversionOperatorDeclarationSyntax(base.Kind, attributeLists, modifiers, implicitOrExplicitKeyword, explicitInterfaceSpecifier, operatorKeyword, checkedKeyword, type, parameterList, body, expressionBody, semicolonToken, diagnostics, ((GreenNode)this).GetAnnotations());
|
|
}
|
|
|
|
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
|
|
{
|
|
return (GreenNode)(object)new ConversionOperatorDeclarationSyntax(base.Kind, attributeLists, modifiers, implicitOrExplicitKeyword, explicitInterfaceSpecifier, operatorKeyword, checkedKeyword, type, parameterList, body, expressionBody, semicolonToken, ((GreenNode)this).GetDiagnostics(), annotations);
|
|
}
|
|
|
|
internal ConversionOperatorDeclarationSyntax(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 = 11;
|
|
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);
|
|
implicitOrExplicitKeyword = syntaxToken;
|
|
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);
|
|
operatorKeyword = syntaxToken2;
|
|
SyntaxToken syntaxToken3 = (SyntaxToken)reader.ReadValue();
|
|
if (syntaxToken3 != null)
|
|
{
|
|
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)syntaxToken3);
|
|
checkedKeyword = syntaxToken3;
|
|
}
|
|
TypeSyntax typeSyntax = (TypeSyntax)reader.ReadValue();
|
|
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)typeSyntax);
|
|
type = typeSyntax;
|
|
ParameterListSyntax parameterListSyntax = (ParameterListSyntax)reader.ReadValue();
|
|
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)parameterListSyntax);
|
|
parameterList = parameterListSyntax;
|
|
BlockSyntax blockSyntax = (BlockSyntax)reader.ReadValue();
|
|
if (blockSyntax != null)
|
|
{
|
|
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)blockSyntax);
|
|
body = blockSyntax;
|
|
}
|
|
ArrowExpressionClauseSyntax arrowExpressionClauseSyntax = (ArrowExpressionClauseSyntax)reader.ReadValue();
|
|
if (arrowExpressionClauseSyntax != null)
|
|
{
|
|
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)arrowExpressionClauseSyntax);
|
|
expressionBody = arrowExpressionClauseSyntax;
|
|
}
|
|
SyntaxToken syntaxToken4 = (SyntaxToken)reader.ReadValue();
|
|
if (syntaxToken4 != null)
|
|
{
|
|
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)syntaxToken4);
|
|
semicolonToken = syntaxToken4;
|
|
}
|
|
}
|
|
|
|
internal override void WriteTo(ObjectWriter writer)
|
|
{
|
|
((GreenNode)this).WriteTo(writer);
|
|
writer.WriteValue((IObjectWritable)(object)attributeLists);
|
|
writer.WriteValue((IObjectWritable)(object)modifiers);
|
|
writer.WriteValue((IObjectWritable)(object)implicitOrExplicitKeyword);
|
|
writer.WriteValue((IObjectWritable)(object)explicitInterfaceSpecifier);
|
|
writer.WriteValue((IObjectWritable)(object)operatorKeyword);
|
|
writer.WriteValue((IObjectWritable)(object)checkedKeyword);
|
|
writer.WriteValue((IObjectWritable)(object)type);
|
|
writer.WriteValue((IObjectWritable)(object)parameterList);
|
|
writer.WriteValue((IObjectWritable)(object)body);
|
|
writer.WriteValue((IObjectWritable)(object)expressionBody);
|
|
writer.WriteValue((IObjectWritable)(object)semicolonToken);
|
|
}
|
|
|
|
static ConversionOperatorDeclarationSyntax()
|
|
{
|
|
ObjectBinder.RegisterTypeReader(typeof(ConversionOperatorDeclarationSyntax), (Func<ObjectReader, IObjectWritable>)((ObjectReader r) => (IObjectWritable)(object)new ConversionOperatorDeclarationSyntax(r)));
|
|
}
|
|
}
|