Permalink
Browse files

#1407: Set CSharpInvocationResolveResult.IsExtensionMethodInvocation …

…flag after extension methods transform.
  • Loading branch information...
siegfriedpammer committed Feb 1, 2019
1 parent 8585fcf commit ee151eb7067afd0bb9631ccd7eca7fc43536b86f
Showing with 9 additions and 0 deletions.
  1. +9 −0 ICSharpCode.Decompiler/CSharp/Transforms/IntroduceExtensionMethods.cs
@@ -148,6 +148,15 @@ public override void VisitInvocationExpression(InvocationExpression invocationEx
} else {
memberRefExpr.Target = firstArgument.Detach();
}
if (invocationExpression.GetResolveResult() is CSharpInvocationResolveResult irr) {
// do not forget to update the CSharpInvocationResolveResult => set IsExtensionMethodInvocation == true
invocationExpression.RemoveAnnotations<CSharpInvocationResolveResult>();
var newResolveResult = new CSharpInvocationResolveResult(
irr.TargetResult, irr.Member, irr.Arguments, irr.OverloadResolutionErrors,
isExtensionMethodInvocation: true, irr.IsExpandedForm, irr.IsDelegateInvocation,
irr.GetArgumentToParameterMap(), irr.InitializerStatements);
invocationExpression.AddAnnotation(newResolveResult);
}
}

public static bool CanTransformToExtensionMethodCall(CSharpResolver resolver, IMethod method,

0 comments on commit ee151eb

Please sign in to comment.