328 lines
17 KiB
C#
328 lines
17 KiB
C#
using System.Collections.Generic;
|
|
using Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax;
|
|
|
|
namespace Microsoft.CodeAnalysis.CSharp.Syntax;
|
|
|
|
public sealed class FileScopedNamespaceDeclarationSyntax : BaseNamespaceDeclarationSyntax
|
|
{
|
|
private SyntaxNode? attributeLists;
|
|
|
|
private NameSyntax? name;
|
|
|
|
private SyntaxNode? externs;
|
|
|
|
private SyntaxNode? usings;
|
|
|
|
private SyntaxNode? members;
|
|
|
|
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 override SyntaxToken NamespaceKeyword => new SyntaxToken((SyntaxNode)(object)this, (GreenNode)(object)((Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.FileScopedNamespaceDeclarationSyntax)(object)((SyntaxNode)this).Green).namespaceKeyword, ((SyntaxNode)this).GetChildPosition(2), ((SyntaxNode)this).GetChildIndex(2));
|
|
|
|
public override NameSyntax Name => ((SyntaxNode)this).GetRed<NameSyntax>(ref name, 3);
|
|
|
|
public SyntaxToken SemicolonToken => new SyntaxToken((SyntaxNode)(object)this, (GreenNode)(object)((Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.FileScopedNamespaceDeclarationSyntax)(object)((SyntaxNode)this).Green).semicolonToken, ((SyntaxNode)this).GetChildPosition(4), ((SyntaxNode)this).GetChildIndex(4));
|
|
|
|
public override SyntaxList<ExternAliasDirectiveSyntax> Externs => new SyntaxList<ExternAliasDirectiveSyntax>(((SyntaxNode)this).GetRed(ref externs, 5));
|
|
|
|
public override SyntaxList<UsingDirectiveSyntax> Usings => new SyntaxList<UsingDirectiveSyntax>(((SyntaxNode)this).GetRed(ref usings, 6));
|
|
|
|
public override SyntaxList<MemberDeclarationSyntax> Members => new SyntaxList<MemberDeclarationSyntax>(((SyntaxNode)this).GetRed(ref members, 7));
|
|
|
|
internal FileScopedNamespaceDeclarationSyntax(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<NameSyntax>(ref name, 3),
|
|
5 => ((SyntaxNode)this).GetRed(ref externs, 5),
|
|
6 => ((SyntaxNode)this).GetRed(ref usings, 6),
|
|
7 => ((SyntaxNode)this).GetRed(ref members, 7),
|
|
_ => null,
|
|
});
|
|
}
|
|
|
|
internal override SyntaxNode? GetCachedSlot(int index)
|
|
{
|
|
return (SyntaxNode?)(index switch
|
|
{
|
|
0 => attributeLists,
|
|
3 => name,
|
|
5 => externs,
|
|
6 => usings,
|
|
7 => members,
|
|
_ => null,
|
|
});
|
|
}
|
|
|
|
public override void Accept(CSharpSyntaxVisitor visitor)
|
|
{
|
|
visitor.VisitFileScopedNamespaceDeclaration(this);
|
|
}
|
|
|
|
public override TResult? Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor)
|
|
{
|
|
return visitor.VisitFileScopedNamespaceDeclaration(this);
|
|
}
|
|
|
|
public FileScopedNamespaceDeclarationSyntax Update(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, SyntaxList<ExternAliasDirectiveSyntax> externs, SyntaxList<UsingDirectiveSyntax> usings, SyntaxList<MemberDeclarationSyntax> members)
|
|
{
|
|
//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_0070: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0079: 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_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_0034: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0046: 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)
|
|
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
|
|
if (attributeLists != AttributeLists || modifiers != Modifiers || namespaceKeyword != NamespaceKeyword || name != Name || semicolonToken != SemicolonToken || externs != Externs || usings != Usings || members != Members)
|
|
{
|
|
FileScopedNamespaceDeclarationSyntax fileScopedNamespaceDeclarationSyntax = SyntaxFactory.FileScopedNamespaceDeclaration(attributeLists, modifiers, namespaceKeyword, name, semicolonToken, externs, usings, members);
|
|
SyntaxAnnotation[] annotations = ((SyntaxNode)this).GetAnnotations();
|
|
if (annotations == null || annotations.Length == 0)
|
|
{
|
|
return fileScopedNamespaceDeclarationSyntax;
|
|
}
|
|
return fileScopedNamespaceDeclarationSyntax.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 FileScopedNamespaceDeclarationSyntax 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_0015: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_001b: 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_0027: Unknown result type (might be due to invalid IL or missing references)
|
|
return Update(attributeLists, Modifiers, NamespaceKeyword, Name, SemicolonToken, Externs, Usings, Members);
|
|
}
|
|
|
|
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 FileScopedNamespaceDeclarationSyntax 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_0015: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_001b: 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_0027: Unknown result type (might be due to invalid IL or missing references)
|
|
return Update(AttributeLists, modifiers, NamespaceKeyword, Name, SemicolonToken, Externs, Usings, Members);
|
|
}
|
|
|
|
internal override BaseNamespaceDeclarationSyntax WithNamespaceKeywordCore(SyntaxToken namespaceKeyword)
|
|
{
|
|
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
|
|
return WithNamespaceKeyword(namespaceKeyword);
|
|
}
|
|
|
|
public new FileScopedNamespaceDeclarationSyntax WithNamespaceKeyword(SyntaxToken namespaceKeyword)
|
|
{
|
|
//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_0015: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_001b: 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_0027: Unknown result type (might be due to invalid IL or missing references)
|
|
return Update(AttributeLists, Modifiers, namespaceKeyword, Name, SemicolonToken, Externs, Usings, Members);
|
|
}
|
|
|
|
internal override BaseNamespaceDeclarationSyntax WithNameCore(NameSyntax name)
|
|
{
|
|
return WithName(name);
|
|
}
|
|
|
|
public new FileScopedNamespaceDeclarationSyntax WithName(NameSyntax name)
|
|
{
|
|
//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_0015: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_001b: 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_0027: Unknown result type (might be due to invalid IL or missing references)
|
|
return Update(AttributeLists, Modifiers, NamespaceKeyword, name, SemicolonToken, Externs, Usings, Members);
|
|
}
|
|
|
|
public FileScopedNamespaceDeclarationSyntax 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_0019: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_001b: 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_0027: Unknown result type (might be due to invalid IL or missing references)
|
|
return Update(AttributeLists, Modifiers, NamespaceKeyword, Name, semicolonToken, Externs, Usings, Members);
|
|
}
|
|
|
|
internal override BaseNamespaceDeclarationSyntax WithExternsCore(SyntaxList<ExternAliasDirectiveSyntax> externs)
|
|
{
|
|
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
|
|
return WithExterns(externs);
|
|
}
|
|
|
|
public new FileScopedNamespaceDeclarationSyntax WithExterns(SyntaxList<ExternAliasDirectiveSyntax> externs)
|
|
{
|
|
//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_001a: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_001f: 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_0027: Unknown result type (might be due to invalid IL or missing references)
|
|
return Update(AttributeLists, Modifiers, NamespaceKeyword, Name, SemicolonToken, externs, Usings, Members);
|
|
}
|
|
|
|
internal override BaseNamespaceDeclarationSyntax WithUsingsCore(SyntaxList<UsingDirectiveSyntax> usings)
|
|
{
|
|
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
|
|
return WithUsings(usings);
|
|
}
|
|
|
|
public new FileScopedNamespaceDeclarationSyntax WithUsings(SyntaxList<UsingDirectiveSyntax> usings)
|
|
{
|
|
//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_001a: 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)
|
|
//IL_0025: 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, NamespaceKeyword, Name, SemicolonToken, Externs, usings, Members);
|
|
}
|
|
|
|
internal override BaseNamespaceDeclarationSyntax WithMembersCore(SyntaxList<MemberDeclarationSyntax> members)
|
|
{
|
|
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
|
|
return WithMembers(members);
|
|
}
|
|
|
|
public new FileScopedNamespaceDeclarationSyntax WithMembers(SyntaxList<MemberDeclarationSyntax> members)
|
|
{
|
|
//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_001a: 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)
|
|
//IL_0026: 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, NamespaceKeyword, Name, SemicolonToken, Externs, Usings, members);
|
|
}
|
|
|
|
internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items)
|
|
{
|
|
return AddAttributeLists(items);
|
|
}
|
|
|
|
public new FileScopedNamespaceDeclarationSyntax 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 FileScopedNamespaceDeclarationSyntax 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 BaseNamespaceDeclarationSyntax AddExternsCore(params ExternAliasDirectiveSyntax[] items)
|
|
{
|
|
return AddExterns(items);
|
|
}
|
|
|
|
public new FileScopedNamespaceDeclarationSyntax AddExterns(params ExternAliasDirectiveSyntax[] 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 WithExterns(Externs.AddRange((IEnumerable<ExternAliasDirectiveSyntax>)items));
|
|
}
|
|
|
|
internal override BaseNamespaceDeclarationSyntax AddUsingsCore(params UsingDirectiveSyntax[] items)
|
|
{
|
|
return AddUsings(items);
|
|
}
|
|
|
|
public new FileScopedNamespaceDeclarationSyntax AddUsings(params UsingDirectiveSyntax[] 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 WithUsings(Usings.AddRange((IEnumerable<UsingDirectiveSyntax>)items));
|
|
}
|
|
|
|
internal override BaseNamespaceDeclarationSyntax AddMembersCore(params MemberDeclarationSyntax[] items)
|
|
{
|
|
return AddMembers(items);
|
|
}
|
|
|
|
public new FileScopedNamespaceDeclarationSyntax AddMembers(params MemberDeclarationSyntax[] 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 WithMembers(Members.AddRange((IEnumerable<MemberDeclarationSyntax>)items));
|
|
}
|
|
}
|