Permalink
Browse files

Further simplified the getting of base methods from only the primary …

…bases.

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
  • Loading branch information...
ddobrev committed Jul 28, 2017
1 parent e0367c5 commit d3e8cc51d5f9cf1781b6f4a9ca6c3c2d2392137b
Showing with 9 additions and 15 deletions.
  1. +9 −15 src/AST/ClassExtensions.cs
@@ -43,21 +43,15 @@ public static Class GetNonIgnoredRootBase(this Class @class)
public static Method GetBaseMethod(this Class @class, Method @override)
{
foreach (var @base in @class.Bases.Where(
b => b.IsClass && b.Class.OriginalClass != @class && !b.Class.IsInterface))
{
var baseClass = @base.Class.OriginalClass ?? @base.Class;
Method baseMethod = baseClass.GetBaseMethod(@override);
if (baseMethod != null)
return baseMethod;
baseMethod = (from method in baseClass.Methods
where @override.CanOverride(method)
select method).FirstOrDefault();
if (baseMethod != null)
return baseMethod;
}
return null;
if (@class.BaseClass == null || @class.BaseClass.IsInterface)
return null;
var baseClass = @class.BaseClass.OriginalClass ?? @class.BaseClass;
Method baseMethod = baseClass.GetBaseMethod(@override);
if (baseMethod != null)
return baseMethod;
return baseClass.Methods.FirstOrDefault(m => @override.CanOverride(m));
}
public static Property GetBaseProperty(this Class @class, Property @override,

0 comments on commit d3e8cc5

Please sign in to comment.