dotnet/roslyn

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

Open

#68 935 ouverte le 8 juil. 2023

Voir sur GitHub
 (1 commentaire) (0 réactions) (0 assignés)C# (4 257 forks)batch import
Area-CompilersArea-Performancehelp wanted

Métriques du dépôt

Stars
 (20 414 stars)
Métriques de merge PR
 (Merge moyen 6j 17h) (256 PRs mergées en 30 j)

Description

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.

Guide contributeur