316 lines
15 KiB
C#
316 lines
15 KiB
C#
using System.Collections.Generic;
|
|
using Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax;
|
|
|
|
namespace Microsoft.CodeAnalysis.CSharp.Syntax;
|
|
|
|
public sealed class ConstructorDeclarationSyntax : BaseMethodDeclarationSyntax
|
|
{
|
|
private SyntaxNode? attributeLists;
|
|
|
|
private ParameterListSyntax? parameterList;
|
|
|
|
private ConstructorInitializerSyntax? initializer;
|
|
|
|
private BlockSyntax? body;
|
|
|
|
private ArrowExpressionClauseSyntax? expressionBody;
|
|
|
|
public override SyntaxList<AttributeListSyntax> AttributeLists => new SyntaxList<AttributeListSyntax>(((SyntaxNode)this).GetRed(ref attributeLists, 0));
|
|
|
|
public override SyntaxTokenList Modifiers
|
|
{
|
|
get
|
|
{
|
|
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
|
|
GreenNode slot = ((SyntaxNode)this).Green.GetSlot(1);
|
|
if (slot == null)
|
|
{
|
|
return default(SyntaxTokenList);
|
|
}
|
|
return new SyntaxTokenList((SyntaxNode)(object)this, slot, ((SyntaxNode)this).GetChildPosition(1), ((SyntaxNode)this).GetChildIndex(1));
|
|
}
|
|
}
|
|
|
|
public SyntaxToken Identifier => new SyntaxToken((SyntaxNode)(object)this, (GreenNode)(object)((Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.ConstructorDeclarationSyntax)(object)((SyntaxNode)this).Green).identifier, ((SyntaxNode)this).GetChildPosition(2), ((SyntaxNode)this).GetChildIndex(2));
|
|
|
|
public override ParameterListSyntax ParameterList => ((SyntaxNode)this).GetRed<ParameterListSyntax>(ref parameterList, 3);
|
|
|
|
public ConstructorInitializerSyntax? Initializer => ((SyntaxNode)this).GetRed<ConstructorInitializerSyntax>(ref initializer, 4);
|
|
|
|
public override BlockSyntax? Body => ((SyntaxNode)this).GetRed<BlockSyntax>(ref body, 5);
|
|
|
|
public override ArrowExpressionClauseSyntax? ExpressionBody => ((SyntaxNode)this).GetRed<ArrowExpressionClauseSyntax>(ref expressionBody, 6);
|
|
|
|
public override SyntaxToken SemicolonToken
|
|
{
|
|
get
|
|
{
|
|
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
|
|
SyntaxToken semicolonToken = ((Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.ConstructorDeclarationSyntax)(object)((SyntaxNode)this).Green).semicolonToken;
|
|
if (semicolonToken == null)
|
|
{
|
|
return default(SyntaxToken);
|
|
}
|
|
return new SyntaxToken((SyntaxNode)(object)this, (GreenNode)(object)semicolonToken, ((SyntaxNode)this).GetChildPosition(7), ((SyntaxNode)this).GetChildIndex(7));
|
|
}
|
|
}
|
|
|
|
public ConstructorDeclarationSyntax Update(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax initializer, BlockSyntax body, SyntaxToken semicolonToken)
|
|
{
|
|
//IL_0001: 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_0003: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
|
|
return Update(attributeLists, modifiers, identifier, parameterList, initializer, body, null, semicolonToken);
|
|
}
|
|
|
|
internal ConstructorDeclarationSyntax(Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position)
|
|
: base(green, parent, position)
|
|
{
|
|
}
|
|
|
|
internal override SyntaxNode? GetNodeSlot(int index)
|
|
{
|
|
return (SyntaxNode?)(index switch
|
|
{
|
|
0 => ((SyntaxNode)this).GetRedAtZero(ref attributeLists),
|
|
3 => ((SyntaxNode)this).GetRed<ParameterListSyntax>(ref parameterList, 3),
|
|
4 => ((SyntaxNode)this).GetRed<ConstructorInitializerSyntax>(ref initializer, 4),
|
|
5 => ((SyntaxNode)this).GetRed<BlockSyntax>(ref body, 5),
|
|
6 => ((SyntaxNode)this).GetRed<ArrowExpressionClauseSyntax>(ref expressionBody, 6),
|
|
_ => null,
|
|
});
|
|
}
|
|
|
|
internal override SyntaxNode? GetCachedSlot(int index)
|
|
{
|
|
return (SyntaxNode?)(index switch
|
|
{
|
|
0 => attributeLists,
|
|
3 => parameterList,
|
|
4 => initializer,
|
|
5 => body,
|
|
6 => expressionBody,
|
|
_ => null,
|
|
});
|
|
}
|
|
|
|
public override void Accept(CSharpSyntaxVisitor visitor)
|
|
{
|
|
visitor.VisitConstructorDeclaration(this);
|
|
}
|
|
|
|
public override TResult? Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor)
|
|
{
|
|
return visitor.VisitConstructorDeclaration(this);
|
|
}
|
|
|
|
public ConstructorDeclarationSyntax Update(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax? initializer, 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_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_0063: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_006c: 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_001c: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
|
|
if (attributeLists != AttributeLists || modifiers != Modifiers || identifier != Identifier || parameterList != ParameterList || initializer != Initializer || body != Body || expressionBody != ExpressionBody || semicolonToken != SemicolonToken)
|
|
{
|
|
ConstructorDeclarationSyntax constructorDeclarationSyntax = SyntaxFactory.ConstructorDeclaration(attributeLists, modifiers, identifier, parameterList, initializer, body, expressionBody, semicolonToken);
|
|
SyntaxAnnotation[] annotations = ((SyntaxNode)this).GetAnnotations();
|
|
if (annotations == null || annotations.Length == 0)
|
|
{
|
|
return constructorDeclarationSyntax;
|
|
}
|
|
return constructorDeclarationSyntax.WithAnnotations(annotations);
|
|
}
|
|
return this;
|
|
}
|
|
|
|
internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList<AttributeListSyntax> attributeLists)
|
|
{
|
|
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
|
|
return WithAttributeLists(attributeLists);
|
|
}
|
|
|
|
public new ConstructorDeclarationSyntax WithAttributeLists(SyntaxList<AttributeListSyntax> attributeLists)
|
|
{
|
|
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
|
|
return Update(attributeLists, Modifiers, Identifier, ParameterList, Initializer, Body, ExpressionBody, SemicolonToken);
|
|
}
|
|
|
|
internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers)
|
|
{
|
|
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
|
|
return WithModifiers(modifiers);
|
|
}
|
|
|
|
public new ConstructorDeclarationSyntax WithModifiers(SyntaxTokenList modifiers)
|
|
{
|
|
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
|
|
return Update(AttributeLists, modifiers, Identifier, ParameterList, Initializer, Body, ExpressionBody, SemicolonToken);
|
|
}
|
|
|
|
public ConstructorDeclarationSyntax WithIdentifier(SyntaxToken identifier)
|
|
{
|
|
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
|
|
return Update(AttributeLists, Modifiers, identifier, ParameterList, Initializer, Body, ExpressionBody, SemicolonToken);
|
|
}
|
|
|
|
internal override BaseMethodDeclarationSyntax WithParameterListCore(ParameterListSyntax parameterList)
|
|
{
|
|
return WithParameterList(parameterList);
|
|
}
|
|
|
|
public new ConstructorDeclarationSyntax WithParameterList(ParameterListSyntax parameterList)
|
|
{
|
|
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0008: 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_0027: Unknown result type (might be due to invalid IL or missing references)
|
|
return Update(AttributeLists, Modifiers, Identifier, parameterList, Initializer, Body, ExpressionBody, SemicolonToken);
|
|
}
|
|
|
|
public ConstructorDeclarationSyntax WithInitializer(ConstructorInitializerSyntax? initializer)
|
|
{
|
|
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0008: 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_0027: Unknown result type (might be due to invalid IL or missing references)
|
|
return Update(AttributeLists, Modifiers, Identifier, ParameterList, initializer, Body, ExpressionBody, SemicolonToken);
|
|
}
|
|
|
|
internal override BaseMethodDeclarationSyntax WithBodyCore(BlockSyntax? body)
|
|
{
|
|
return WithBody(body);
|
|
}
|
|
|
|
public new ConstructorDeclarationSyntax WithBody(BlockSyntax? body)
|
|
{
|
|
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0008: 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_0027: Unknown result type (might be due to invalid IL or missing references)
|
|
return Update(AttributeLists, Modifiers, Identifier, ParameterList, Initializer, body, ExpressionBody, SemicolonToken);
|
|
}
|
|
|
|
internal override BaseMethodDeclarationSyntax WithExpressionBodyCore(ArrowExpressionClauseSyntax? expressionBody)
|
|
{
|
|
return WithExpressionBody(expressionBody);
|
|
}
|
|
|
|
public new ConstructorDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody)
|
|
{
|
|
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0008: 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_0027: Unknown result type (might be due to invalid IL or missing references)
|
|
return Update(AttributeLists, Modifiers, Identifier, ParameterList, Initializer, Body, expressionBody, SemicolonToken);
|
|
}
|
|
|
|
internal override BaseMethodDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken)
|
|
{
|
|
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
|
|
return WithSemicolonToken(semicolonToken);
|
|
}
|
|
|
|
public new ConstructorDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken)
|
|
{
|
|
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0008: 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_002b: Unknown result type (might be due to invalid IL or missing references)
|
|
return Update(AttributeLists, Modifiers, Identifier, ParameterList, Initializer, Body, ExpressionBody, semicolonToken);
|
|
}
|
|
|
|
internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items)
|
|
{
|
|
return AddAttributeLists(items);
|
|
}
|
|
|
|
public new ConstructorDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items)
|
|
{
|
|
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
|
|
return WithAttributeLists(AttributeLists.AddRange((IEnumerable<AttributeListSyntax>)items));
|
|
}
|
|
|
|
internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items)
|
|
{
|
|
return AddModifiers(items);
|
|
}
|
|
|
|
public new ConstructorDeclarationSyntax AddModifiers(params SyntaxToken[] items)
|
|
{
|
|
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
|
|
SyntaxTokenList modifiers = Modifiers;
|
|
return WithModifiers(((SyntaxTokenList)(ref modifiers)).AddRange((IEnumerable<SyntaxToken>)items));
|
|
}
|
|
|
|
internal override BaseMethodDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items)
|
|
{
|
|
return AddParameterListParameters(items);
|
|
}
|
|
|
|
public new ConstructorDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items)
|
|
{
|
|
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
|
|
return WithParameterList(ParameterList.WithParameters(ParameterList.Parameters.AddRange((IEnumerable<ParameterSyntax>)items)));
|
|
}
|
|
|
|
internal override BaseMethodDeclarationSyntax AddBodyAttributeListsCore(params AttributeListSyntax[] items)
|
|
{
|
|
return AddBodyAttributeLists(items);
|
|
}
|
|
|
|
public new ConstructorDeclarationSyntax AddBodyAttributeLists(params AttributeListSyntax[] items)
|
|
{
|
|
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0021: 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_000c: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
|
|
BlockSyntax blockSyntax = Body ?? SyntaxFactory.Block();
|
|
return WithBody(blockSyntax.WithAttributeLists(blockSyntax.AttributeLists.AddRange((IEnumerable<AttributeListSyntax>)items)));
|
|
}
|
|
|
|
internal override BaseMethodDeclarationSyntax AddBodyStatementsCore(params StatementSyntax[] items)
|
|
{
|
|
return AddBodyStatements(items);
|
|
}
|
|
|
|
public new ConstructorDeclarationSyntax AddBodyStatements(params StatementSyntax[] items)
|
|
{
|
|
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0021: 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_000c: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
|
|
BlockSyntax blockSyntax = Body ?? SyntaxFactory.Block();
|
|
return WithBody(blockSyntax.WithStatements(blockSyntax.Statements.AddRange((IEnumerable<StatementSyntax>)items)));
|
|
}
|
|
}
|