Merge categories for redefined functions

Now that we support function overloads, it is safe to ignore functions
that are defined multiple times. We just merge their Category
properties if they are not identical.
This commit is contained in:
Stefanos A. 2013-11-03 19:13:49 +01:00
parent 346547331a
commit 35c0edfa42

View file

@ -302,15 +302,20 @@ namespace Bind.Structures
else else
{ {
var list = Delegates[d.Name]; var list = Delegates[d.Name];
if (!list.Contains(d)) var index = list.IndexOf(d);
if (index < 0)
{ {
// Function not defined - add it!
list.Add(d); list.Add(d);
} }
else else
{ {
Trace.WriteLine(String.Format( // Function redefined with identical parameters:
"Spec error: function {0} redefined, ignoring second definition.", // merge the categories and ignore the second definition.
d.Name)); if (!list[index].Category.Contains(d.Category))
{
list[index].Category += "|" + d.Category;
}
} }
} }
} }