+ return NULL_TREE;
+}
+
+/* Search in the interfaces of SEARCHED_CLASS and its superinterfaces
+ for a method matching METHOD_NAME and signature SIGNATURE. A
+ private helper for lookup_do. */
+static tree
+find_method_in_interfaces (tree searched_class, int flags, tree method_name,
+ tree signature, tree (*signature_builder) (tree))
+{
+ int i;
+ tree binfo, base_binfo;
+
+ for (binfo = TYPE_BINFO (searched_class), i = 1;
+ BINFO_BASE_ITERATE (binfo, i, base_binfo); i++)
+ {
+ tree iclass = BINFO_TYPE (base_binfo);
+ tree method;
+
+ /* If the superinterface hasn't been loaded yet, do so now. */
+ if (!CLASS_LOADED_P (iclass))
+ load_class (iclass, 1);
+
+ /* First, we look in ICLASS. If that doesn't work we'll
+ recursively look through all its superinterfaces. */
+ method = shallow_find_method (iclass, flags, method_name,
+ signature, signature_builder);
+ if (method != NULL_TREE)
+ return method;
+
+ method = find_method_in_interfaces
+ (iclass, flags, method_name, signature, signature_builder);
+ if (method != NULL_TREE)
+ return method;
+ }
+
+ return NULL_TREE;
+}
+
+
+/* Search in class SEARCHED_CLASS (and its superclasses) for a method
+ matching METHOD_NAME and signature SIGNATURE. FLAGS control some
+ parameters of the search.
+
+ SEARCH_INTERFACE means also search interfaces and superinterfaces
+ of SEARCHED_CLASS.
+
+ SEARCH_SUPER means skip SEARCHED_CLASS and start with its
+ superclass.
+
+ SEARCH_VISIBLE means skip methods for which METHOD_INVISIBLE is
+ set.
+
+ Return the matched method DECL or NULL_TREE. SIGNATURE_BUILDER is
+ used on method candidates to build their (sometimes partial)
+ signature. */
+static tree
+lookup_do (tree searched_class, int flags, tree method_name,
+ tree signature, tree (*signature_builder) (tree))
+{
+ tree method;
+ tree orig_class = searched_class;
+
+ if (searched_class == NULL_TREE)
+ return NULL_TREE;
+
+ if (flags & SEARCH_SUPER)
+ {