using System; using System.Collections.Generic; using Microsoft.CodeAnalysis.Syntax.InternalSyntax; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax; internal sealed class FunctionPointerParameterSyntax : BaseParameterSyntax { internal readonly GreenNode? attributeLists; internal readonly GreenNode? modifiers; internal readonly TypeSyntax type; public override SyntaxList AttributeLists => new SyntaxList(attributeLists); public override SyntaxList Modifiers => new SyntaxList(modifiers); public override TypeSyntax Type => type; internal FunctionPointerParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, 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)type); this.type = type; } internal FunctionPointerParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, 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)type); this.type = type; } internal FunctionPointerParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type) : 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)type); this.type = type; } internal override GreenNode? GetSlot(int index) { return (GreenNode?)(index switch { 0 => attributeLists, 1 => modifiers, 2 => type, _ => null, }); } internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) { return (SyntaxNode)(object)new Microsoft.CodeAnalysis.CSharp.Syntax.FunctionPointerParameterSyntax(this, parent, position); } public override void Accept(CSharpSyntaxVisitor visitor) { visitor.VisitFunctionPointerParameter(this); } public override TResult Accept(CSharpSyntaxVisitor visitor) { return visitor.VisitFunctionPointerParameter(this); } public FunctionPointerParameterSyntax Update(SyntaxList attributeLists, SyntaxList modifiers, TypeSyntax type) { //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 || type != Type) { FunctionPointerParameterSyntax functionPointerParameterSyntax = SyntaxFactory.FunctionPointerParameter(attributeLists, modifiers, type); DiagnosticInfo[] diagnostics = ((GreenNode)this).GetDiagnostics(); if (diagnostics != null && diagnostics.Length != 0) { functionPointerParameterSyntax = GreenNodeExtensions.WithDiagnosticsGreen(functionPointerParameterSyntax, diagnostics); } SyntaxAnnotation[] annotations = ((GreenNode)this).GetAnnotations(); if (annotations != null && annotations.Length != 0) { functionPointerParameterSyntax = GreenNodeExtensions.WithAnnotationsGreen(functionPointerParameterSyntax, (IEnumerable)annotations); } return functionPointerParameterSyntax; } return this; } internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) { return (GreenNode)(object)new FunctionPointerParameterSyntax(base.Kind, attributeLists, modifiers, type, diagnostics, ((GreenNode)this).GetAnnotations()); } internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) { return (GreenNode)(object)new FunctionPointerParameterSyntax(base.Kind, attributeLists, modifiers, type, ((GreenNode)this).GetDiagnostics(), annotations); } internal FunctionPointerParameterSyntax(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; } TypeSyntax typeSyntax = (TypeSyntax)reader.ReadValue(); ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)typeSyntax); type = typeSyntax; } internal override void WriteTo(ObjectWriter writer) { ((GreenNode)this).WriteTo(writer); writer.WriteValue((IObjectWritable)(object)attributeLists); writer.WriteValue((IObjectWritable)(object)modifiers); writer.WriteValue((IObjectWritable)(object)type); } static FunctionPointerParameterSyntax() { ObjectBinder.RegisterTypeReader(typeof(FunctionPointerParameterSyntax), (Func)((ObjectReader r) => (IObjectWritable)(object)new FunctionPointerParameterSyntax(r))); } }