using System; using System.Collections.Generic; using Microsoft.CodeAnalysis.Syntax.InternalSyntax; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax; internal sealed class ForStatementSyntax : StatementSyntax { internal readonly GreenNode? attributeLists; internal readonly SyntaxToken forKeyword; internal readonly SyntaxToken openParenToken; internal readonly VariableDeclarationSyntax? declaration; internal readonly GreenNode? initializers; internal readonly SyntaxToken firstSemicolonToken; internal readonly ExpressionSyntax? condition; internal readonly SyntaxToken secondSemicolonToken; internal readonly GreenNode? incrementors; internal readonly SyntaxToken closeParenToken; internal readonly StatementSyntax statement; public override SyntaxList AttributeLists => new SyntaxList(attributeLists); public SyntaxToken ForKeyword => forKeyword; public SyntaxToken OpenParenToken => openParenToken; public VariableDeclarationSyntax? Declaration => declaration; public SeparatedSyntaxList Initializers => new SeparatedSyntaxList(SyntaxList.op_Implicit(new SyntaxList(initializers))); public SyntaxToken FirstSemicolonToken => firstSemicolonToken; public ExpressionSyntax? Condition => condition; public SyntaxToken SecondSemicolonToken => secondSemicolonToken; public SeparatedSyntaxList Incrementors => new SeparatedSyntaxList(SyntaxList.op_Implicit(new SyntaxList(incrementors))); public SyntaxToken CloseParenToken => closeParenToken; public StatementSyntax Statement => statement; internal ForStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken forKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, GreenNode? initializers, SyntaxToken firstSemicolonToken, ExpressionSyntax? condition, SyntaxToken secondSemicolonToken, GreenNode? incrementors, SyntaxToken closeParenToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) : base(kind, diagnostics, annotations) { ((GreenNode)this).SlotCount = 11; if (attributeLists != null) { ((GreenNode)this).AdjustFlagsAndWidth(attributeLists); this.attributeLists = attributeLists; } ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)forKeyword); this.forKeyword = forKeyword; ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)openParenToken); this.openParenToken = openParenToken; if (declaration != null) { ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)declaration); this.declaration = declaration; } if (initializers != null) { ((GreenNode)this).AdjustFlagsAndWidth(initializers); this.initializers = initializers; } ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)firstSemicolonToken); this.firstSemicolonToken = firstSemicolonToken; if (condition != null) { ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)condition); this.condition = condition; } ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)secondSemicolonToken); this.secondSemicolonToken = secondSemicolonToken; if (incrementors != null) { ((GreenNode)this).AdjustFlagsAndWidth(incrementors); this.incrementors = incrementors; } ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)closeParenToken); this.closeParenToken = closeParenToken; ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)statement); this.statement = statement; } internal ForStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken forKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, GreenNode? initializers, SyntaxToken firstSemicolonToken, ExpressionSyntax? condition, SyntaxToken secondSemicolonToken, GreenNode? incrementors, SyntaxToken closeParenToken, StatementSyntax statement, SyntaxFactoryContext context) : base(kind) { SetFactoryContext(context); ((GreenNode)this).SlotCount = 11; if (attributeLists != null) { ((GreenNode)this).AdjustFlagsAndWidth(attributeLists); this.attributeLists = attributeLists; } ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)forKeyword); this.forKeyword = forKeyword; ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)openParenToken); this.openParenToken = openParenToken; if (declaration != null) { ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)declaration); this.declaration = declaration; } if (initializers != null) { ((GreenNode)this).AdjustFlagsAndWidth(initializers); this.initializers = initializers; } ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)firstSemicolonToken); this.firstSemicolonToken = firstSemicolonToken; if (condition != null) { ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)condition); this.condition = condition; } ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)secondSemicolonToken); this.secondSemicolonToken = secondSemicolonToken; if (incrementors != null) { ((GreenNode)this).AdjustFlagsAndWidth(incrementors); this.incrementors = incrementors; } ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)closeParenToken); this.closeParenToken = closeParenToken; ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)statement); this.statement = statement; } internal ForStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken forKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, GreenNode? initializers, SyntaxToken firstSemicolonToken, ExpressionSyntax? condition, SyntaxToken secondSemicolonToken, GreenNode? incrementors, SyntaxToken closeParenToken, StatementSyntax statement) : base(kind) { ((GreenNode)this).SlotCount = 11; if (attributeLists != null) { ((GreenNode)this).AdjustFlagsAndWidth(attributeLists); this.attributeLists = attributeLists; } ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)forKeyword); this.forKeyword = forKeyword; ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)openParenToken); this.openParenToken = openParenToken; if (declaration != null) { ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)declaration); this.declaration = declaration; } if (initializers != null) { ((GreenNode)this).AdjustFlagsAndWidth(initializers); this.initializers = initializers; } ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)firstSemicolonToken); this.firstSemicolonToken = firstSemicolonToken; if (condition != null) { ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)condition); this.condition = condition; } ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)secondSemicolonToken); this.secondSemicolonToken = secondSemicolonToken; if (incrementors != null) { ((GreenNode)this).AdjustFlagsAndWidth(incrementors); this.incrementors = incrementors; } ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)closeParenToken); this.closeParenToken = closeParenToken; ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)statement); this.statement = statement; } internal override GreenNode? GetSlot(int index) { return (GreenNode?)(index switch { 0 => attributeLists, 1 => forKeyword, 2 => openParenToken, 3 => declaration, 4 => initializers, 5 => firstSemicolonToken, 6 => condition, 7 => secondSemicolonToken, 8 => incrementors, 9 => closeParenToken, 10 => statement, _ => null, }); } internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) { return (SyntaxNode)(object)new Microsoft.CodeAnalysis.CSharp.Syntax.ForStatementSyntax(this, parent, position); } public override void Accept(CSharpSyntaxVisitor visitor) { visitor.VisitForStatement(this); } public override TResult Accept(CSharpSyntaxVisitor visitor) { return visitor.VisitForStatement(this); } public ForStatementSyntax Update(SyntaxList attributeLists, SyntaxToken forKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SeparatedSyntaxList initializers, SyntaxToken firstSemicolonToken, ExpressionSyntax condition, SyntaxToken secondSemicolonToken, SeparatedSyntaxList incrementors, SyntaxToken closeParenToken, StatementSyntax statement) { //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_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008d: 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) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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) if (!(attributeLists != AttributeLists) && forKeyword == ForKeyword && openParenToken == OpenParenToken && declaration == Declaration) { SeparatedSyntaxList val = Initializers; if (!((ref initializers) != (ref val)) && firstSemicolonToken == FirstSemicolonToken && condition == Condition && secondSemicolonToken == SecondSemicolonToken) { SeparatedSyntaxList val2 = Incrementors; if (!((ref incrementors) != (ref val2)) && closeParenToken == CloseParenToken && statement == Statement) { return this; } } } ForStatementSyntax forStatementSyntax = SyntaxFactory.ForStatement(attributeLists, forKeyword, openParenToken, declaration, initializers, firstSemicolonToken, condition, secondSemicolonToken, incrementors, closeParenToken, statement); DiagnosticInfo[] diagnostics = ((GreenNode)this).GetDiagnostics(); if (diagnostics != null && diagnostics.Length != 0) { forStatementSyntax = GreenNodeExtensions.WithDiagnosticsGreen(forStatementSyntax, diagnostics); } SyntaxAnnotation[] annotations = ((GreenNode)this).GetAnnotations(); if (annotations != null && annotations.Length != 0) { forStatementSyntax = GreenNodeExtensions.WithAnnotationsGreen(forStatementSyntax, (IEnumerable)annotations); } return forStatementSyntax; } internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) { return (GreenNode)(object)new ForStatementSyntax(base.Kind, attributeLists, forKeyword, openParenToken, declaration, initializers, firstSemicolonToken, condition, secondSemicolonToken, incrementors, closeParenToken, statement, diagnostics, ((GreenNode)this).GetAnnotations()); } internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) { return (GreenNode)(object)new ForStatementSyntax(base.Kind, attributeLists, forKeyword, openParenToken, declaration, initializers, firstSemicolonToken, condition, secondSemicolonToken, incrementors, closeParenToken, statement, ((GreenNode)this).GetDiagnostics(), annotations); } internal ForStatementSyntax(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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Expected O, but got Unknown ((GreenNode)this).SlotCount = 11; GreenNode val = (GreenNode)reader.ReadValue(); if (val != null) { ((GreenNode)this).AdjustFlagsAndWidth(val); attributeLists = val; } SyntaxToken syntaxToken = (SyntaxToken)reader.ReadValue(); ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)syntaxToken); forKeyword = syntaxToken; SyntaxToken syntaxToken2 = (SyntaxToken)reader.ReadValue(); ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)syntaxToken2); openParenToken = syntaxToken2; VariableDeclarationSyntax variableDeclarationSyntax = (VariableDeclarationSyntax)reader.ReadValue(); if (variableDeclarationSyntax != null) { ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)variableDeclarationSyntax); declaration = variableDeclarationSyntax; } GreenNode val2 = (GreenNode)reader.ReadValue(); if (val2 != null) { ((GreenNode)this).AdjustFlagsAndWidth(val2); initializers = val2; } SyntaxToken syntaxToken3 = (SyntaxToken)reader.ReadValue(); ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)syntaxToken3); firstSemicolonToken = syntaxToken3; ExpressionSyntax expressionSyntax = (ExpressionSyntax)reader.ReadValue(); if (expressionSyntax != null) { ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)expressionSyntax); condition = expressionSyntax; } SyntaxToken syntaxToken4 = (SyntaxToken)reader.ReadValue(); ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)syntaxToken4); secondSemicolonToken = syntaxToken4; GreenNode val3 = (GreenNode)reader.ReadValue(); if (val3 != null) { ((GreenNode)this).AdjustFlagsAndWidth(val3); incrementors = val3; } SyntaxToken syntaxToken5 = (SyntaxToken)reader.ReadValue(); ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)syntaxToken5); closeParenToken = syntaxToken5; StatementSyntax statementSyntax = (StatementSyntax)reader.ReadValue(); ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)statementSyntax); statement = statementSyntax; } internal override void WriteTo(ObjectWriter writer) { ((GreenNode)this).WriteTo(writer); writer.WriteValue((IObjectWritable)(object)attributeLists); writer.WriteValue((IObjectWritable)(object)forKeyword); writer.WriteValue((IObjectWritable)(object)openParenToken); writer.WriteValue((IObjectWritable)(object)declaration); writer.WriteValue((IObjectWritable)(object)initializers); writer.WriteValue((IObjectWritable)(object)firstSemicolonToken); writer.WriteValue((IObjectWritable)(object)condition); writer.WriteValue((IObjectWritable)(object)secondSemicolonToken); writer.WriteValue((IObjectWritable)(object)incrementors); writer.WriteValue((IObjectWritable)(object)closeParenToken); writer.WriteValue((IObjectWritable)(object)statement); } static ForStatementSyntax() { ObjectBinder.RegisterTypeReader(typeof(ForStatementSyntax), (Func)((ObjectReader r) => (IObjectWritable)(object)new ForStatementSyntax(r))); } }