-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Set EndpointName and DisplayName given method name in endpoints #35439
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
9ff9267
Set EndpointName automatically from method name
captainsafia 704673f
Only support adding names from local functions
captainsafia c5fa42f
Supoort local functions via Roslyn parsing logic
captainsafia 8fb48c3
Set DisplayName using endpoint name
captainsafia 3de3976
Address code review and clean up parser
captainsafia 1e74031
Address feedback from Roslyn review
captainsafia 54ee5cd
Clean up type null validation
captainsafia 56c98a3
Fix scenario for local function
captainsafia File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,17 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
// These sources are copied from https://github.com/dotnet/roslyn/blob/7d7bf0cc73e335390d73c9de6d7afd1e49605c9d/src/Compilers/CSharp/Portable/Symbols/Synthesized/GeneratedNameConstants.cs | ||
// and exist to address the issues with extracting original method names for | ||
// generated local functions. See https://github.com/dotnet/roslyn/issues/55651 | ||
// for more info. | ||
namespace Microsoft.CodeAnalysis.CSharp.Symbols | ||
{ | ||
internal static class GeneratedNameConstants | ||
{ | ||
internal const char DotReplacementInTypeNames = '-'; | ||
internal const string SynthesizedLocalNamePrefix = "CS$"; | ||
internal const string SuffixSeparator = "__"; | ||
internal const char LocalFunctionNameTerminator = '|'; | ||
} | ||
} |
This file contains hidden or 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,70 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System; | ||
|
||
// These sources are copied from https://github.com/dotnet/roslyn/blob/7d7bf0cc73e335390d73c9de6d7afd1e49605c9d/src/Compilers/CSharp/Portable/Symbols/Synthesized/GeneratedNameKind.cs | ||
// and exist to address the issues with extracting original method names for | ||
// generated local functions. See https://github.com/dotnet/roslyn/issues/55651 | ||
// for more info. | ||
namespace Microsoft.CodeAnalysis.CSharp.Symbols | ||
{ | ||
internal enum GeneratedNameKind | ||
{ | ||
None = 0, | ||
|
||
// Used by EE: | ||
ThisProxyField = '4', | ||
HoistedLocalField = '5', | ||
DisplayClassLocalOrField = '8', | ||
LambdaMethod = 'b', | ||
LambdaDisplayClass = 'c', | ||
StateMachineType = 'd', | ||
LocalFunction = 'g', // note collision with Deprecated_InitializerLocal, however this one is only used for method names | ||
|
||
// Used by EnC: | ||
AwaiterField = 'u', | ||
HoistedSynthesizedLocalField = 's', | ||
|
||
// Currently not parsed: | ||
StateMachineStateField = '1', | ||
IteratorCurrentBackingField = '2', | ||
StateMachineParameterProxyField = '3', | ||
ReusableHoistedLocalField = '7', | ||
LambdaCacheField = '9', | ||
FixedBufferField = 'e', | ||
AnonymousType = 'f', | ||
TransparentIdentifier = 'h', | ||
AnonymousTypeField = 'i', | ||
AnonymousTypeTypeParameter = 'j', | ||
AutoPropertyBackingField = 'k', | ||
IteratorCurrentThreadIdField = 'l', | ||
IteratorFinallyMethod = 'm', | ||
BaseMethodWrapper = 'n', | ||
AsyncBuilderField = 't', | ||
DynamicCallSiteContainerType = 'o', | ||
DynamicCallSiteField = 'p', | ||
AsyncIteratorPromiseOfValueOrEndBackingField = 'v', | ||
DisposeModeField = 'w', | ||
CombinedTokensField = 'x', // last | ||
|
||
// Deprecated - emitted by Dev12, but not by Roslyn. | ||
// Don't reuse the values because the debugger might encounter them when consuming old binaries. | ||
[Obsolete] | ||
Deprecated_OuterscopeLocals = '6', | ||
[Obsolete] | ||
Deprecated_IteratorInstance = 'a', | ||
[Obsolete] | ||
Deprecated_InitializerLocal = 'g', | ||
[Obsolete] | ||
Deprecated_DynamicDelegate = 'q', | ||
[Obsolete] | ||
Deprecated_ComrefCallLocal = 'r', | ||
} | ||
|
||
internal static class GeneratedNameKindExtensions | ||
{ | ||
internal static bool IsTypeName(this GeneratedNameKind kind) | ||
=> kind is GeneratedNameKind.LambdaDisplayClass or GeneratedNameKind.StateMachineType or GeneratedNameKind.DynamicCallSiteContainerType; | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be "compiler generated methods"?