|
|
@ -80,7 +80,7 @@ namespace CppSharp.AST |
|
|
|
|
|
|
|
|
|
|
|
if (getTopmost) |
|
|
|
if (getTopmost) |
|
|
|
{ |
|
|
|
{ |
|
|
|
baseMethod = (@base.Class.GetBaseMethod(@override, onlyPrimaryBase)); |
|
|
|
baseMethod = (@base.Class.GetBaseMethod(@override, onlyPrimaryBase, true)); |
|
|
|
if (baseMethod != null) |
|
|
|
if (baseMethod != null) |
|
|
|
return baseMethod; |
|
|
|
return baseMethod; |
|
|
|
} |
|
|
|
} |
|
|
@ -88,20 +88,37 @@ namespace CppSharp.AST |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static Property GetRootBaseProperty(this Class c, Property @override, bool onlyFirstBase = false) |
|
|
|
public static Property GetBaseProperty(this Class c, Property @override, bool onlyFirstBase = false, bool getTopmost = false) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
foreach (var @base in c.Bases) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (!@base.IsClass || @base.Class.OriginalClass == c || (onlyFirstBase && @base.Class.IsInterface)) |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Property baseProperty; |
|
|
|
|
|
|
|
if (!getTopmost) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return (from @base in c.Bases |
|
|
|
baseProperty = @base.Class.GetBaseProperty(@override, onlyFirstBase); |
|
|
|
where @base.IsClass && @base.Class.OriginalClass != c && (!onlyFirstBase || !@base.Class.IsInterface) |
|
|
|
if (baseProperty != null) |
|
|
|
let baseProperty = ( |
|
|
|
return baseProperty; |
|
|
|
from property in @base.Class.Properties |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
baseProperty = (from property in @base.Class.Properties |
|
|
|
where |
|
|
|
where |
|
|
|
property.OriginalName == @override.OriginalName && |
|
|
|
property.OriginalName == @override.OriginalName && |
|
|
|
property.Parameters.SequenceEqual(@override.Parameters, |
|
|
|
property.Parameters.SequenceEqual(@override.Parameters, new ParameterTypeComparer()) |
|
|
|
new ParameterTypeComparer()) |
|
|
|
select property).FirstOrDefault(); |
|
|
|
select property).FirstOrDefault() |
|
|
|
if (baseProperty != null) |
|
|
|
let rootBaseProperty = @base.Class.GetRootBaseProperty(@override, onlyFirstBase) ?? baseProperty |
|
|
|
return baseProperty; |
|
|
|
where rootBaseProperty != null || onlyFirstBase |
|
|
|
|
|
|
|
select rootBaseProperty).FirstOrDefault(); |
|
|
|
if (getTopmost) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
baseProperty = @base.Class.GetBaseProperty(@override, onlyFirstBase, true); |
|
|
|
|
|
|
|
if (baseProperty != null) |
|
|
|
|
|
|
|
return baseProperty; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static Property GetPropertyByName(this Class c, string propertyName) |
|
|
|
public static Property GetPropertyByName(this Class c, string propertyName) |
|
|
|