Skip to content

Commit 5d80619

Browse files
[automated] Merge branch 'main' => 'release/dev17.15' (#77870)
I detected changes in the main branch which have not been merged yet to release/dev17.15. I'm a robot and am configured to help you automatically keep release/dev17.15 up to date, so I've opened this PR. This PR merges commits made on main by the following committers: * dibarbet * jjonescz ## Instructions for merging from UI This PR will not be auto-merged. When pull request checks pass, complete this PR by creating a merge commit, *not* a squash or rebase commit. <img alt="merge button instructions" src="https://i.imgur.com/GepcNJV.png" width="300" /> If this repo does not allow creating merge commits from the GitHub UI, use command line instructions. ## Instructions for merging via command line Run these commands to merge this pull request from the command line. ``` sh git fetch git checkout main git pull --ff-only git checkout release/dev17.15 git pull --ff-only git merge --no-ff main # If there are merge conflicts, resolve them and then run git merge --continue to complete the merge # Pushing the changes to the PR branch will re-trigger PR validation. git push https://github.com/dotnet/roslyn HEAD:merge/main-to-release/dev17.15 ``` <details> <summary>or if you are using SSH</summary> ``` git push git@github.com:dotnet/roslyn HEAD:merge/main-to-release/dev17.15 ``` </details> After PR checks are complete push the branch ``` git push ``` ## Instructions for resolving conflicts :warning: If there are merge conflicts, you will need to resolve them manually before merging. You can do this [using GitHub][resolve-github] or using the [command line][resolve-cli]. [resolve-github]: https://help.github.com/articles/resolving-a-merge-conflict-on-github/ [resolve-cli]: https://help.github.com/articles/resolving-a-merge-conflict-using-the-command-line/ ## Instructions for updating this pull request Contributors to this repo have permission update this pull request by pushing to the branch 'merge/main-to-release/dev17.15'. This can be done to resolve conflicts or make other changes to this pull request before it is merged. The provided examples assume that the remote is named 'origin'. If you have a different remote name, please replace 'origin' with the name of your remote. ``` git fetch git checkout -b merge/main-to-release/dev17.15 origin/release/dev17.15 git pull https://github.com/dotnet/roslyn merge/main-to-release/dev17.15 (make changes) git commit -m "Updated PR with my changes" git push https://github.com/dotnet/roslyn HEAD:merge/main-to-release/dev17.15 ``` <details> <summary>or if you are using SSH</summary> ``` git fetch git checkout -b merge/main-to-release/dev17.15 origin/release/dev17.15 git pull git@github.com:dotnet/roslyn merge/main-to-release/dev17.15 (make changes) git commit -m "Updated PR with my changes" git push git@github.com:dotnet/roslyn HEAD:merge/main-to-release/dev17.15 ``` </details> Contact .NET Core Engineering (dotnet/dnceng) if you have questions or issues. Also, if this PR was generated incorrectly, help us fix it. See https://github.com/dotnet/arcade/blob/main/.github/workflows/scripts/inter-branch-merge.ps1.
2 parents 36b57da + 4b22efb commit 5d80619

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1399
-50
lines changed

eng/targets/Settings.props

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
<!-- TODO: https://github.com/dotnet/roslyn/issues/71667 -->
1818
<NoWarn>$(NoWarn);NU1507</NoWarn>
1919

20+
<NoWarn>$(NoWarn);RSEXPERIMENTAL005</NoWarn>
21+
2022
<CommonExtensionInstallationRoot>CommonExtensions</CommonExtensionInstallationRoot>
2123
<LanguageServicesExtensionInstallationFolder>Microsoft\VBCSharp\LanguageServices</LanguageServicesExtensionInstallationFolder>
2224

src/Compilers/CSharp/Portable/CSharpParseOptions.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,14 @@ static void addSingleNamespaceParts(ArrayBuilder<ImmutableArray<string>> namespa
230230
}
231231
}
232232

233+
/// <summary>
234+
/// Used for parsing .cs file-based programs.
235+
/// </summary>
236+
/// <remarks>
237+
/// In this mode, ignored directives <c>#:</c> are allowed.
238+
/// </remarks>
239+
internal bool FileBasedProgram => Features.ContainsKey("FileBasedProgram");
240+
233241
internal override void ValidateOptions(ArrayBuilder<Diagnostic> builder)
234242
{
235243
ValidateOptions(builder, MessageProvider.Instance);

src/Compilers/CSharp/Portable/CSharpResources.resx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8122,4 +8122,13 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ
81228122
<data name="ERR_ExpressionTreeContainsExtensionPropertyAccess" xml:space="preserve">
81238123
<value>An expression tree may not contain an extension property access</value>
81248124
</data>
8125+
<data name="ERR_PPIgnoredFollowsToken" xml:space="preserve">
8126+
<value>'#:' directives cannot be after first token in file</value>
8127+
</data>
8128+
<data name="ERR_PPIgnoredNeedsFileBasedProgram" xml:space="preserve">
8129+
<value>'#:' directives can be only used in file-based programs ('/feature:FileBasedProgram')</value>
8130+
</data>
8131+
<data name="ERR_PPIgnoredFollowsIf" xml:space="preserve">
8132+
<value>'#:' directives cannot be after '#if' directive</value>
8133+
</data>
81258134
</root>

src/Compilers/CSharp/Portable/Errors/ErrorCode.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2386,13 +2386,19 @@ internal enum ErrorCode
23862386
ERR_UnderspecifiedExtension = 9295,
23872387
ERR_ExpressionTreeContainsExtensionPropertyAccess = 9296,
23882388

2389+
ERR_PPIgnoredFollowsToken = 9297,
2390+
ERR_PPIgnoredNeedsFileBasedProgram = 9298,
2391+
ERR_PPIgnoredFollowsIf = 9299,
2392+
23892393
// Note: you will need to do the following after adding errors:
23902394
// 1) Update ErrorFacts.IsBuildOnlyDiagnostic (src/Compilers/CSharp/Portable/Errors/ErrorFacts.cs)
2395+
// 2) Add message to CSharpResources.resx
23912396

23922397
// Note: you will need to do the following after adding warnings:
23932398
// 1) Re-generate compiler code (eng\generate-compiler-code.cmd).
23942399
// 2) Update ErrorFacts.IsBuildOnlyDiagnostic (src/Compilers/CSharp/Portable/Errors/ErrorFacts.cs)
23952400
// 3) Update ErrorFacts.GetWarningLevel (src/Compilers/CSharp/Portable/Errors/ErrorFacts.cs)
23962401
// 4) Update DiagnosticTest.WarningLevel_2 (src/Compilers/CSharp/Test/Syntax/Diagnostics/DiagnosticTest.cs)
2402+
// 5) Add message and '_Title' to CSharpResources.resx
23972403
}
23982404
}

src/Compilers/CSharp/Portable/Errors/ErrorFacts.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2503,6 +2503,9 @@ or ErrorCode.ERR_InvalidExtensionParameterReference
25032503
or ErrorCode.ERR_ValueParameterSameNameAsExtensionTypeParameter
25042504
or ErrorCode.ERR_UnderspecifiedExtension
25052505
or ErrorCode.ERR_ExpressionTreeContainsExtensionPropertyAccess
2506+
or ErrorCode.ERR_PPIgnoredFollowsToken
2507+
or ErrorCode.ERR_PPIgnoredNeedsFileBasedProgram
2508+
or ErrorCode.ERR_PPIgnoredFollowsIf
25062509
=> false,
25072510
};
25082511
#pragma warning restore CS8524 // The switch expression does not handle some values of its input type (it is not exhaustive) involving an unnamed enum value.

src/Compilers/CSharp/Portable/Generated/CSharp.Generated.g4

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Internal.Generated.cs

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26604,6 +26604,96 @@ internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
2660426604
=> new ShebangDirectiveTriviaSyntax(this.Kind, this.hashToken, this.exclamationToken, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations);
2660526605
}
2660626606

26607+
internal sealed partial class IgnoredDirectiveTriviaSyntax : DirectiveTriviaSyntax
26608+
{
26609+
internal readonly SyntaxToken hashToken;
26610+
internal readonly SyntaxToken colonToken;
26611+
internal readonly SyntaxToken endOfDirectiveToken;
26612+
internal readonly bool isActive;
26613+
26614+
internal IgnoredDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken colonToken, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
26615+
: base(kind, diagnostics, annotations)
26616+
{
26617+
this.SlotCount = 3;
26618+
this.AdjustFlagsAndWidth(hashToken);
26619+
this.hashToken = hashToken;
26620+
this.AdjustFlagsAndWidth(colonToken);
26621+
this.colonToken = colonToken;
26622+
this.AdjustFlagsAndWidth(endOfDirectiveToken);
26623+
this.endOfDirectiveToken = endOfDirectiveToken;
26624+
this.isActive = isActive;
26625+
}
26626+
26627+
internal IgnoredDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken colonToken, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context)
26628+
: base(kind)
26629+
{
26630+
this.SetFactoryContext(context);
26631+
this.SlotCount = 3;
26632+
this.AdjustFlagsAndWidth(hashToken);
26633+
this.hashToken = hashToken;
26634+
this.AdjustFlagsAndWidth(colonToken);
26635+
this.colonToken = colonToken;
26636+
this.AdjustFlagsAndWidth(endOfDirectiveToken);
26637+
this.endOfDirectiveToken = endOfDirectiveToken;
26638+
this.isActive = isActive;
26639+
}
26640+
26641+
internal IgnoredDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken colonToken, SyntaxToken endOfDirectiveToken, bool isActive)
26642+
: base(kind)
26643+
{
26644+
this.SlotCount = 3;
26645+
this.AdjustFlagsAndWidth(hashToken);
26646+
this.hashToken = hashToken;
26647+
this.AdjustFlagsAndWidth(colonToken);
26648+
this.colonToken = colonToken;
26649+
this.AdjustFlagsAndWidth(endOfDirectiveToken);
26650+
this.endOfDirectiveToken = endOfDirectiveToken;
26651+
this.isActive = isActive;
26652+
}
26653+
26654+
public override SyntaxToken HashToken => this.hashToken;
26655+
public SyntaxToken ColonToken => this.colonToken;
26656+
public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken;
26657+
public override bool IsActive => this.isActive;
26658+
26659+
internal override GreenNode? GetSlot(int index)
26660+
=> index switch
26661+
{
26662+
0 => this.hashToken,
26663+
1 => this.colonToken,
26664+
2 => this.endOfDirectiveToken,
26665+
_ => null,
26666+
};
26667+
26668+
internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.IgnoredDirectiveTriviaSyntax(this, parent, position);
26669+
26670+
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIgnoredDirectiveTrivia(this);
26671+
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitIgnoredDirectiveTrivia(this);
26672+
26673+
public IgnoredDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken colonToken, SyntaxToken endOfDirectiveToken, bool isActive)
26674+
{
26675+
if (hashToken != this.HashToken || colonToken != this.ColonToken || endOfDirectiveToken != this.EndOfDirectiveToken)
26676+
{
26677+
var newNode = SyntaxFactory.IgnoredDirectiveTrivia(hashToken, colonToken, endOfDirectiveToken, isActive);
26678+
var diags = GetDiagnostics();
26679+
if (diags?.Length > 0)
26680+
newNode = newNode.WithDiagnosticsGreen(diags);
26681+
var annotations = GetAnnotations();
26682+
if (annotations?.Length > 0)
26683+
newNode = newNode.WithAnnotationsGreen(annotations);
26684+
return newNode;
26685+
}
26686+
26687+
return this;
26688+
}
26689+
26690+
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
26691+
=> new IgnoredDirectiveTriviaSyntax(this.Kind, this.hashToken, this.colonToken, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations());
26692+
26693+
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
26694+
=> new IgnoredDirectiveTriviaSyntax(this.Kind, this.hashToken, this.colonToken, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations);
26695+
}
26696+
2660726697
internal sealed partial class NullableDirectiveTriviaSyntax : DirectiveTriviaSyntax
2660826698
{
2660926699
internal readonly SyntaxToken hashToken;
@@ -26967,6 +27057,7 @@ internal partial class CSharpSyntaxVisitor<TResult>
2696727057
public virtual TResult VisitReferenceDirectiveTrivia(ReferenceDirectiveTriviaSyntax node) => this.DefaultVisit(node);
2696827058
public virtual TResult VisitLoadDirectiveTrivia(LoadDirectiveTriviaSyntax node) => this.DefaultVisit(node);
2696927059
public virtual TResult VisitShebangDirectiveTrivia(ShebangDirectiveTriviaSyntax node) => this.DefaultVisit(node);
27060+
public virtual TResult VisitIgnoredDirectiveTrivia(IgnoredDirectiveTriviaSyntax node) => this.DefaultVisit(node);
2697027061
public virtual TResult VisitNullableDirectiveTrivia(NullableDirectiveTriviaSyntax node) => this.DefaultVisit(node);
2697127062
}
2697227063

@@ -27216,6 +27307,7 @@ internal partial class CSharpSyntaxVisitor
2721627307
public virtual void VisitReferenceDirectiveTrivia(ReferenceDirectiveTriviaSyntax node) => this.DefaultVisit(node);
2721727308
public virtual void VisitLoadDirectiveTrivia(LoadDirectiveTriviaSyntax node) => this.DefaultVisit(node);
2721827309
public virtual void VisitShebangDirectiveTrivia(ShebangDirectiveTriviaSyntax node) => this.DefaultVisit(node);
27310+
public virtual void VisitIgnoredDirectiveTrivia(IgnoredDirectiveTriviaSyntax node) => this.DefaultVisit(node);
2721927311
public virtual void VisitNullableDirectiveTrivia(NullableDirectiveTriviaSyntax node) => this.DefaultVisit(node);
2722027312
}
2722127313

@@ -27953,6 +28045,9 @@ public override CSharpSyntaxNode VisitLoadDirectiveTrivia(LoadDirectiveTriviaSyn
2795328045
public override CSharpSyntaxNode VisitShebangDirectiveTrivia(ShebangDirectiveTriviaSyntax node)
2795428046
=> node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.ExclamationToken), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive);
2795528047

28048+
public override CSharpSyntaxNode VisitIgnoredDirectiveTrivia(IgnoredDirectiveTriviaSyntax node)
28049+
=> node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.ColonToken), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive);
28050+
2795628051
public override CSharpSyntaxNode VisitNullableDirectiveTrivia(NullableDirectiveTriviaSyntax node)
2795728052
=> node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.NullableKeyword), (SyntaxToken)Visit(node.SettingToken), (SyntaxToken)Visit(node.TargetToken), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive);
2795828053
}
@@ -33237,6 +33332,20 @@ public ShebangDirectiveTriviaSyntax ShebangDirectiveTrivia(SyntaxToken hashToken
3323733332
return new ShebangDirectiveTriviaSyntax(SyntaxKind.ShebangDirectiveTrivia, hashToken, exclamationToken, endOfDirectiveToken, isActive, this.context);
3323833333
}
3323933334

33335+
public IgnoredDirectiveTriviaSyntax IgnoredDirectiveTrivia(SyntaxToken hashToken, SyntaxToken colonToken, SyntaxToken endOfDirectiveToken, bool isActive)
33336+
{
33337+
#if DEBUG
33338+
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
33339+
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
33340+
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
33341+
if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken));
33342+
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
33343+
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
33344+
#endif
33345+
33346+
return new IgnoredDirectiveTriviaSyntax(SyntaxKind.IgnoredDirectiveTrivia, hashToken, colonToken, endOfDirectiveToken, isActive, this.context);
33347+
}
33348+
3324033349
public NullableDirectiveTriviaSyntax NullableDirectiveTrivia(SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken? targetToken, SyntaxToken endOfDirectiveToken, bool isActive)
3324133350
{
3324233351
#if DEBUG
@@ -38545,6 +38654,20 @@ public static ShebangDirectiveTriviaSyntax ShebangDirectiveTrivia(SyntaxToken ha
3854538654
return new ShebangDirectiveTriviaSyntax(SyntaxKind.ShebangDirectiveTrivia, hashToken, exclamationToken, endOfDirectiveToken, isActive);
3854638655
}
3854738656

38657+
public static IgnoredDirectiveTriviaSyntax IgnoredDirectiveTrivia(SyntaxToken hashToken, SyntaxToken colonToken, SyntaxToken endOfDirectiveToken, bool isActive)
38658+
{
38659+
#if DEBUG
38660+
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
38661+
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
38662+
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
38663+
if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken));
38664+
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
38665+
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
38666+
#endif
38667+
38668+
return new IgnoredDirectiveTriviaSyntax(SyntaxKind.IgnoredDirectiveTrivia, hashToken, colonToken, endOfDirectiveToken, isActive);
38669+
}
38670+
3854838671
public static NullableDirectiveTriviaSyntax NullableDirectiveTrivia(SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken? targetToken, SyntaxToken endOfDirectiveToken, bool isActive)
3854938672
{
3855038673
#if DEBUG

src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Main.Generated.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,9 @@ public partial class CSharpSyntaxVisitor<TResult>
747747
/// <summary>Called when the visitor visits a ShebangDirectiveTriviaSyntax node.</summary>
748748
public virtual TResult? VisitShebangDirectiveTrivia(ShebangDirectiveTriviaSyntax node) => this.DefaultVisit(node);
749749

750+
/// <summary>Called when the visitor visits a IgnoredDirectiveTriviaSyntax node.</summary>
751+
public virtual TResult? VisitIgnoredDirectiveTrivia(IgnoredDirectiveTriviaSyntax node) => this.DefaultVisit(node);
752+
750753
/// <summary>Called when the visitor visits a NullableDirectiveTriviaSyntax node.</summary>
751754
public virtual TResult? VisitNullableDirectiveTrivia(NullableDirectiveTriviaSyntax node) => this.DefaultVisit(node);
752755
}
@@ -1485,6 +1488,9 @@ public partial class CSharpSyntaxVisitor
14851488
/// <summary>Called when the visitor visits a ShebangDirectiveTriviaSyntax node.</summary>
14861489
public virtual void VisitShebangDirectiveTrivia(ShebangDirectiveTriviaSyntax node) => this.DefaultVisit(node);
14871490

1491+
/// <summary>Called when the visitor visits a IgnoredDirectiveTriviaSyntax node.</summary>
1492+
public virtual void VisitIgnoredDirectiveTrivia(IgnoredDirectiveTriviaSyntax node) => this.DefaultVisit(node);
1493+
14881494
/// <summary>Called when the visitor visits a NullableDirectiveTriviaSyntax node.</summary>
14891495
public virtual void VisitNullableDirectiveTrivia(NullableDirectiveTriviaSyntax node) => this.DefaultVisit(node);
14901496
}
@@ -2223,6 +2229,9 @@ public partial class CSharpSyntaxRewriter : CSharpSyntaxVisitor<SyntaxNode?>
22232229
public override SyntaxNode? VisitShebangDirectiveTrivia(ShebangDirectiveTriviaSyntax node)
22242230
=> node.Update(VisitToken(node.HashToken), VisitToken(node.ExclamationToken), VisitToken(node.EndOfDirectiveToken), node.IsActive);
22252231

2232+
public override SyntaxNode? VisitIgnoredDirectiveTrivia(IgnoredDirectiveTriviaSyntax node)
2233+
=> node.Update(VisitToken(node.HashToken), VisitToken(node.ColonToken), VisitToken(node.EndOfDirectiveToken), node.IsActive);
2234+
22262235
public override SyntaxNode? VisitNullableDirectiveTrivia(NullableDirectiveTriviaSyntax node)
22272236
=> node.Update(VisitToken(node.HashToken), VisitToken(node.NullableKeyword), VisitToken(node.SettingToken), VisitToken(node.TargetToken), VisitToken(node.EndOfDirectiveToken), node.IsActive);
22282237
}
@@ -6511,6 +6520,19 @@ public static ShebangDirectiveTriviaSyntax ShebangDirectiveTrivia(SyntaxToken ha
65116520
public static ShebangDirectiveTriviaSyntax ShebangDirectiveTrivia(bool isActive)
65126521
=> SyntaxFactory.ShebangDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.ExclamationToken), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive);
65136522

6523+
/// <summary>Creates a new IgnoredDirectiveTriviaSyntax instance.</summary>
6524+
public static IgnoredDirectiveTriviaSyntax IgnoredDirectiveTrivia(SyntaxToken hashToken, SyntaxToken colonToken, SyntaxToken endOfDirectiveToken, bool isActive)
6525+
{
6526+
if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
6527+
if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken));
6528+
if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
6529+
return (IgnoredDirectiveTriviaSyntax)Syntax.InternalSyntax.SyntaxFactory.IgnoredDirectiveTrivia((Syntax.InternalSyntax.SyntaxToken)hashToken.Node!, (Syntax.InternalSyntax.SyntaxToken)colonToken.Node!, (Syntax.InternalSyntax.SyntaxToken)endOfDirectiveToken.Node!, isActive).CreateRed();
6530+
}
6531+
6532+
/// <summary>Creates a new IgnoredDirectiveTriviaSyntax instance.</summary>
6533+
public static IgnoredDirectiveTriviaSyntax IgnoredDirectiveTrivia(bool isActive)
6534+
=> SyntaxFactory.IgnoredDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.ColonToken), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive);
6535+
65146536
/// <summary>Creates a new NullableDirectiveTriviaSyntax instance.</summary>
65156537
public static NullableDirectiveTriviaSyntax NullableDirectiveTrivia(SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken targetToken, SyntaxToken endOfDirectiveToken, bool isActive)
65166538
{

0 commit comments

Comments
 (0)