Browse Source

ReducedMethod in CSharpInvocationResolveResult is now lazy.

pull/32/merge
Mike Krüger 13 years ago
parent
commit
bcc014222b
  1. 10
      ICSharpCode.NRefactory.CSharp/Resolver/CSharpInvocationResolveResult.cs
  2. 5
      ICSharpCode.NRefactory.CSharp/Resolver/OverloadResolution.cs

10
ICSharpCode.NRefactory.CSharp/Resolver/CSharpInvocationResolveResult.cs

@ -52,9 +52,15 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver
/// <summary> /// <summary>
/// If IsExtensionMethodInvocation is true this property holds the reduced method. /// If IsExtensionMethodInvocation is true this property holds the reduced method.
/// </summary> /// </summary>
IMethod reducedMethod;
public IMethod ReducedMethod { public IMethod ReducedMethod {
get; get {
internal set; if (!IsExtensionMethodInvocation)
return null;
if (reducedMethod == null && Member is IMethod)
reducedMethod = new ReducedExtensionMethod ((IMethod)Member);
return reducedMethod;
}
} }
public CSharpInvocationResolveResult( public CSharpInvocationResolveResult(

5
ICSharpCode.NRefactory.CSharp/Resolver/OverloadResolution.cs

@ -950,7 +950,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver
if (member == null) if (member == null)
throw new InvalidOperationException(); throw new InvalidOperationException();
var result = new CSharpInvocationResolveResult( return new CSharpInvocationResolveResult(
this.IsExtensionMethodInvocation ? new TypeResolveResult(member.DeclaringType) : targetResolveResult, this.IsExtensionMethodInvocation ? new TypeResolveResult(member.DeclaringType) : targetResolveResult,
member, member,
GetArgumentsWithConversions(targetResolveResult, member), GetArgumentsWithConversions(targetResolveResult, member),
@ -961,9 +961,6 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver
argumentToParameterMap: this.GetArgumentToParameterMap(), argumentToParameterMap: this.GetArgumentToParameterMap(),
initializerStatements: initializerStatements, initializerStatements: initializerStatements,
returnTypeOverride: returnTypeOverride); returnTypeOverride: returnTypeOverride);
if (this.IsExtensionMethodInvocation && member is IMethod)
result.ReducedMethod = new ReducedExtensionMethod ((IMethod)member);
return result;
} }
#endregion #endregion
} }

Loading…
Cancel
Save