Fixes issue #40 - Follow the DeclaringType up the chain when resolving method names (#41)

* Added a strongly-typed property for the type to ResolvedParameter and ResolvedMethod

* Changed TryResolveGeneratedName to follow the declaring type up the chain rather than only once.
This commit is contained in:
George Duckett 2017-12-22 16:20:44 +00:00 committed by Ben Adams
parent 867b87c4b4
commit ed71da19ec

View File

@ -291,6 +291,8 @@ namespace System.Diagnostics
var candidateConstructors = dt.GetConstructors(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance | BindingFlags.DeclaredOnly).Where(m => m.Name == matchName);
if (TryResolveSourceMethod(candidateConstructors, kind, matchHint, ref method, ref type, out ordinal)) return true;
while (true)
{
dt = dt.DeclaringType;
if (dt == null)
{
@ -313,8 +315,7 @@ namespace System.Diagnostics
return true;
}
}
return false;
}
}
private static bool TryResolveSourceMethod(IEnumerable<MethodBase> candidateMethods, GeneratedNameKind kind, string matchHint, ref MethodBase method, ref Type type, out int? ordinal)