[binder] GetRootAssociatedDecl is now an extension method.

This commit is contained in:
Joao Matos 2017-11-24 15:24:51 +00:00
Родитель 4e7f9441e2
Коммит 6f15d927fb
2 изменённых файлов: 9 добавлений и 9 удалений

Просмотреть файл

@ -11,6 +11,14 @@ namespace Embeddinator.Generators
{ {
public static class DeclarationExtensions public static class DeclarationExtensions
{ {
public static Declaration GetRootAssociatedDecl(this Declaration decl)
{
while (decl.AssociatedDeclaration != null)
decl = decl.AssociatedDeclaration;
return decl;
}
public static string ManagedQualifiedName(this Declaration decl) public static string ManagedQualifiedName(this Declaration decl)
{ {
string managedName; string managedName;

Просмотреть файл

@ -277,19 +277,11 @@ namespace Embeddinator.Generators
return true; return true;
} }
static Declaration GetRootAssociatedDecl(Declaration decl)
{
while (decl.AssociatedDeclaration != null)
decl = decl.AssociatedDeclaration;
return decl;
}
public static string GetMethodIdentifier(Method method) public static string GetMethodIdentifier(Method method)
{ {
var name = method.Name; var name = method.Name;
var associated = GetRootAssociatedDecl(method); var associated = method.GetRootAssociatedDecl();
if (associated.DefinitionOrder != 0) if (associated.DefinitionOrder != 0)
name += $"_{associated.DefinitionOrder}"; name += $"_{associated.DefinitionOrder}";