|
|
@ -45,15 +45,13 @@ namespace CppSharp.Passes |
|
|
|
|
|
|
|
|
|
|
|
if (!overload.IsGenerated) continue; |
|
|
|
if (!overload.IsGenerated) continue; |
|
|
|
|
|
|
|
|
|
|
|
if (!CheckConstness(function, overload)) |
|
|
|
if (CheckConstnessForAmbiguity(function, overload) || |
|
|
|
continue; |
|
|
|
CheckDefaultParametersForAmbiguity(function, overload)) |
|
|
|
|
|
|
|
{ |
|
|
|
if (!CheckDefaultParameters(function, overload)) |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function.IsAmbiguous = true; |
|
|
|
function.IsAmbiguous = true; |
|
|
|
overload.IsAmbiguous = true; |
|
|
|
overload.IsAmbiguous = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (function.IsAmbiguous) |
|
|
|
if (function.IsAmbiguous) |
|
|
|
Driver.Diagnostics.Debug("Found ambiguous overload: {0}", |
|
|
|
Driver.Diagnostics.Debug("Found ambiguous overload: {0}", |
|
|
@ -62,7 +60,7 @@ namespace CppSharp.Passes |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static bool CheckDefaultParameters(Function function, Function overload) |
|
|
|
private static bool CheckDefaultParametersForAmbiguity(Function function, Function overload) |
|
|
|
{ |
|
|
|
{ |
|
|
|
var commonParameters = Math.Min(function.Parameters.Count, overload.Parameters.Count); |
|
|
|
var commonParameters = Math.Min(function.Parameters.Count, overload.Parameters.Count); |
|
|
|
|
|
|
|
|
|
|
@ -98,7 +96,7 @@ namespace CppSharp.Passes |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static bool CheckConstness(Function function, Function overload) |
|
|
|
private static bool CheckConstnessForAmbiguity(Function function, Function overload) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (function is Method && overload is Method) |
|
|
|
if (function is Method && overload is Method) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -110,17 +108,17 @@ namespace CppSharp.Passes |
|
|
|
if (method1.IsConst && !method2.IsConst && sameParams) |
|
|
|
if (method1.IsConst && !method2.IsConst && sameParams) |
|
|
|
{ |
|
|
|
{ |
|
|
|
method1.ExplicitlyIgnore(); |
|
|
|
method1.ExplicitlyIgnore(); |
|
|
|
return false; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (method2.IsConst && !method1.IsConst && sameParams) |
|
|
|
if (method2.IsConst && !method1.IsConst && sameParams) |
|
|
|
{ |
|
|
|
{ |
|
|
|
method2.ExplicitlyIgnore(); |
|
|
|
method2.ExplicitlyIgnore(); |
|
|
|
return false; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|