127 lines
4.3 KiB
C#
127 lines
4.3 KiB
C#
using System;
|
|||
|
|
using System.Collections.Generic;
|
||
|
|
using Roslyn.Utilities;
|
||
|
|
|
||
|
|
namespace Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax;
|
||
|
|
|
||
|
|
internal sealed class JoinIntoClauseSyntax : CSharpSyntaxNode
|
||
|
|
{
|
||
|
|
internal readonly SyntaxToken intoKeyword;
|
||
|
|
|
||
|
|
internal readonly SyntaxToken identifier;
|
||
|
|
|
||
|
|
public SyntaxToken IntoKeyword => intoKeyword;
|
||
|
|
|
||
|
|
public SyntaxToken Identifier => identifier;
|
||
|
|
|
||
|
|
internal JoinIntoClauseSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
|
||
|
|
: base(kind, diagnostics, annotations)
|
||
|
|
{
|
||
|
|
((GreenNode)this).SlotCount = 2;
|
||
|
|
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)intoKeyword);
|
||
|
|
this.intoKeyword = intoKeyword;
|
||
|
|
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)identifier);
|
||
|
|
this.identifier = identifier;
|
||
|
|
}
|
||
|
|
|
||
|
|
internal JoinIntoClauseSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier, SyntaxFactoryContext context)
|
||
|
|
: base(kind)
|
||
|
|
{
|
||
|
|
SetFactoryContext(context);
|
||
|
|
((GreenNode)this).SlotCount = 2;
|
||
|
|
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)intoKeyword);
|
||
|
|
this.intoKeyword = intoKeyword;
|
||
|
|
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)identifier);
|
||
|
|
this.identifier = identifier;
|
||
|
|
}
|
||
|
|
|
||
|
|
internal JoinIntoClauseSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier)
|
||
|
|
: base(kind)
|
||
|
|
{
|
||
|
|
((GreenNode)this).SlotCount = 2;
|
||
|
|
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)intoKeyword);
|
||
|
|
this.intoKeyword = intoKeyword;
|
||
|
|
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)identifier);
|
||
|
|
this.identifier = identifier;
|
||
|
|
}
|
||
|
|
|
||
|
|
internal override GreenNode? GetSlot(int index)
|
||
|
|
{
|
||
|
|
return (GreenNode?)(index switch
|
||
|
|
{
|
||
|
|
0 => intoKeyword,
|
||
|
|
1 => identifier,
|
||
|
|
_ => null,
|
||
|
|
});
|
||
|
|
}
|
||
|
|
|
||
|
|
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position)
|
||
|
|
{
|
||
|
|
return (SyntaxNode)(object)new Microsoft.CodeAnalysis.CSharp.Syntax.JoinIntoClauseSyntax(this, parent, position);
|
||
|
|
}
|
||
|
|
|
||
|
|
public override void Accept(CSharpSyntaxVisitor visitor)
|
||
|
|
{
|
||
|
|
visitor.VisitJoinIntoClause(this);
|
||
|
|
}
|
||
|
|
|
||
|
|
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor)
|
||
|
|
{
|
||
|
|
return visitor.VisitJoinIntoClause(this);
|
||
|
|
}
|
||
|
|
|
||
|
|
public JoinIntoClauseSyntax Update(SyntaxToken intoKeyword, SyntaxToken identifier)
|
||
|
|
{
|
||
|
|
if (intoKeyword != IntoKeyword || identifier != Identifier)
|
||
|
|
{
|
||
|
|
JoinIntoClauseSyntax joinIntoClauseSyntax = SyntaxFactory.JoinIntoClause(intoKeyword, identifier);
|
||
|
|
DiagnosticInfo[] diagnostics = ((GreenNode)this).GetDiagnostics();
|
||
|
|
if (diagnostics != null && diagnostics.Length != 0)
|
||
|
|
{
|
||
|
|
joinIntoClauseSyntax = GreenNodeExtensions.WithDiagnosticsGreen<JoinIntoClauseSyntax>(joinIntoClauseSyntax, diagnostics);
|
||
|
|
}
|
||
|
|
SyntaxAnnotation[] annotations = ((GreenNode)this).GetAnnotations();
|
||
|
|
if (annotations != null && annotations.Length != 0)
|
||
|
|
{
|
||
|
|
joinIntoClauseSyntax = GreenNodeExtensions.WithAnnotationsGreen<JoinIntoClauseSyntax>(joinIntoClauseSyntax, (IEnumerable<SyntaxAnnotation>)annotations);
|
||
|
|
}
|
||
|
|
return joinIntoClauseSyntax;
|
||
|
|
}
|
||
|
|
return this;
|
||
|
|
}
|
||
|
|
|
||
|
|
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
|
||
|
|
{
|
||
|
|
return (GreenNode)(object)new JoinIntoClauseSyntax(base.Kind, intoKeyword, identifier, diagnostics, ((GreenNode)this).GetAnnotations());
|
||
|
|
}
|
||
|
|
|
||
|
|
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
|
||
|
|
{
|
||
|
|
return (GreenNode)(object)new JoinIntoClauseSyntax(base.Kind, intoKeyword, identifier, ((GreenNode)this).GetDiagnostics(), annotations);
|
||
|
|
}
|
||
|
|
|
||
|
|
internal JoinIntoClauseSyntax(ObjectReader reader)
|
||
|
|
: base(reader)
|
||
|
|
{
|
||
|
|
((GreenNode)this).SlotCount = 2;
|
||
|
|
SyntaxToken syntaxToken = (SyntaxToken)reader.ReadValue();
|
||
|
|
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)syntaxToken);
|
||
|
|
intoKeyword = syntaxToken;
|
||
|
|
SyntaxToken syntaxToken2 = (SyntaxToken)reader.ReadValue();
|
||
|
|
((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)syntaxToken2);
|
||
|
|
identifier = syntaxToken2;
|
||
|
|
}
|
||
|
|
|
||
|
|
internal override void WriteTo(ObjectWriter writer)
|
||
|
|
{
|
||
|
|
((GreenNode)this).WriteTo(writer);
|
||
|
|
writer.WriteValue((IObjectWritable)(object)intoKeyword);
|
||
|
|
writer.WriteValue((IObjectWritable)(object)identifier);
|
||
|
|
}
|
||
|
|
|
||
|
|
static JoinIntoClauseSyntax()
|
||
|
|
{
|
||
|
|
ObjectBinder.RegisterTypeReader(typeof(JoinIntoClauseSyntax), (Func<ObjectReader, IObjectWritable>)((ObjectReader r) => (IObjectWritable)(object)new JoinIntoClauseSyntax(r)));
|
||
|
|
}
|
||
|
|
}
|