77 using System . Linq . Expressions ;
88#endif
99 using Extensions ;
10+ using static System . StringComparison ;
1011 using static Formatting . TokenType ;
1112
1213 internal static class ParameterTranslation
@@ -18,13 +19,22 @@ public static ITranslation For(ParameterExpression parameter, ITranslationContex
1819 return new UnnamedParameterTranslation ( parameter , context ) ;
1920 }
2021
22+ if ( parameter . Name . StartsWith ( "<>" , Ordinal ) )
23+ {
24+ return new FixedValueTranslation (
25+ ExpressionType . Parameter ,
26+ "_" ,
27+ parameter . Type ,
28+ Variable ,
29+ context ) ;
30+ }
31+
2132 return new StandardParameterTranslation ( parameter , context ) ;
2233 }
2334
2435 private abstract class ParameterTranslationBase : IParameterTranslation
2536 {
2637 private readonly ParameterExpression _parameter ;
27- private readonly string _parameterName ;
2838 private ITranslation _typeNameTranslation ;
2939
3040 protected ParameterTranslationBase (
@@ -33,9 +43,9 @@ protected ParameterTranslationBase(
3343 ITranslationContext context )
3444 {
3545 _parameter = parameter ;
36- _parameterName = parameterName ;
46+ Name = parameterName ;
3747
38- TranslationSize = _parameterName . Length ;
48+ TranslationSize = Name . Length ;
3949 FormattingSize = context . GetFormattingSize ( Variable ) ;
4050 }
4151
@@ -47,6 +57,8 @@ protected ParameterTranslationBase(
4757
4858 public int FormattingSize { get ; private set ; }
4959
60+ public string Name { get ; }
61+
5062 public void WithTypeNames ( ITranslationContext context )
5163 {
5264 _typeNameTranslation = context . GetTranslationFor ( Type ) ;
@@ -77,7 +89,7 @@ public void WriteTo(TranslationWriter writer)
7789 writer . WriteSpaceToTranslation ( ) ;
7890 }
7991
80- writer . WriteToTranslation ( _parameterName , Variable ) ;
92+ writer . WriteToTranslation ( Name , Variable ) ;
8193 }
8294 }
8395
0 commit comments