diff libinterp/corefcn/symtab.cc @ 28436:22e90bdcf47f stable

make find_scoped_function available in symbol_table class * fcn-info.h (fcn_info::find_scoped_function): Now const. * symtab.h, symtab.cc (symbol_table::find_scoped_function): New function.
author John W. Eaton <jwe@octave.org>
date Tue, 09 Jun 2020 16:52:57 -0400
parents 76a9f31540e3
children 8f3aedc5ab4f
line wrap: on
line diff
--- a/libinterp/corefcn/symtab.cc	Tue May 12 12:43:42 2020 -0400
+++ b/libinterp/corefcn/symtab.cc	Tue Jun 09 16:52:57 2020 -0400
@@ -71,6 +71,30 @@
     return val.is_defined ();
   }
 
+  octave_value
+  symbol_table::find_scoped_function (const std::string& name,
+                                      const symbol_scope& search_scope)
+  {
+    if (name.empty ())
+      return octave_value ();
+
+    fcn_table_const_iterator p = m_fcn_table.find (name);
+
+    if (p != m_fcn_table.end ())
+      return p->second.find_scoped_function (search_scope);
+    else
+      {
+        fcn_info finfo (name);
+
+        octave_value fcn = finfo.find_scoped_function (search_scope);
+
+        if (fcn.is_defined ())
+          m_fcn_table[name] = finfo;
+
+        return fcn;
+      }
+  }
+
   // FIXME: this function only finds legacy class methods, not
   // classdef methods.