Mercurial > hg > octave-nkf
changeset 10926:f687bd17ce21
fix field assignment from private class methods
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Tue, 31 Aug 2010 08:04:05 +0200 |
parents | 2f9de135e7f9 |
children | a9e9659e1dca |
files | src/ChangeLog src/ov-class.cc src/ov-class.h |
diffstat | 3 files changed, 17 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2010-08-31 Jaroslav Hajek <highegg@gmail.com> + + * ov-class.cc (get_current_method_class): Make it an octave_class + method. Return class_name as default. + (octave_class::dotref): Error on zero return value. + 2010-08-30 Ben Abbott <bpabbott@mac.com> * gl-render.cc: Matlab compatible markers for the OpenGL.
--- a/src/ov-class.cc +++ b/src/ov-class.cc @@ -116,10 +116,10 @@ } } -static std::string -get_current_method_class (void) +std::string +octave_class::get_current_method_class (void) { - std::string retval; + std::string retval = class_name (); octave_function *fcn = octave_call_stack::current (); @@ -256,12 +256,15 @@ // Find the class in which this method resides before attempting to access // the requested field. - octave_base_value *obvp - = method_class.empty () ? 0 : find_parent_class (method_class); + octave_base_value *obvp = find_parent_class (method_class); - octave_map my_map; + if (obvp == 0) + { + error ("malformed class"); + return retval; + } - my_map = obvp ? obvp->map_value () : map; + octave_map my_map = (obvp == this) ? obvp->map_value () : map; std::string nm = idx(0).string_value ();