Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9877,6 +9877,7 @@ internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new InterpolationFormatClauseSyntax(this.Kind, this.colonToken, this.formatStringToken, GetDiagnostics(), annotations);
}

/// <summary>Represents a global statement in a compilation unit. Global statements are top-level statements that can appear in a C# program or script. In regular C# programs (C# 9.0+), they are synthesized into a Main method. In C# scripts, they are executed as top-level code. See https://github.com/dotnet/csharplang/blob/main/proposals/top-level-statements.md for more information.</summary>
internal sealed partial class GlobalStatementSyntax : MemberDeclarationSyntax
{
internal readonly GreenNode? attributeLists;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6150,6 +6150,7 @@ public InterpolationFormatClauseSyntax Update(SyntaxToken colonToken, SyntaxToke
public InterpolationFormatClauseSyntax WithFormatStringToken(SyntaxToken formatStringToken) => Update(this.ColonToken, formatStringToken);
}

/// <summary>Represents a global statement in a compilation unit. Global statements are top-level statements that can appear in a C# program or script. In regular C# programs (C# 9.0+), they are synthesized into a Main method. In C# scripts, they are executed as top-level code. See https://github.com/dotnet/csharplang/blob/main/proposals/top-level-statements.md for more information.</summary>
/// <remarks>
/// <para>This node is associated with the following syntax kinds:</para>
/// <list type="bullet">
Expand Down
3 changes: 3 additions & 0 deletions src/Compilers/CSharp/Portable/Syntax/Syntax.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2243,6 +2243,9 @@
<!-- Statements -->
<Node Name="GlobalStatementSyntax" Base="MemberDeclarationSyntax">
<Kind Name="GlobalStatement"/>
<TypeComment>
<summary>Represents a global statement in a compilation unit. Global statements are top-level statements that can appear in a C# program or script. In regular C# programs (C# 9.0+), they are synthesized into a Main method. In C# scripts, they are executed as top-level code. See https://github.com/dotnet/csharplang/blob/main/proposals/top-level-statements.md for more information.</summary>
Copy link
Member

@CyrusNajmabadi CyrusNajmabadi Oct 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot consider mentioning that each statement will be wrapped in a GlobalStatementSyntax at the top level. #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in commit e0a8c9a. Added clarification that each statement at the top level of a compilation unit is wrapped in a GlobalStatementSyntax node.

</TypeComment>
<Field Name="AttributeLists" Type="SyntaxList&lt;AttributeListSyntax&gt;" Override="true">
<summary>Always empty on a global statement.</summary>
</Field>
Expand Down
Loading