using System; using System.Collections.Generic; using Microsoft.CodeAnalysis.Syntax.InternalSyntax; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax; internal sealed class MethodDeclarationSyntax : BaseMethodDeclarationSyntax { internal readonly GreenNode? attributeLists; internal readonly GreenNode? modifiers; internal readonly TypeSyntax returnType; internal readonly ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; internal readonly SyntaxToken identifier; internal readonly TypeParameterListSyntax? typeParameterList; internal readonly ParameterListSyntax parameterList; internal readonly GreenNode? constraintClauses; internal readonly BlockSyntax? body; internal readonly ArrowExpressionClauseSyntax? expressionBody; internal readonly SyntaxToken? semicolonToken; public override SyntaxList AttributeLists => new SyntaxList(attributeLists); public override SyntaxList Modifiers => new SyntaxList(modifiers); public TypeSyntax ReturnType => returnType; public ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => explicitInterfaceSpecifier; public SyntaxToken Identifier => identifier; public TypeParameterListSyntax? TypeParameterList => typeParameterList; public override ParameterListSyntax ParameterList => parameterList; public SyntaxList ConstraintClauses => new SyntaxList(constraintClauses); public override BlockSyntax? Body => body; public override ArrowExpressionClauseSyntax? ExpressionBody => expressionBody; public override SyntaxToken? SemicolonToken => semicolonToken; internal MethodDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, GreenNode? constraintClauses, 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)returnType); this.returnType = returnType; if (explicitInterfaceSpecifier != null) { ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)explicitInterfaceSpecifier); this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; } ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)identifier); this.identifier = identifier; if (typeParameterList != null) { ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)typeParameterList); this.typeParameterList = typeParameterList; } ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)parameterList); this.parameterList = parameterList; if (constraintClauses != null) { ((GreenNode)this).AdjustFlagsAndWidth(constraintClauses); this.constraintClauses = constraintClauses; } 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 MethodDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, GreenNode? constraintClauses, 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)returnType); this.returnType = returnType; if (explicitInterfaceSpecifier != null) { ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)explicitInterfaceSpecifier); this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; } ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)identifier); this.identifier = identifier; if (typeParameterList != null) { ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)typeParameterList); this.typeParameterList = typeParameterList; } ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)parameterList); this.parameterList = parameterList; if (constraintClauses != null) { ((GreenNode)this).AdjustFlagsAndWidth(constraintClauses); this.constraintClauses = constraintClauses; } 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 MethodDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, GreenNode? constraintClauses, 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)returnType); this.returnType = returnType; if (explicitInterfaceSpecifier != null) { ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)explicitInterfaceSpecifier); this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; } ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)identifier); this.identifier = identifier; if (typeParameterList != null) { ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)typeParameterList); this.typeParameterList = typeParameterList; } ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)parameterList); this.parameterList = parameterList; if (constraintClauses != null) { ((GreenNode)this).AdjustFlagsAndWidth(constraintClauses); this.constraintClauses = constraintClauses; } 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 => returnType, 3 => explicitInterfaceSpecifier, 4 => identifier, 5 => typeParameterList, 6 => parameterList, 7 => constraintClauses, 8 => body, 9 => expressionBody, 10 => semicolonToken, _ => null, }); } internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) { return (SyntaxNode)(object)new Microsoft.CodeAnalysis.CSharp.Syntax.MethodDeclarationSyntax(this, parent, position); } public override void Accept(CSharpSyntaxVisitor visitor) { visitor.VisitMethodDeclaration(this); } public override TResult Accept(CSharpSyntaxVisitor visitor) { return visitor.VisitMethodDeclaration(this); } public MethodDeclarationSyntax Update(SyntaxList attributeLists, SyntaxList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, ParameterListSyntax parameterList, SyntaxList constraintClauses, 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_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) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) if (attributeLists != AttributeLists || modifiers != Modifiers || returnType != ReturnType || explicitInterfaceSpecifier != ExplicitInterfaceSpecifier || identifier != Identifier || typeParameterList != TypeParameterList || parameterList != ParameterList || constraintClauses != ConstraintClauses || body != Body || expressionBody != ExpressionBody || semicolonToken != SemicolonToken) { MethodDeclarationSyntax methodDeclarationSyntax = SyntaxFactory.MethodDeclaration(attributeLists, modifiers, returnType, explicitInterfaceSpecifier, identifier, typeParameterList, parameterList, constraintClauses, body, expressionBody, semicolonToken); DiagnosticInfo[] diagnostics = ((GreenNode)this).GetDiagnostics(); if (diagnostics != null && diagnostics.Length != 0) { methodDeclarationSyntax = GreenNodeExtensions.WithDiagnosticsGreen(methodDeclarationSyntax, diagnostics); } SyntaxAnnotation[] annotations = ((GreenNode)this).GetAnnotations(); if (annotations != null && annotations.Length != 0) { methodDeclarationSyntax = GreenNodeExtensions.WithAnnotationsGreen(methodDeclarationSyntax, (IEnumerable)annotations); } return methodDeclarationSyntax; } return this; } internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) { return (GreenNode)(object)new MethodDeclarationSyntax(base.Kind, attributeLists, modifiers, returnType, explicitInterfaceSpecifier, identifier, typeParameterList, parameterList, constraintClauses, body, expressionBody, semicolonToken, diagnostics, ((GreenNode)this).GetAnnotations()); } internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) { return (GreenNode)(object)new MethodDeclarationSyntax(base.Kind, attributeLists, modifiers, returnType, explicitInterfaceSpecifier, identifier, typeParameterList, parameterList, constraintClauses, body, expressionBody, semicolonToken, ((GreenNode)this).GetDiagnostics(), annotations); } internal MethodDeclarationSyntax(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 //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: 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; } TypeSyntax typeSyntax = (TypeSyntax)reader.ReadValue(); ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)typeSyntax); returnType = typeSyntax; ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifierSyntax = (ExplicitInterfaceSpecifierSyntax)reader.ReadValue(); if (explicitInterfaceSpecifierSyntax != null) { ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)explicitInterfaceSpecifierSyntax); explicitInterfaceSpecifier = explicitInterfaceSpecifierSyntax; } SyntaxToken syntaxToken = (SyntaxToken)reader.ReadValue(); ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)syntaxToken); identifier = syntaxToken; TypeParameterListSyntax typeParameterListSyntax = (TypeParameterListSyntax)reader.ReadValue(); if (typeParameterListSyntax != null) { ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)typeParameterListSyntax); typeParameterList = typeParameterListSyntax; } ParameterListSyntax parameterListSyntax = (ParameterListSyntax)reader.ReadValue(); ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)parameterListSyntax); parameterList = parameterListSyntax; GreenNode val3 = (GreenNode)reader.ReadValue(); if (val3 != null) { ((GreenNode)this).AdjustFlagsAndWidth(val3); constraintClauses = val3; } 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 syntaxToken2 = (SyntaxToken)reader.ReadValue(); if (syntaxToken2 != null) { ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)syntaxToken2); semicolonToken = syntaxToken2; } } internal override void WriteTo(ObjectWriter writer) { ((GreenNode)this).WriteTo(writer); writer.WriteValue((IObjectWritable)(object)attributeLists); writer.WriteValue((IObjectWritable)(object)modifiers); writer.WriteValue((IObjectWritable)(object)returnType); writer.WriteValue((IObjectWritable)(object)explicitInterfaceSpecifier); writer.WriteValue((IObjectWritable)(object)identifier); writer.WriteValue((IObjectWritable)(object)typeParameterList); writer.WriteValue((IObjectWritable)(object)parameterList); writer.WriteValue((IObjectWritable)(object)constraintClauses); writer.WriteValue((IObjectWritable)(object)body); writer.WriteValue((IObjectWritable)(object)expressionBody); writer.WriteValue((IObjectWritable)(object)semicolonToken); } static MethodDeclarationSyntax() { ObjectBinder.RegisterTypeReader(typeof(MethodDeclarationSyntax), (Func)((ObjectReader r) => (IObjectWritable)(object)new MethodDeclarationSyntax(r))); } }