diff src/symtab.cc @ 9450:cf714e75c656

implement overloaded function handles
author Jaroslav Hajek <highegg@gmail.com>
date Thu, 23 Jul 2009 14:44:30 +0200
parents c5f03874ea2a
children d34baf412786
line wrap: on
line diff
--- a/src/symtab.cc	Wed Jul 22 15:11:04 2009 +0200
+++ b/src/symtab.cc	Thu Jul 23 14:44:30 2009 +0200
@@ -283,16 +283,18 @@
 }
 
 bool
-out_of_date_check (octave_value& function)
+out_of_date_check (octave_value& function,
+                   const std::string& dispatch_type)
 {
-  return out_of_date_check_internal (function);
+  return out_of_date_check_internal (function, dispatch_type);
 }
 
 bool
-out_of_date_check (octave_function* fcn)
+out_of_date_check (octave_function* fcn,
+                   const std::string& dispatch_type)
 {
   octave_value function;
-  return out_of_date_check_internal (fcn, function);
+  return out_of_date_check_internal (fcn, function, dispatch_type);
 }
 
 octave_value
@@ -423,7 +425,7 @@
   return retval;
 }
 
-static std::string
+std::string
 get_dispatch_type (const octave_value_list& args)
 {
   std::string dispatch_type;
@@ -462,13 +464,6 @@
 		dispatch_type = cname;
 	    }
 	}
-
-      if (dispatch_type.empty ())
-	{
-	  // No object found, so use class of first argument.
-
-	  dispatch_type = args(0).class_name ();
-	}
     }
 
   return dispatch_type;
@@ -621,6 +616,9 @@
     {
       std::string dispatch_type = get_dispatch_type (args);
 
+      if (dispatch_type.empty ())
+        dispatch_type = args(0).class_name ();
+
       octave_value fcn = find_method (dispatch_type);
 
       if (fcn.is_defined ())