Mercurial > hg > octave-avbm
changeset 10272:272179888089
Fclass: improve argument decoding
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 08 Feb 2010 01:36:18 -0500 |
parents | 297996005012 |
children | 3a8c13b71612 |
files | src/ChangeLog src/ov-class.cc |
diffstat | 2 files changed, 19 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2010-02-08 John W. Eaton <jwe@octave.org> + + * ov-class.cc (Fclass): If more than 1 argument, check that + call is inside class constructor first, then check for valid + arguments. + 2010-02-05 Jaroslav Hajek <highegg@gmail.com> * data.cc (F__accumarray_sum__): Allow bool and char inputs.
--- a/src/ov-class.cc +++ b/src/ov-class.cc @@ -1721,18 +1721,18 @@ retval = args(0).class_name (); else { - Octave_map m = args(0).map_value (); + octave_function *fcn = octave_call_stack::caller (); - if (! error_state) - { - std::string id = args(1).string_value (); + if (fcn && fcn->is_class_constructor ()) + { + Octave_map m = args(0).map_value (); - if (! error_state) - { - octave_function *fcn = octave_call_stack::caller (); + if (! error_state) + { + std::string id = args(1).string_value (); - if (fcn && fcn->is_class_constructor ()) - { + if (! error_state) + { if (nargin == 2) retval = octave_value (new octave_class (m, id)); else @@ -1753,15 +1753,15 @@ else if (! it->second.compare (retval)) error ("class: object of class `%s' does not match previously constructed objects", id.c_str ()); } - } + } else - error ("class: invalid call from outside class constructor"); + error ("class: expecting character string as second argument"); } else - error ("class: expecting character string as second argument"); + error ("class: expecting structure as first argument"); } else - error ("class: expecting structure as first argument"); + error ("class: invalid call from outside class constructor"); } return retval;