diff libinterp/corefcn/symtab.h @ 20242:abf85f8cbd6c

Expand type() to work on command-line entered functions (bug #40462). * symtab.h (find_cmdline_function): New function. * symtab.cc (__get_cmdline_fcn_txt__): New function. * pt-pr-code.cc (tree_print_code::visit_octave_user_function): Don't decrement indent level. * pt-pr-code.cc (tree_print_code::visit_no_op_command): Decrement indent level if end of fcn_or_script reached. * pt-pr-code.cc (tree_print_code::visit_statement): Just print newline. * type.m: Check for command-line function and print string from __get_cmdline_fcn_txt__() if it is not empty.
author John W. Eaton <jwe@octave.org>
date Wed, 20 May 2015 08:01:10 -0700
parents 19755f4fc851
children a9574e3c6e9e
line wrap: on
line diff
--- a/libinterp/corefcn/symtab.h	Tue May 19 13:49:21 2015 -0700
+++ b/libinterp/corefcn/symtab.h	Wed May 20 08:01:10 2015 -0700
@@ -1548,6 +1548,14 @@
            ? p->second.find_user_function () : octave_value ();
   }
 
+  static octave_value find_cmdline_function (const std::string& name)
+  {
+    fcn_table_iterator p = fcn_table.find (name);
+
+    return (p != fcn_table.end ())
+           ? p->second.find_cmdline_function () : octave_value ();
+  }
+
   static void install_cmdline_function (const std::string& name,
                                         const octave_value& fcn)
   {