Mercurial > octave
changeset 24744:c1820e83f309
isprop.m: Simplify checking for abbreviated property matches.
* isprop.m: Use "local" option to warning() to temporarily set state of
"Octave:abbreviated-property-match" to "error". Remove code to set and
restore warning state manually.
author | Rik <rik@octave.org> |
---|---|
date | Mon, 12 Feb 2018 16:03:18 -0800 |
parents | f7e333b12687 |
children | d2467914ce33 |
files | scripts/plot/util/isprop.m |
diffstat | 1 files changed, 1 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/plot/util/isprop.m Mon Feb 12 17:18:43 2018 +0100 +++ b/scripts/plot/util/isprop.m Mon Feb 12 16:03:18 2018 -0800 @@ -38,9 +38,7 @@ error ("isprop: PROP name must be a string"); endif - oldwarn = warning ("error", "Octave:abbreviated-property-match"); - [olderr, oldid] = lasterr (); - restore_lasterr = false; + warning ("error", "Octave:abbreviated-property-match", "local"); res = false (size (obj)); for i = 1:numel (res) @@ -48,18 +46,10 @@ try v = get (obj(i), prop); res(i) = true; - catch - restore_lasterr = true; end_try_catch endif endfor - if (restore_lasterr) - lasterr (olderr, oldid); - endif - - warning (oldwarn); - endfunction