Mercurial > octave
changeset 29182:e359e0fcd6e7 stable
improve class_simple function handle function lookup (bug #59661)
* ov-fcn-handle.cc (class_simple_fcn_handle::function_value): If
function object is cached, use it. Otherwise, search for method using
name and cached dispatch class.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Sun, 13 Dec 2020 16:25:03 +0100 |
parents | eec0fe95576e |
children | dabc5d43db96 76c94c998d7b |
files | libinterp/octave-value/ov-fcn-handle.cc |
diffstat | 1 files changed, 16 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/octave-value/ov-fcn-handle.cc Mon Dec 14 13:55:10 2020 -0500 +++ b/libinterp/octave-value/ov-fcn-handle.cc Sun Dec 13 16:25:03 2020 +0100 @@ -436,7 +436,22 @@ // scoping or overloads. octave_function * function_value (bool = false) { - return m_fcn.function_value (); + // FIXME: Shouldn't the lookup rules here match those used in the + // call method? + + if (m_fcn.is_defined ()) + return m_fcn.function_value (); + + symbol_table& symtab + = __get_symbol_table__ ("class_simple_fcn_handle::function_value"); + + // FIXME: is caching the correct thing to do? + // Cache this value so that the pointer will be valid as long as the + // function handle object is valid. + + m_fcn = symtab.find_method (m_name, m_dispatch_class); + + return m_fcn.is_defined () ? m_fcn.function_value () : nullptr; } octave_user_function * user_function_value (bool = false)