File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,12 @@ protected OrdinaryMethod(Context cx, IMethodSymbol init)
18
18
19
19
public IMethodSymbol SourceDeclaration => Symbol . OriginalDefinition ;
20
20
21
- public override Microsoft . CodeAnalysis . Location ReportingLocation => Symbol . GetSymbolLocation ( ) ;
21
+ public override Microsoft . CodeAnalysis . Location ReportingLocation =>
22
+ IsCompilerGeneratedDelegate ( )
23
+ ? Symbol . ContainingType . GetSymbolLocation ( )
24
+ : Symbol . GetSymbolLocation ( ) ;
25
+
26
+ public override bool NeedsPopulation => base . NeedsPopulation || IsCompilerGeneratedDelegate ( ) ;
22
27
23
28
public override void Populate ( TextWriter trapFile )
24
29
{
@@ -47,6 +52,18 @@ public override void Populate(TextWriter trapFile)
47
52
ExtractCompilerGenerated ( trapFile ) ;
48
53
}
49
54
55
+ private bool IsCompilerGeneratedDelegate ( )
56
+ {
57
+ // Lambdas with parameter defaults or a `params` parameter are implemented
58
+ // using compiler generated delegate types.
59
+ if ( Symbol . MethodKind == MethodKind . DelegateInvoke &&
60
+ Symbol . ContainingType is INamedTypeSymbol nt )
61
+ {
62
+ return nt . TypeKind == TypeKind . Delegate && nt . IsImplicitlyDeclared ;
63
+ }
64
+ return false ;
65
+ }
66
+
50
67
public static new OrdinaryMethod Create ( Context cx , IMethodSymbol method )
51
68
{
52
69
if ( method . MethodKind == MethodKind . ReducedExtension )
You can’t perform that action at this time.
0 commit comments