Merge categories for redefined functions
authorStefanos A. <stapostol@gmail.com>
Sun, 3 Nov 2013 18:13:49 +0000 (19:13 +0100)
committerStefanos A. <stapostol@gmail.com>
Sun, 3 Nov 2013 18:13:49 +0000 (19:13 +0100)
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.

Source/Bind/Structures/Delegate.cs

index ff52b5be29c9d18783461c44b761cfd52a31869d..7b5a5c4b365cd234838b30d933d72a3dfa887798 100644 (file)
@@ -302,15 +302,20 @@ namespace Bind.Structures
             else
             {
                 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);
                 }
                 else
                 {
-                    Trace.WriteLine(String.Format(
-                        "Spec error: function {0} redefined, ignoring second definition.",
-                        d.Name));
+                    // Function redefined with identical parameters:
+                    // merge the categories and ignore the second definition.
+                    if (!list[index].Category.Contains(d.Category))
+                    {
+                        list[index].Category += "|" + d.Category;
+                    }
                 }
             }
         }