From 6098fa05ce925bf31bc9dc940c3982329d30807c Mon Sep 17 00:00:00 2001 From: "Stefanos A." Date: Sun, 10 Nov 2013 10:16:47 +0100 Subject: [PATCH] Plural name to singular in convenience overloads --- Source/Bind/FuncProcessor.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Source/Bind/FuncProcessor.cs b/Source/Bind/FuncProcessor.cs index f0d304d9..d305d687 100644 --- a/Source/Bind/FuncProcessor.cs +++ b/Source/Bind/FuncProcessor.cs @@ -46,7 +46,7 @@ namespace Bind static readonly Regex Endings = new Regex(@"((((d|f|fi)|(L?(u?i?64)?u?[isb]))_?(64)?v?)|v)", RegexOptions.Compiled | RegexOptions.RightToLeft); static readonly Regex EndingsNotToTrim = - new Regex("(ib|[tdrey]s|[eE]n[vd]|bled|Attrib|Access|Coord|Flag|Tess|Status|Pixels|Instanced|Indexed|Varyings|Boolean|IDs|Uniforms)", RegexOptions.Compiled | RegexOptions.RightToLeft); + new Regex("(ib|[tdrey]s|[eE]n[vd]|bled|Attrib|Access|Coord|Feedbacks|Flag|Queries|Tess|Status|Pixels|Instanced|Indexed|Varyings|Boolean|IDs|Uniforms)", RegexOptions.Compiled | RegexOptions.RightToLeft); static readonly Regex EndingsAddV = new Regex("^0", RegexOptions.Compiled); string Overrides { get; set; } @@ -358,6 +358,15 @@ namespace Bind } } + // If we have a convenience overload, we should turn the name from + // plural into singular + if (d.ReturnType.WrapperType == WrapperTypes.ConvenienceReturnType || + d.ReturnType.WrapperType == WrapperTypes.ConvenienceArrayReturnType) + { + trimmed_name = trimmed_name.Replace("Queries", "Query"); + trimmed_name = trimmed_name.TrimEnd('s'); + } + return trimmed_name; } @@ -748,7 +757,7 @@ namespace Bind foreach (var list in delegates.Values) { var d = list.First(); - if (d.Parameters.Count > 0) + if (d.Parameters.Count > 0 && d.Parameters.Count <= 2) { var p = d.Parameters.Last(); var r = d.ReturnType;