From 6f15d927fbca7791743dd1b29bdbc4bfa7156f4b Mon Sep 17 00:00:00 2001 From: Joao Matos Date: Fri, 24 Nov 2017 15:24:51 +0000 Subject: [PATCH] [binder] GetRootAssociatedDecl is now an extension method. --- binder/Generators/AstGenerator.cs | 8 ++++++++ binder/Generators/Java/JavaSources.cs | 10 +--------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/binder/Generators/AstGenerator.cs b/binder/Generators/AstGenerator.cs index 41fd14b..d062395 100644 --- a/binder/Generators/AstGenerator.cs +++ b/binder/Generators/AstGenerator.cs @@ -11,6 +11,14 @@ namespace Embeddinator.Generators { 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) { string managedName; diff --git a/binder/Generators/Java/JavaSources.cs b/binder/Generators/Java/JavaSources.cs index 4ecbfd0..448fd81 100644 --- a/binder/Generators/Java/JavaSources.cs +++ b/binder/Generators/Java/JavaSources.cs @@ -277,19 +277,11 @@ namespace Embeddinator.Generators return true; } - static Declaration GetRootAssociatedDecl(Declaration decl) - { - while (decl.AssociatedDeclaration != null) - decl = decl.AssociatedDeclaration; - - return decl; - } - public static string GetMethodIdentifier(Method method) { var name = method.Name; - var associated = GetRootAssociatedDecl(method); + var associated = method.GetRootAssociatedDecl(); if (associated.DefinitionOrder != 0) name += $"_{associated.DefinitionOrder}";