changeset 14512:e0d66b8b0c63

Avoid double delete for nested functions in commandline * oct-parse.yy (finish_function): Only create a tree_function_def if current_depth is one.
author Max Brister <max@2bass.com>
date Fri, 30 Mar 2012 16:40:03 -0400
parents cdc752aba928
children 3313635c622d
files src/oct-parse.yy
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/oct-parse.yy
+++ b/src/oct-parse.yy
@@ -2941,15 +2941,16 @@
                                              primary_fcn_scope);
         }
 
-      if (! reading_fcn_file)
+      if (! reading_fcn_file && current_function_depth == 1)
         {
           // We are either reading a script file or defining a function
           // at the command line, so this definition creates a
           // tree_function object that is placed in the parse tree.
           // Otherwise, it is just inserted in the symbol table,
-          // either as a subfunction (see above), or as the primary
-          // function for the file, via primary_fcn_ptr (see also
-          // load_fcn_from_file,, parse_fcn_file, and
+          // either as a subfunction or nested function (see above),
+          // or as the primary function for the file, via
+          // primary_fcn_ptr (see also load_fcn_from_file,,
+          // parse_fcn_file, and
           // symbol_table::fcn_info::fcn_info_rep::find_user_function).
 
           retval = new tree_function_def (fcn);