Browse Source
* Check for Control base type since IControl interface is removed * Apply base type check fix to name resolver too.pull/10407/head
committed by
GitHub
3 changed files with 38 additions and 12 deletions
@ -0,0 +1,33 @@ |
|||
using System.Linq; |
|||
using XamlX.TypeSystem; |
|||
|
|||
namespace Avalonia.NameGenerator.Generator; |
|||
|
|||
internal static class ResolverExtensions |
|||
{ |
|||
public static bool IsAvaloniaControl(this IXamlType clrType) |
|||
{ |
|||
return clrType.HasControlBaseType() || clrType.HasIControlInterface(); |
|||
} |
|||
|
|||
private static bool HasControlBaseType(this IXamlType clrType) |
|||
{ |
|||
// Check for the base type since IControl interface is removed.
|
|||
// https://github.com/AvaloniaUI/Avalonia/pull/9553
|
|||
if (clrType.FullName == "Avalonia.Controls.Control") |
|||
return true; |
|||
|
|||
if (clrType.BaseType != null) |
|||
return IsAvaloniaControl(clrType.BaseType); |
|||
|
|||
return false; |
|||
} |
|||
|
|||
private static bool HasIControlInterface(this IXamlType clrType) |
|||
{ |
|||
return clrType |
|||
.Interfaces |
|||
.Any(abstraction => abstraction.IsInterface && |
|||
abstraction.FullName == "Avalonia.Controls.IControl"); |
|||
} |
|||
} |
|||
Loading…
Reference in new issue