2005-10-28 Sebastien Pouliot <sebastien@ximian.com>
[mono.git] / mcs / mcs / pending.cs
index cd189eaaa889a6122da1cf197ef664553a760d5c..f0fb07d6729107b235c9b7d3578114766028ff66 100644 (file)
@@ -414,28 +414,35 @@ namespace Mono.CSharp {
                                        } else if ((need_proxy == null) && (name != m.Name))
                                                continue;
 
-                                       if (ret_type != m.ReturnType){
-                                               if (!((ret_type == null && m.ReturnType == TypeManager.void_type) ||
-                                                     (m.ReturnType == null && ret_type == TypeManager.void_type)))
-                                                       continue;
-                                       }
+                                       if (ret_type != m.ReturnType &&
+                                           !(ret_type == null && m.ReturnType == TypeManager.void_type) &&
+                                           !(m.ReturnType == null && ret_type == TypeManager.void_type))
+                                               continue;
 
                                        //
                                        // Check if we have the same parameters
                                        //
-                                       if (tm.args [i].Length != arg_len)
+
+                                       if (tm.args [i] == null && arg_len != 0)
+                                               continue;
+                                       if (tm.args [i] != null && tm.args [i].Length != arg_len)
                                                continue;
 
-                                       int j, top = args.Count;
+                                       int j;
 
-                                       for (j = 0; j < top; j++)
-                                               if (tm.args [i][j] != args.ParameterType (j) ||
-                                                               (tm.mods [i][j] != args.ParameterModifier (j) &&
-                                                                tm.mods [i][j] != Parameter.Modifier.PARAMS &&
-                                                                args.ParameterModifier (j) != Parameter.Modifier.PARAMS)
-                                                        )
+                                       for (j = 0; j < arg_len; j++) {
+                                               if (tm.args [i][j] != args.ParameterType (j))
+                                                       break;
+                                               if (tm.mods [i][j] == args.ParameterModifier (j))
+                                                       continue;
+                                               // The modifiers are different, but if one of them
+                                               // is a PARAMS modifier, and the other isn't, ignore
+                                               // the difference.
+                                               if (tm.mods [i][j] != Parameter.Modifier.PARAMS &&
+                                                   args.ParameterModifier (j) != Parameter.Modifier.PARAMS)
                                                        break;
-                                       if (j != top)
+                                       }
+                                       if (j != arg_len)
                                                continue;
 
                                        if (op != Operation.Lookup){