119 lines
4.7 KiB
C#
119 lines
4.7 KiB
C#
using System;
|
|||
|
|
using System.Collections.Generic;
|
||
|
|
using Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax;
|
||
|
|
|
||
|
|
namespace Microsoft.CodeAnalysis.CSharp.Syntax;
|
||
|
|
|
||
|
|
public sealed class ImplicitObjectCreationExpressionSyntax : BaseObjectCreationExpressionSyntax
|
||
|
|
{
|
||
|
|
private ArgumentListSyntax? argumentList;
|
||
|
|
|
||
|
|
private InitializerExpressionSyntax? initializer;
|
||
|
|
|
||
|
|
public override SyntaxToken NewKeyword => new SyntaxToken((SyntaxNode)(object)this, (GreenNode)(object)((Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.ImplicitObjectCreationExpressionSyntax)(object)((SyntaxNode)this).Green).newKeyword, ((SyntaxNode)this).Position, 0);
|
||
|
|
|
||
|
|
public override ArgumentListSyntax ArgumentList => ((SyntaxNode)this).GetRed<ArgumentListSyntax>(ref argumentList, 1);
|
||
|
|
|
||
|
|
public override InitializerExpressionSyntax? Initializer => ((SyntaxNode)this).GetRed<InitializerExpressionSyntax>(ref initializer, 2);
|
||
|
|
|
||
|
|
internal ImplicitObjectCreationExpressionSyntax(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
|
||
|
|
{
|
||
|
|
1 => ((SyntaxNode)this).GetRed<ArgumentListSyntax>(ref argumentList, 1),
|
||
|
|
2 => ((SyntaxNode)this).GetRed<InitializerExpressionSyntax>(ref initializer, 2),
|
||
|
|
_ => null,
|
||
|
|
});
|
||
|
|
}
|
||
|
|
|
||
|
|
internal override SyntaxNode? GetCachedSlot(int index)
|
||
|
|
{
|
||
|
|
return (SyntaxNode?)(index switch
|
||
|
|
{
|
||
|
|
1 => argumentList,
|
||
|
|
2 => initializer,
|
||
|
|
_ => null,
|
||
|
|
});
|
||
|
|
}
|
||
|
|
|
||
|
|
public override void Accept(CSharpSyntaxVisitor visitor)
|
||
|
|
{
|
||
|
|
visitor.VisitImplicitObjectCreationExpression(this);
|
||
|
|
}
|
||
|
|
|
||
|
|
public override TResult? Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor)
|
||
|
|
{
|
||
|
|
return visitor.VisitImplicitObjectCreationExpression(this);
|
||
|
|
}
|
||
|
|
|
||
|
|
public ImplicitObjectCreationExpressionSyntax Update(SyntaxToken newKeyword, ArgumentListSyntax argumentList, InitializerExpressionSyntax? initializer)
|
||
|
|
{
|
||
|
|
//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_0020: Unknown result type (might be due to invalid IL or missing references)
|
||
|
|
if (newKeyword != NewKeyword || argumentList != ArgumentList || initializer != Initializer)
|
||
|
|
{
|
||
|
|
ImplicitObjectCreationExpressionSyntax implicitObjectCreationExpressionSyntax = SyntaxFactory.ImplicitObjectCreationExpression(newKeyword, argumentList, initializer);
|
||
|
|
SyntaxAnnotation[] annotations = ((SyntaxNode)this).GetAnnotations();
|
||
|
|
if (annotations == null || annotations.Length == 0)
|
||
|
|
{
|
||
|
|
return implicitObjectCreationExpressionSyntax;
|
||
|
|
}
|
||
|
|
return implicitObjectCreationExpressionSyntax.WithAnnotations(annotations);
|
||
|
|
}
|
||
|
|
return this;
|
||
|
|
}
|
||
|
|
|
||
|
|
internal override BaseObjectCreationExpressionSyntax WithNewKeywordCore(SyntaxToken newKeyword)
|
||
|
|
{
|
||
|
|
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
|
||
|
|
return WithNewKeyword(newKeyword);
|
||
|
|
}
|
||
|
|
|
||
|
|
public new ImplicitObjectCreationExpressionSyntax WithNewKeyword(SyntaxToken newKeyword)
|
||
|
|
{
|
||
|
|
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
|
||
|
|
return Update(newKeyword, ArgumentList, Initializer);
|
||
|
|
}
|
||
|
|
|
||
|
|
internal override BaseObjectCreationExpressionSyntax WithArgumentListCore(ArgumentListSyntax? argumentList)
|
||
|
|
{
|
||
|
|
return WithArgumentList(argumentList ?? throw new ArgumentNullException("argumentList"));
|
||
|
|
}
|
||
|
|
|
||
|
|
public new ImplicitObjectCreationExpressionSyntax WithArgumentList(ArgumentListSyntax argumentList)
|
||
|
|
{
|
||
|
|
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
|
||
|
|
return Update(NewKeyword, argumentList, Initializer);
|
||
|
|
}
|
||
|
|
|
||
|
|
internal override BaseObjectCreationExpressionSyntax WithInitializerCore(InitializerExpressionSyntax? initializer)
|
||
|
|
{
|
||
|
|
return WithInitializer(initializer);
|
||
|
|
}
|
||
|
|
|
||
|
|
public new ImplicitObjectCreationExpressionSyntax WithInitializer(InitializerExpressionSyntax? initializer)
|
||
|
|
{
|
||
|
|
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
|
||
|
|
return Update(NewKeyword, ArgumentList, initializer);
|
||
|
|
}
|
||
|
|
|
||
|
|
internal override BaseObjectCreationExpressionSyntax AddArgumentListArgumentsCore(params ArgumentSyntax[] items)
|
||
|
|
{
|
||
|
|
return AddArgumentListArguments(items);
|
||
|
|
}
|
||
|
|
|
||
|
|
public new ImplicitObjectCreationExpressionSyntax AddArgumentListArguments(params ArgumentSyntax[] 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 WithArgumentList(ArgumentList.WithArguments(ArgumentList.Arguments.AddRange((IEnumerable<ArgumentSyntax>)items)));
|
||
|
|
}
|
||
|
|
}
|