Mercurial > hg > octave-shane
changeset 12258:077ece977a7b release-3-4-x
fix construction of class exemplars
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 27 Jan 2011 04:22:53 -0500 |
parents | 4f8069727e9f |
children | 40be4f07b3b5 |
files | src/ChangeLog src/ov-class.cc |
diffstat | 2 files changed, 25 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2011-01-27 John W. Eaton <jwe@octave.org> + + * ov-class.cc (octave_class::reconstruct_exemplar): + Call constructor with do_multi_index_op instead of feval. + Verify that symbol_table::find_method did return a class + constructor for the correct type. + 2011-01-26 John W. Eaton <jwe@octave.org> * lex.ll, graphics.cc, gl-render.cc, ov-mex-fcn.h, graphics.h.in:
--- a/src/ov-class.cc +++ b/src/ov-class.cc @@ -1068,9 +1068,25 @@ { octave_value ctor = symbol_table::find_method (c_name, c_name); - if (ctor.is_defined ()) + bool have_ctor = false; + + if (ctor.is_defined () && ctor.is_function ()) { - octave_value_list result = feval (ctor, 1); + octave_function *fcn = ctor.function_value (); + + if (fcn && fcn->is_class_constructor (c_name)) + have_ctor = true; + + // Something has gone terribly wrong if + // symbol_table::find_method (c_name, c_name) does not return + // a class constructor for the class c_name... + assert (have_ctor); + } + + if (have_ctor) + { + octave_value_list result + = ctor.do_multi_index_op (1, octave_value_list ()); if (result.length () == 1) retval = true;