Mercurial > hg > octave-terminal
changeset 10659:8baff2aceabc
fix slicing value lists with name tags (bug #29960)
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Wed, 26 May 2010 12:03:45 +0200 |
parents | c66a4657d764 |
children | 4cdc43c095c5 |
files | src/ChangeLog src/oct-obj.h src/oct-parse.yy src/pt-idx.cc |
diffstat | 4 files changed, 17 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2010-05-26 Jaroslav Hajek <highegg@gmail.com> + + * oct-obj.h (octave_value_list::slice): Optionally include tags in + slicing. + * oct-parse.yy (get_feval_args): Simplify. + * pt-idx.cc (make_value_list): Use octave_idx_type instead of int. + 2010-05-25 Jaroslav Hajek <highegg@gmail.com> * ov.cc (octave_value::length): Simplify.
--- a/src/oct-obj.h +++ b/src/oct-obj.h @@ -125,8 +125,14 @@ octave_value_list& reverse (void); octave_value_list - slice (octave_idx_type offset, octave_idx_type len) const - { return data.index (idx_vector (offset, offset + len)); } + slice (octave_idx_type offset, octave_idx_type len, bool tags = false) const + { + octave_value_list retval (data.linear_slice (offset, offset + len)); + if (tags && len > 0 && names.length () > 0) + retval.names = names.linear_slice (offset, std::min (len, names.length ())); + + return retval; + } octave_value_list splice (octave_idx_type offset, octave_idx_type len,
--- a/src/oct-parse.yy +++ b/src/oct-parse.yy @@ -4126,18 +4126,7 @@ static octave_value_list get_feval_args (const octave_value_list& args) { - octave_value_list retval = args.slice (1, args.length () - 1); - - string_vector arg_names = args.name_tags (); - - if (arg_names.length () > 1) - { - string_vector tmp_arg_names = arg_names.linear_slice (1, args.length () - 1); - - retval.stash_name_tags (tmp_arg_names); - } - - return retval; + return args.slice (1, args.length () - 1, true); }