Browse Source

Fixed the getting of base methods to include ignored ones.

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
pull/902/head
Dimitar Dobrev 8 years ago
parent
commit
e62651a954
  1. 11
      src/AST/ClassExtensions.cs
  2. 4
      src/AST/FunctionExtensions.cs

11
src/AST/ClassExtensions.cs

@ -47,23 +47,24 @@ namespace CppSharp.AST @@ -47,23 +47,24 @@ namespace CppSharp.AST
foreach (var @base in @class.Bases.Where(
b => b.IsClass && b.Class.OriginalClass != @class && (!onlyPrimaryBase || !b.Class.IsInterface)))
{
var baseClass = @base.Class.OriginalClass ?? @base.Class;
Method baseMethod;
if (!getTopmost)
{
baseMethod = @base.Class.GetBaseMethod(@override, onlyPrimaryBase);
baseMethod = baseClass.GetBaseMethod(@override, onlyPrimaryBase);
if (baseMethod != null)
return baseMethod;
}
baseMethod = (from method in @base.Class.Methods
where @override.CanOverride(method)
select method).FirstOrDefault();
baseMethod = (from method in baseClass.Methods
where @override.CanOverride(method)
select method).FirstOrDefault();
if (baseMethod != null)
return baseMethod;
if (getTopmost)
{
baseMethod = (@base.Class.GetBaseMethod(@override, onlyPrimaryBase, true));
baseMethod = (baseClass.GetBaseMethod(@override, onlyPrimaryBase, true));
if (baseMethod != null)
return baseMethod;
}

4
src/AST/FunctionExtensions.cs

@ -89,7 +89,9 @@ namespace CppSharp.AST @@ -89,7 +89,9 @@ namespace CppSharp.AST
{
return (method.OriginalName == @override.OriginalName &&
method.OriginalReturnType.ResolvesTo(@override.OriginalReturnType) &&
method.Parameters.SequenceEqual(@override.Parameters, ParameterTypeComparer.Instance)) ||
method.Parameters.Where(p => p.Kind != ParameterKind.IndirectReturnType).SequenceEqual(
@override.Parameters.Where(p => p.Kind != ParameterKind.IndirectReturnType),
ParameterTypeComparer.Instance)) ||
(@override.IsDestructor && method.IsDestructor && method.IsVirtual);
}
}

Loading…
Cancel
Save