Skip to content

Commit 06bff44

Browse files
authored
Implement SynthesizedBackingFieldSymbolBase.TryGetFirstLocation (#82679)
This avoid the allocations done in the Symbol.TryGetFirstLocation usage of the Locations property. This accounts for 0.7% of allocations in a scenario in the ComplietionInCohosting razor speedometer test. <img width="1683" height="505" alt="image" src="https://github.com/user-attachments/assets/8b103bf1-5125-41e8-a41a-191067791806" />
1 parent d70faac commit 06bff44

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/Compilers/CSharp/Portable/Symbols/Synthesized/SynthesizedBackingFieldSymbol.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@ public override Symbol AssociatedSymbol
119119
public override ImmutableArray<Location> Locations
120120
=> _property.Locations;
121121

122+
public override Location TryGetFirstLocation()
123+
=> _property.TryGetFirstLocation();
124+
122125
public override RefKind RefKind => _property.RefKind;
123126

124127
public override ImmutableArray<CustomModifier> RefCustomModifiers => _property.RefCustomModifiers;

0 commit comments

Comments
 (0)