Mercurial > octave-nkf
diff libinterp/octave-value/ov.cc @ 20615:729a85dafba8
use new string_value method to handle value extraction errors
* ov-class.cc, ov-classdef.cc, ov-fcn-handle.cc, ov-fcn-inline.cc,
ov.cc, pt-idx.cc: Use new string_value method.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 08 Oct 2015 17:55:57 -0400 |
parents | 56fee8f84fe7 |
children | e5986cba4ca8 |
line wrap: on
line diff
--- a/libinterp/octave-value/ov.cc Thu Oct 08 18:15:56 2015 -0400 +++ b/libinterp/octave-value/ov.cc Thu Oct 08 17:55:57 2015 -0400 @@ -2834,24 +2834,17 @@ for (int k = 0; k < nel; k++) { - if (type(k).is_string ()) - { - std::string item = type(k).string_value (); - if (item == "{}") - type_string[k] = '{'; - else if (item == "()") - type_string[k] = '('; - else if (item == ".") - type_string[k] = '.'; - else - { - error ("%s: invalid indexing type '%s'", name, item.c_str ()); - return; - } - } + std::string item = type(k).string_value ("%s: type(%d) must be a string", name, k+1); + + if (item == "{}") + type_string[k] = '{'; + else if (item == "()") + type_string[k] = '('; + else if (item == ".") + type_string[k] = '.'; else { - error ("%s: type(%d) must be a string", name, k+1); + error ("%s: invalid indexing type '%s'", name, item.c_str ()); return; }