-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update interpolated string handler based on API reviews / LDM decisio…
…ns (#53153)
- Loading branch information
1 parent
eb32b38
commit cb3b035
Showing
8 changed files
with
193 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
161 changes: 67 additions & 94 deletions
161
...ilerServices/InterpolatedStringBuilder.cs → ...vices/DefaultInterpolatedStringHandler.cs
Large diffs are not rendered by default.
Oops, something went wrong.
24 changes: 24 additions & 0 deletions
24
...CoreLib/src/System/Runtime/CompilerServices/InterpolatedStringHandlerArgumentAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
namespace System.Runtime.CompilerServices | ||
{ | ||
/// <summary>Indicates which arguments to a method involving an interpolated string handler should be passed to that handler.</summary> | ||
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] | ||
public sealed class InterpolatedStringHandlerArgumentAttribute : Attribute | ||
{ | ||
/// <summary>Initializes a new instance of the <see cref="InterpolatedStringHandlerArgumentAttribute"/> class.</summary> | ||
/// <param name="argument">The name of the argument that should be passed to the handler.</param> | ||
/// <remarks><see langword="null"/> may be used as the name of the receiver in an instance method.</remarks> | ||
public InterpolatedStringHandlerArgumentAttribute(string argument) => Arguments = new string[] { argument }; | ||
|
||
/// <summary>Initializes a new instance of the <see cref="InterpolatedStringHandlerArgumentAttribute"/> class.</summary> | ||
/// <param name="arguments">The names of the arguments that should be passed to the handler.</param> | ||
/// <remarks><see langword="null"/> may be used as the name of the receiver in an instance method.</remarks> | ||
public InterpolatedStringHandlerArgumentAttribute(params string[] arguments) => Arguments = arguments; | ||
|
||
/// <summary>Gets the names of the arguments that should be passed to the handler.</summary> | ||
/// <remarks><see langword="null"/> may be used as the name of the receiver in an instance method.</remarks> | ||
public string[] Arguments { get; } | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
...Private.CoreLib/src/System/Runtime/CompilerServices/InterpolatedStringHandlerAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
namespace System.Runtime.CompilerServices | ||
{ | ||
/// <summary>Indicates the attributed type is to be used as an interpolated string handler.</summary> | ||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false, Inherited = false)] | ||
public sealed class InterpolatedStringHandlerAttribute : Attribute | ||
{ | ||
/// <summary>Initializes the <see cref="InterpolatedStringHandlerAttribute"/>.</summary> | ||
public InterpolatedStringHandlerAttribute() { } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters