changeset 29183:dabc5d43db96

maint: merge stable to default.
author John W. Eaton <jwe@octave.org>
date Mon, 14 Dec 2020 16:14:12 -0500
parents d809f75d2017 (current diff) e359e0fcd6e7 (diff)
children dd4cb1ad9dc8
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:57:45 2020 -0500
+++ b/libinterp/octave-value/ov-fcn-handle.cc	Mon Dec 14 16:14:12 2020 -0500
@@ -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)