Mercurial > octave-nkf
changeset 16656:cf84ea2ba2d3
require dynamic field names to be character strings
* pt-idx.cc (tree_index_expression::get_struct_index):
Require field names to be character strings.
* orderfields.m: Index fieldnames with {} instead of ().
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 13 May 2013 18:50:14 -0400 |
parents | 8fa0b416f465 |
children | c1d5bf2eb3b6 |
files | libinterp/parse-tree/pt-idx.cc scripts/miscellaneous/orderfields.m |
diffstat | 2 files changed, 7 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/parse-tree/pt-idx.cc Mon May 13 16:37:28 2013 -0400 +++ b/libinterp/parse-tree/pt-idx.cc Mon May 13 18:50:14 2013 -0400 @@ -216,7 +216,12 @@ octave_value t = df->rvalue1 (); if (! error_state) - fn = t.string_value (); + { + if (t.is_string ()) + fn = t.string_value (); + else + error ("dynamic structure field names must be character strings"); + } } else panic_impossible ();
--- a/scripts/miscellaneous/orderfields.m Mon May 13 16:37:28 2013 -0400 +++ b/scripts/miscellaneous/orderfields.m Mon May 13 18:50:14 2013 -0400 @@ -153,7 +153,7 @@ else n = numel (s1); for i = 1:numel (names) - el = names(i); + el = names{i}; [t(1:n).(el)] = s1(:).(el); endfor ## inherit dimensions