Mercurial > hg > octave-lojdl
changeset 11445:40f311a69417
fix OO field access in subfunctions of private functions
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 05 Jan 2011 16:17:35 -0500 |
parents | 08f8b0d96091 |
children | 67e3edbf8ff7 |
files | src/ChangeLog src/ov-fcn.h src/ov-usr-fcn.h src/symtab.cc src/symtab.h |
diffstat | 5 files changed, 55 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,16 @@ +2011-01-05 John W. Eaton <jwe@octave.org> + + Bug #32060. + + * ov-fcn.h (octave_function::mark_as_private_function): Now virtual. + * ov-usr-fcn.h (octave_function::mark_as_private_fucntion): + New function. Mark subfunctions as private also. + * symtab.cc, symtab.h + (symbol_table::mark_subfunctions_in_scope_as_private, + symbol_table::fcn_info::mark_subfunction_in_scope_as_private, + symbol_table::fcn_info::fcn_info_rep::mark_subfunction_in_scope_as_private): + New functions. + 2011-01-04 John W. Eaton <jwe@octave.org> * ov-base-sparse.cc (octave_base_sparse<T>::print_raw): Improve
--- a/src/ov-fcn.h +++ b/src/ov-fcn.h @@ -92,7 +92,8 @@ std::string dispatch_class (void) const { return xdispatch_class; } - void mark_as_private_function (const std::string& cname = std::string ()) + virtual void + mark_as_private_function (const std::string& cname = std::string ()) { private_function = true; xdispatch_class = cname;
--- a/src/ov-usr-fcn.h +++ b/src/ov-usr-fcn.h @@ -233,6 +233,13 @@ bool takes_var_return (void) const; + void mark_as_private_function (const std::string& cname = std::string ()) + { + symbol_table::mark_subfunctions_in_scope_as_private (local_scope, cname); + + octave_function::mark_as_private_function (cname); + } + void lock_subfunctions (void); void unlock_subfunctions (void);
--- a/src/symtab.cc +++ b/src/symtab.cc @@ -429,6 +429,21 @@ } void +symbol_table::fcn_info::fcn_info_rep:: mark_subfunction_in_scope_as_private + (scope_id scope, const std::string& class_name) +{ + scope_val_iterator p = subfunctions.find (scope); + + if (p != subfunctions.end ()) + { + octave_function *fcn = p->second.function_value (); + + if (fcn) + fcn->mark_as_private_function (class_name); + } +} + +void symbol_table::fcn_info::fcn_info_rep::print_dispatch (std::ostream& os) const { if (dispatch_map.empty ())
--- a/src/symtab.h +++ b/src/symtab.h @@ -594,6 +594,9 @@ subfunctions.erase (p); } + void mark_subfunction_in_scope_as_private (scope_id scope, + const std::string& class_name); + void install_cmdline_function (const octave_value& f) { cmdline_function = f; @@ -824,6 +827,12 @@ rep->erase_subfunction (scope); } + void mark_subfunction_in_scope_as_private (scope_id scope, + const std::string& class_name) + { + rep->mark_subfunction_in_scope_as_private (scope, class_name); + } + void install_cmdline_function (const octave_value& f) { rep->install_cmdline_function (f); @@ -966,6 +975,15 @@ q->second.erase_subfunction (scope); } + static void + mark_subfunctions_in_scope_as_private (scope_id scope, + const std::string& class_name) + { + for (fcn_table_iterator q = fcn_table.begin (); + q != fcn_table.end (); q++) + q->second.mark_subfunction_in_scope_as_private (scope, class_name); + } + static scope_id dup_scope (scope_id scope) { scope_id retval = -1;