using System; using System.Collections.Generic; using Microsoft.CodeAnalysis.Syntax.InternalSyntax; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax; internal sealed class GlobalStatementSyntax : MemberDeclarationSyntax { internal readonly GreenNode? attributeLists; internal readonly GreenNode? modifiers; internal readonly StatementSyntax statement; public override SyntaxList AttributeLists => new SyntaxList(attributeLists); public override SyntaxList Modifiers => new SyntaxList(modifiers); public StatementSyntax Statement => statement; internal GlobalStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) : base(kind, diagnostics, annotations) { ((GreenNode)this).SlotCount = 3; 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)statement); this.statement = statement; } internal GlobalStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, StatementSyntax statement, SyntaxFactoryContext context) : base(kind) { SetFactoryContext(context); ((GreenNode)this).SlotCount = 3; 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)statement); this.statement = statement; } internal GlobalStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, StatementSyntax statement) : base(kind) { ((GreenNode)this).SlotCount = 3; 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)statement); this.statement = statement; } internal override GreenNode? GetSlot(int index) { return (GreenNode?)(index switch { 0 => attributeLists, 1 => modifiers, 2 => statement, _ => null, }); } internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) { return (SyntaxNode)(object)new Microsoft.CodeAnalysis.CSharp.Syntax.GlobalStatementSyntax(this, parent, position); } public override void Accept(CSharpSyntaxVisitor visitor) { visitor.VisitGlobalStatement(this); } public override TResult Accept(CSharpSyntaxVisitor visitor) { return visitor.VisitGlobalStatement(this); } public GlobalStatementSyntax Update(SyntaxList attributeLists, SyntaxList modifiers, 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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0026: 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 || statement != Statement) { GlobalStatementSyntax globalStatementSyntax = SyntaxFactory.GlobalStatement(attributeLists, modifiers, statement); DiagnosticInfo[] diagnostics = ((GreenNode)this).GetDiagnostics(); if (diagnostics != null && diagnostics.Length != 0) { globalStatementSyntax = GreenNodeExtensions.WithDiagnosticsGreen(globalStatementSyntax, diagnostics); } SyntaxAnnotation[] annotations = ((GreenNode)this).GetAnnotations(); if (annotations != null && annotations.Length != 0) { globalStatementSyntax = GreenNodeExtensions.WithAnnotationsGreen(globalStatementSyntax, (IEnumerable)annotations); } return globalStatementSyntax; } return this; } internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) { return (GreenNode)(object)new GlobalStatementSyntax(base.Kind, attributeLists, modifiers, statement, diagnostics, ((GreenNode)this).GetAnnotations()); } internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) { return (GreenNode)(object)new GlobalStatementSyntax(base.Kind, attributeLists, modifiers, statement, ((GreenNode)this).GetDiagnostics(), annotations); } internal GlobalStatementSyntax(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 = 3; 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; } 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)modifiers); writer.WriteValue((IObjectWritable)(object)statement); } static GlobalStatementSyntax() { ObjectBinder.RegisterTypeReader(typeof(GlobalStatementSyntax), (Func)((ObjectReader r) => (IObjectWritable)(object)new GlobalStatementSyntax(r))); } }