# HG changeset patch # User John W. Eaton # Date 1216319111 14400 # Node ID db6478d9c6697e56632f225ac325567f028313c5 # Parent f8cab9eeb128a062153720153880b6ef27ba8397 out_of_date_check_internal: make it work for class methods diff -r f8cab9eeb128 -r db6478d9c669 src/ChangeLog --- a/src/ChangeLog Thu Jul 17 10:56:22 2008 -0400 +++ b/src/ChangeLog Thu Jul 17 14:25:11 2008 -0400 @@ -1,3 +1,11 @@ +2008-07-17 John W. Eaton + + * symtab.cc (out_of_date_check_internal): New arg, dispatch_type. + Use it to handle class methods. + + * toplev.h (octave_call_stack::do_caller): New function. + (octave_call_stack::caller): Use it. + 2008-07-17 Jaroslav Hajek * Makefile.in (convhulln.oct, __delaunayn__.oct, __voronoi__.oct, diff -r f8cab9eeb128 -r db6478d9c669 src/symtab.cc --- a/src/symtab.cc Thu Jul 17 10:56:22 2008 -0400 +++ b/src/symtab.cc Thu Jul 17 14:25:11 2008 -0400 @@ -149,7 +149,8 @@ } static inline bool -out_of_date_check_internal (octave_value& function) +out_of_date_check_internal (octave_value& function, + const std::string& dispatch_type = std::string ()) { bool retval = false; @@ -186,14 +187,15 @@ file = nm; else { - // FIXME -- this lookup is not right since it doesn't - // account for dispatch type. - // We don't want to make this an absolute name, // because load_fcn_file looks at the name to // decide whether it came from a relative lookup. - file = load_path::find_fcn (nm, dir_name); + if (dispatch_type.empty ()) + file = load_path::find_fcn (nm, dir_name); + else + file = load_path::find_method (nm, dispatch_type, + dir_name); } if (file.empty ()) @@ -477,7 +479,7 @@ octave_value& fval = q->second; if (fval.is_defined ()) - out_of_date_check_internal (fval); + out_of_date_check_internal (fval, name); if (fval.is_defined ()) return fval; @@ -620,7 +622,7 @@ octave_value& fval = q->second; if (fval.is_defined ()) - out_of_date_check_internal (fval); + out_of_date_check_internal (fval, dispatch_type); if (fval.is_defined ()) return fval; diff -r f8cab9eeb128 -r db6478d9c669 src/toplev.h --- a/src/toplev.h Thu Jul 17 10:56:22 2008 -0400 +++ b/src/toplev.h Thu Jul 17 14:25:11 2008 -0400 @@ -157,7 +157,7 @@ // Caller function, may be built-in. static octave_function *caller (void) { - return element (1); + return instance_ok () ? instance->do_caller () : 0; } static size_t current_frame (void) @@ -286,6 +286,11 @@ int do_caller_user_code_column (void) const; + octave_function *do_caller (void) const + { + return curr_frame > 1 ? cs[curr_frame-1].fcn : cs[0].fcn; + } + size_t do_current_frame (void) { return curr_frame; } size_t do_size (void) { return cs.size (); }