using System; using System.Collections.Generic; using Microsoft.CodeAnalysis.Syntax.InternalSyntax; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax; internal sealed class IndexerDeclarationSyntax : BasePropertyDeclarationSyntax { internal readonly GreenNode? attributeLists; internal readonly GreenNode? modifiers; internal readonly TypeSyntax type; internal readonly ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; internal readonly SyntaxToken thisKeyword; internal readonly BracketedParameterListSyntax parameterList; internal readonly AccessorListSyntax? accessorList; internal readonly ArrowExpressionClauseSyntax? expressionBody; internal readonly SyntaxToken? semicolonToken; public override SyntaxList AttributeLists => new SyntaxList(attributeLists); public override SyntaxList Modifiers => new SyntaxList(modifiers); public override TypeSyntax Type => type; public override ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => explicitInterfaceSpecifier; public SyntaxToken ThisKeyword => thisKeyword; public BracketedParameterListSyntax ParameterList => parameterList; public override AccessorListSyntax? AccessorList => accessorList; public ArrowExpressionClauseSyntax? ExpressionBody => expressionBody; public SyntaxToken? SemicolonToken => semicolonToken; internal IndexerDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) : base(kind, diagnostics, annotations) { ((GreenNode)this).SlotCount = 9; 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; if (explicitInterfaceSpecifier != null) { ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)explicitInterfaceSpecifier); this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; } ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)thisKeyword); this.thisKeyword = thisKeyword; ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)parameterList); this.parameterList = parameterList; if (accessorList != null) { ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)accessorList); this.accessorList = accessorList; } 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 IndexerDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, SyntaxFactoryContext context) : base(kind) { SetFactoryContext(context); ((GreenNode)this).SlotCount = 9; 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; if (explicitInterfaceSpecifier != null) { ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)explicitInterfaceSpecifier); this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; } ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)thisKeyword); this.thisKeyword = thisKeyword; ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)parameterList); this.parameterList = parameterList; if (accessorList != null) { ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)accessorList); this.accessorList = accessorList; } 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 IndexerDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) : base(kind) { ((GreenNode)this).SlotCount = 9; 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; if (explicitInterfaceSpecifier != null) { ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)explicitInterfaceSpecifier); this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; } ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)thisKeyword); this.thisKeyword = thisKeyword; ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)parameterList); this.parameterList = parameterList; if (accessorList != null) { ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)accessorList); this.accessorList = accessorList; } 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 => type, 3 => explicitInterfaceSpecifier, 4 => thisKeyword, 5 => parameterList, 6 => accessorList, 7 => expressionBody, 8 => semicolonToken, _ => null, }); } internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) { return (SyntaxNode)(object)new Microsoft.CodeAnalysis.CSharp.Syntax.IndexerDeclarationSyntax(this, parent, position); } public override void Accept(CSharpSyntaxVisitor visitor) { visitor.VisitIndexerDeclaration(this); } public override TResult Accept(CSharpSyntaxVisitor visitor) { return visitor.VisitIndexerDeclaration(this); } public IndexerDeclarationSyntax Update(SyntaxList attributeLists, SyntaxList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax accessorList, 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_0061: 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) //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 || explicitInterfaceSpecifier != ExplicitInterfaceSpecifier || thisKeyword != ThisKeyword || parameterList != ParameterList || accessorList != AccessorList || expressionBody != ExpressionBody || semicolonToken != SemicolonToken) { IndexerDeclarationSyntax indexerDeclarationSyntax = SyntaxFactory.IndexerDeclaration(attributeLists, modifiers, type, explicitInterfaceSpecifier, thisKeyword, parameterList, accessorList, expressionBody, semicolonToken); DiagnosticInfo[] diagnostics = ((GreenNode)this).GetDiagnostics(); if (diagnostics != null && diagnostics.Length != 0) { indexerDeclarationSyntax = GreenNodeExtensions.WithDiagnosticsGreen(indexerDeclarationSyntax, diagnostics); } SyntaxAnnotation[] annotations = ((GreenNode)this).GetAnnotations(); if (annotations != null && annotations.Length != 0) { indexerDeclarationSyntax = GreenNodeExtensions.WithAnnotationsGreen(indexerDeclarationSyntax, (IEnumerable)annotations); } return indexerDeclarationSyntax; } return this; } internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) { return (GreenNode)(object)new IndexerDeclarationSyntax(base.Kind, attributeLists, modifiers, type, explicitInterfaceSpecifier, thisKeyword, parameterList, accessorList, expressionBody, semicolonToken, diagnostics, ((GreenNode)this).GetAnnotations()); } internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) { return (GreenNode)(object)new IndexerDeclarationSyntax(base.Kind, attributeLists, modifiers, type, explicitInterfaceSpecifier, thisKeyword, parameterList, accessorList, expressionBody, semicolonToken, ((GreenNode)this).GetDiagnostics(), annotations); } internal IndexerDeclarationSyntax(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 ((GreenNode)this).SlotCount = 9; 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; 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); thisKeyword = syntaxToken; BracketedParameterListSyntax bracketedParameterListSyntax = (BracketedParameterListSyntax)reader.ReadValue(); ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)bracketedParameterListSyntax); parameterList = bracketedParameterListSyntax; AccessorListSyntax accessorListSyntax = (AccessorListSyntax)reader.ReadValue(); if (accessorListSyntax != null) { ((GreenNode)this).AdjustFlagsAndWidth((GreenNode)(object)accessorListSyntax); accessorList = accessorListSyntax; } 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)type); writer.WriteValue((IObjectWritable)(object)explicitInterfaceSpecifier); writer.WriteValue((IObjectWritable)(object)thisKeyword); writer.WriteValue((IObjectWritable)(object)parameterList); writer.WriteValue((IObjectWritable)(object)accessorList); writer.WriteValue((IObjectWritable)(object)expressionBody); writer.WriteValue((IObjectWritable)(object)semicolonToken); } static IndexerDeclarationSyntax() { ObjectBinder.RegisterTypeReader(typeof(IndexerDeclarationSyntax), (Func)((ObjectReader r) => (IObjectWritable)(object)new IndexerDeclarationSyntax(r))); } }