mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-01-11 00:25:29 +00:00
Support multiple overloads
It is now possible to specify multiple overloads for the same function. This is helpful for maintaining backwards compatibility with previous releases.
This commit is contained in:
parent
52a8653f52
commit
4f6c2ac2b4
|
@ -91,8 +91,8 @@ namespace Bind
|
|||
var overload_list = new List<Delegate>();
|
||||
foreach (var d in delegates.Values.Select(v => v.First()))
|
||||
{
|
||||
var overload_element = GetFuncOverload(nav, d, apiname, apiversion);
|
||||
if (overload_element != null)
|
||||
var overload_elements = GetFuncOverload(nav, d, apiname, apiversion);
|
||||
foreach (XPathNavigator overload_element in overload_elements)
|
||||
{
|
||||
var overload = new Delegate(d);
|
||||
ApplyParameterReplacement(overload, overload_element);
|
||||
|
@ -373,16 +373,17 @@ namespace Bind
|
|||
return trimmed_name;
|
||||
}
|
||||
|
||||
static XPathNavigator GetFuncOverload(XPathNavigator nav, Delegate d, string apiname, string apiversion)
|
||||
static XPathNodeIterator GetFuncOverload(XPathNavigator nav, Delegate d, string apiname, string apiversion)
|
||||
{
|
||||
string ext = d.Extension;
|
||||
string trimmed_name = GetTrimmedName(d);
|
||||
string extensionless_name = GetTrimmedExtension(d.Name, ext);
|
||||
|
||||
var function_overload =
|
||||
nav.SelectSingleNode(GetOverloadsPath(apiname, apiversion, d.Name, ext)) ??
|
||||
nav.SelectSingleNode(GetOverloadsPath(apiname, apiversion, extensionless_name, ext)) ??
|
||||
nav.SelectSingleNode(GetOverloadsPath(apiname, apiversion, trimmed_name, ext));
|
||||
var function_overload = nav.Select(GetOverloadsPath(apiname, apiversion, d.Name, ext));
|
||||
if (function_overload.Count == 0)
|
||||
function_overload = nav.Select(GetOverloadsPath(apiname, apiversion, extensionless_name, ext));
|
||||
if (function_overload.Count == 0)
|
||||
function_overload = nav.Select(GetOverloadsPath(apiname, apiversion, trimmed_name, ext));
|
||||
return function_overload;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue