dotnet/roslyn

Refactor `CheckFeatureAvailability` to not accept a `Location` parameter

Open

#68,935 创建于 2023年7月8日

在 GitHub 查看
 (1 评论) (0 反应) (0 负责人)C# (4,257 fork)batch import
Area-CompilersArea-Performancehelp wanted

仓库指标

Star
 (20,414 star)
PR 合并指标
 (平均合并 6天 17小时) (30 天内合并 256 个 PR)

描述

Currently, CheckFeatureAvailability overloads take a Location parameter. Causing caller to call syntaxNode.Location which allocates a SourceLocation. At the end, if the feature is available, the allocation is thrown away.

Example:

https://github.com/dotnet/roslyn/blob/b203101cbc6672a9761a7ce4917d26be593aed26/src/Compilers/CSharp/Portable/Binder/Binder_Patterns.cs#L574

Not sure how much this pattern is hit, but it's good to optimize this anyway.

贡献者指南