Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 0 additions & 2 deletions eng/targets/Settings.props
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
<!-- TODO: https://github.com/dotnet/roslyn/issues/71667 -->
<NoWarn>$(NoWarn);NU1507</NoWarn>

<NoWarn>$(NoWarn);RSEXPERIMENTAL005</NoWarn>

<CommonExtensionInstallationRoot>CommonExtensions</CommonExtensionInstallationRoot>
<LanguageServicesExtensionInstallationFolder>Microsoft\VBCSharp\LanguageServices</LanguageServicesExtensionInstallationFolder>

Expand Down
2 changes: 1 addition & 1 deletion src/Compilers/CSharp/Portable/CSharpResources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -8129,7 +8129,7 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ
<value>'#:' directives cannot be after first token in file</value>
</data>
<data name="ERR_PPIgnoredNeedsFileBasedProgram" xml:space="preserve">
<value>'#:' directives can be only used in file-based programs ('/feature:FileBasedProgram')</value>
<value>'#:' directives can be only used in file-based programs ('-features:FileBasedProgram')</value>
</data>
<data name="ERR_PPIgnoredFollowsIf" xml:space="preserve">
<value>'#:' directives cannot be after '#if' directive</value>
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -26608,51 +26608,68 @@ internal sealed partial class IgnoredDirectiveTriviaSyntax : DirectiveTriviaSynt
{
internal readonly SyntaxToken hashToken;
internal readonly SyntaxToken colonToken;
internal readonly SyntaxToken? content;
internal readonly SyntaxToken endOfDirectiveToken;
internal readonly bool isActive;

internal IgnoredDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken colonToken, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
internal IgnoredDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken colonToken, SyntaxToken? content, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
this.SlotCount = 3;
this.SlotCount = 4;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
if (content != null)
{
this.AdjustFlagsAndWidth(content);
this.content = content;
}
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}

internal IgnoredDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken colonToken, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context)
internal IgnoredDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken colonToken, SyntaxToken? content, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
this.SlotCount = 3;
this.SlotCount = 4;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
if (content != null)
{
this.AdjustFlagsAndWidth(content);
this.content = content;
}
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}

internal IgnoredDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken colonToken, SyntaxToken endOfDirectiveToken, bool isActive)
internal IgnoredDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken colonToken, SyntaxToken? content, SyntaxToken endOfDirectiveToken, bool isActive)
: base(kind)
{
this.SlotCount = 3;
this.SlotCount = 4;
this.AdjustFlagsAndWidth(hashToken);
this.hashToken = hashToken;
this.AdjustFlagsAndWidth(colonToken);
this.colonToken = colonToken;
if (content != null)
{
this.AdjustFlagsAndWidth(content);
this.content = content;
}
this.AdjustFlagsAndWidth(endOfDirectiveToken);
this.endOfDirectiveToken = endOfDirectiveToken;
this.isActive = isActive;
}

public override SyntaxToken HashToken => this.hashToken;
public SyntaxToken ColonToken => this.colonToken;
public SyntaxToken? Content => this.content;
public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken;
public override bool IsActive => this.isActive;

Expand All @@ -26661,7 +26678,8 @@ internal IgnoredDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, Sy
{
0 => this.hashToken,
1 => this.colonToken,
2 => this.endOfDirectiveToken,
2 => this.content,
3 => this.endOfDirectiveToken,
_ => null,
};

Expand All @@ -26670,11 +26688,11 @@ internal IgnoredDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, Sy
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIgnoredDirectiveTrivia(this);
public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) => visitor.VisitIgnoredDirectiveTrivia(this);

public IgnoredDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken colonToken, SyntaxToken endOfDirectiveToken, bool isActive)
public IgnoredDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken colonToken, SyntaxToken content, SyntaxToken endOfDirectiveToken, bool isActive)
{
if (hashToken != this.HashToken || colonToken != this.ColonToken || endOfDirectiveToken != this.EndOfDirectiveToken)
if (hashToken != this.HashToken || colonToken != this.ColonToken || content != this.Content || endOfDirectiveToken != this.EndOfDirectiveToken)
{
var newNode = SyntaxFactory.IgnoredDirectiveTrivia(hashToken, colonToken, endOfDirectiveToken, isActive);
var newNode = SyntaxFactory.IgnoredDirectiveTrivia(hashToken, colonToken, content, endOfDirectiveToken, isActive);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
Expand All @@ -26688,10 +26706,10 @@ public IgnoredDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken co
}

internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
=> new IgnoredDirectiveTriviaSyntax(this.Kind, this.hashToken, this.colonToken, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations());
=> new IgnoredDirectiveTriviaSyntax(this.Kind, this.hashToken, this.colonToken, this.content, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations());

internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
=> new IgnoredDirectiveTriviaSyntax(this.Kind, this.hashToken, this.colonToken, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations);
=> new IgnoredDirectiveTriviaSyntax(this.Kind, this.hashToken, this.colonToken, this.content, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations);
}

internal sealed partial class NullableDirectiveTriviaSyntax : DirectiveTriviaSyntax
Expand Down Expand Up @@ -28046,7 +28064,7 @@ public override CSharpSyntaxNode VisitShebangDirectiveTrivia(ShebangDirectiveTri
=> node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.ExclamationToken), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive);

public override CSharpSyntaxNode VisitIgnoredDirectiveTrivia(IgnoredDirectiveTriviaSyntax node)
=> node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.ColonToken), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive);
=> node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.ColonToken), (SyntaxToken)Visit(node.Content), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive);

public override CSharpSyntaxNode VisitNullableDirectiveTrivia(NullableDirectiveTriviaSyntax node)
=> node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.NullableKeyword), (SyntaxToken)Visit(node.SettingToken), (SyntaxToken)Visit(node.TargetToken), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive);
Expand Down Expand Up @@ -33332,18 +33350,27 @@ public ShebangDirectiveTriviaSyntax ShebangDirectiveTrivia(SyntaxToken hashToken
return new ShebangDirectiveTriviaSyntax(SyntaxKind.ShebangDirectiveTrivia, hashToken, exclamationToken, endOfDirectiveToken, isActive, this.context);
}

public IgnoredDirectiveTriviaSyntax IgnoredDirectiveTrivia(SyntaxToken hashToken, SyntaxToken colonToken, SyntaxToken endOfDirectiveToken, bool isActive)
public IgnoredDirectiveTriviaSyntax IgnoredDirectiveTrivia(SyntaxToken hashToken, SyntaxToken colonToken, SyntaxToken? content, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken));
if (content != null)
{
switch (content.Kind)
{
case SyntaxKind.StringLiteralToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(content));
}
}
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif

return new IgnoredDirectiveTriviaSyntax(SyntaxKind.IgnoredDirectiveTrivia, hashToken, colonToken, endOfDirectiveToken, isActive, this.context);
return new IgnoredDirectiveTriviaSyntax(SyntaxKind.IgnoredDirectiveTrivia, hashToken, colonToken, content, endOfDirectiveToken, isActive, this.context);
}

public NullableDirectiveTriviaSyntax NullableDirectiveTrivia(SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken? targetToken, SyntaxToken endOfDirectiveToken, bool isActive)
Expand Down Expand Up @@ -38654,18 +38681,27 @@ public static ShebangDirectiveTriviaSyntax ShebangDirectiveTrivia(SyntaxToken ha
return new ShebangDirectiveTriviaSyntax(SyntaxKind.ShebangDirectiveTrivia, hashToken, exclamationToken, endOfDirectiveToken, isActive);
}

public static IgnoredDirectiveTriviaSyntax IgnoredDirectiveTrivia(SyntaxToken hashToken, SyntaxToken colonToken, SyntaxToken endOfDirectiveToken, bool isActive)
public static IgnoredDirectiveTriviaSyntax IgnoredDirectiveTrivia(SyntaxToken hashToken, SyntaxToken colonToken, SyntaxToken? content, SyntaxToken endOfDirectiveToken, bool isActive)
{
#if DEBUG
if (hashToken == null) throw new ArgumentNullException(nameof(hashToken));
if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (colonToken == null) throw new ArgumentNullException(nameof(colonToken));
if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken));
if (content != null)
{
switch (content.Kind)
{
case SyntaxKind.StringLiteralToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(content));
}
}
if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken));
if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
#endif

return new IgnoredDirectiveTriviaSyntax(SyntaxKind.IgnoredDirectiveTrivia, hashToken, colonToken, endOfDirectiveToken, isActive);
return new IgnoredDirectiveTriviaSyntax(SyntaxKind.IgnoredDirectiveTrivia, hashToken, colonToken, content, endOfDirectiveToken, isActive);
}

public static NullableDirectiveTriviaSyntax NullableDirectiveTrivia(SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken? targetToken, SyntaxToken endOfDirectiveToken, bool isActive)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2230,7 +2230,7 @@ public partial class CSharpSyntaxRewriter : CSharpSyntaxVisitor<SyntaxNode?>
=> node.Update(VisitToken(node.HashToken), VisitToken(node.ExclamationToken), VisitToken(node.EndOfDirectiveToken), node.IsActive);

public override SyntaxNode? VisitIgnoredDirectiveTrivia(IgnoredDirectiveTriviaSyntax node)
=> node.Update(VisitToken(node.HashToken), VisitToken(node.ColonToken), VisitToken(node.EndOfDirectiveToken), node.IsActive);
=> node.Update(VisitToken(node.HashToken), VisitToken(node.ColonToken), VisitToken(node.Content), VisitToken(node.EndOfDirectiveToken), node.IsActive);

public override SyntaxNode? VisitNullableDirectiveTrivia(NullableDirectiveTriviaSyntax node)
=> node.Update(VisitToken(node.HashToken), VisitToken(node.NullableKeyword), VisitToken(node.SettingToken), VisitToken(node.TargetToken), VisitToken(node.EndOfDirectiveToken), node.IsActive);
Expand Down Expand Up @@ -6521,17 +6521,27 @@ public static ShebangDirectiveTriviaSyntax ShebangDirectiveTrivia(bool isActive)
=> SyntaxFactory.ShebangDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.ExclamationToken), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive);

/// <summary>Creates a new IgnoredDirectiveTriviaSyntax instance.</summary>
public static IgnoredDirectiveTriviaSyntax IgnoredDirectiveTrivia(SyntaxToken hashToken, SyntaxToken colonToken, SyntaxToken endOfDirectiveToken, bool isActive)
public static IgnoredDirectiveTriviaSyntax IgnoredDirectiveTrivia(SyntaxToken hashToken, SyntaxToken colonToken, SyntaxToken content, SyntaxToken endOfDirectiveToken, bool isActive)
{
if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken));
if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken));
switch (content.Kind())
{
case SyntaxKind.StringLiteralToken:
case SyntaxKind.None: break;
default: throw new ArgumentException(nameof(content));
}
if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken));
return (IgnoredDirectiveTriviaSyntax)Syntax.InternalSyntax.SyntaxFactory.IgnoredDirectiveTrivia((Syntax.InternalSyntax.SyntaxToken)hashToken.Node!, (Syntax.InternalSyntax.SyntaxToken)colonToken.Node!, (Syntax.InternalSyntax.SyntaxToken)endOfDirectiveToken.Node!, isActive).CreateRed();
return (IgnoredDirectiveTriviaSyntax)Syntax.InternalSyntax.SyntaxFactory.IgnoredDirectiveTrivia((Syntax.InternalSyntax.SyntaxToken)hashToken.Node!, (Syntax.InternalSyntax.SyntaxToken)colonToken.Node!, (Syntax.InternalSyntax.SyntaxToken?)content.Node, (Syntax.InternalSyntax.SyntaxToken)endOfDirectiveToken.Node!, isActive).CreateRed();
}

/// <summary>Creates a new IgnoredDirectiveTriviaSyntax instance.</summary>
public static IgnoredDirectiveTriviaSyntax IgnoredDirectiveTrivia(SyntaxToken content, bool isActive)
=> SyntaxFactory.IgnoredDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.ColonToken), content, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive);

/// <summary>Creates a new IgnoredDirectiveTriviaSyntax instance.</summary>
public static IgnoredDirectiveTriviaSyntax IgnoredDirectiveTrivia(bool isActive)
=> SyntaxFactory.IgnoredDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.ColonToken), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive);
=> SyntaxFactory.IgnoredDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.ColonToken), default, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive);

/// <summary>Creates a new NullableDirectiveTriviaSyntax instance.</summary>
public static NullableDirectiveTriviaSyntax NullableDirectiveTrivia(SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken targetToken, SyntaxToken endOfDirectiveToken, bool isActive)
Expand Down
Loading