Mercurial > octave
diff libinterp/parse-tree/parse.h @ 23343:49f051ef6f2f
local functions in classdef files (bug #41723)
* symtab.h, symtab.cc (symbol_table::fcn_info::fcn_info_rep::xfind):
Also handle file-local functions
(symbol_table::fcn_info::fcn_info_rep::x_builtin_find): Likewise.
(symbol_table::fcn_info::fcn_info_rep::dump): Display info about local
functions.
(symbol_table::fcn_info::fcn_info_rep::local_functions): New map.
(symbol_table::fcn_info::fcn_info_rep::fcn_info_rep): Initialize it.
(symbol_table::fcn_info::fcn_info_rep::install_local_funciton): New function.
(symbol_table::fcn_info::fcn_info_rep::clear): Clear local_functions map.
(symbol_table::fcn_info::install_local_function): New function.
(symbol_table::install_local_function): New function.
* parse.h, oct-parse.in.yy (fcn_list, fcn_list1, opt_fcn_list):
New non-terminals. Set parsing_local_functions after classdef is
recognized.
(file): Accept opt_fcn_list list after classdef object.
(base_parser::parsing_local_functions): New data member.
(base_parser::base_parser): Initialize it.
(base_parser::finish_function): Handle local functions.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 03 Apr 2017 16:21:19 -0400 |
parents | c70c0397ca2f |
children | cd4e1ee28716 |
line wrap: on
line diff
--- a/libinterp/parse-tree/parse.h Mon Apr 03 12:50:55 2017 -0400 +++ b/libinterp/parse-tree/parse.h Mon Apr 03 16:21:19 2017 -0400 @@ -413,6 +413,11 @@ // only be declared inside function files. bool parsing_subfunctions; + // TRUE if we are parsing local functions defined at after a + // classdef block. Local functions can only be declared inside + // classdef files. + bool parsing_local_functions; + // Maximum function depth detected. Used to determine whether // we have nested functions or just implicitly ended subfunctions. int max_fcn_depth;