Mercurial > octave
comparison libinterp/parse-tree/pt-tm-const.cc @ 28542:c318254c9f01 stable
accept and ignore undefined elements in matrix concatentation (bug #58695)
* pt-tm-const.cc (tm_row_const::init, tm_const::init): Continue if an
undefined element (or empty row) is found instead of returning early
and producing an undefined row (or empty array).
New tests.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 08 Jul 2020 07:56:36 -0400 |
parents | bd51beb6205e |
children | 66397e171801 |
comparison
equal
deleted
inserted
replaced
28540:ea5a632b2553 | 28542:c318254c9f01 |
---|---|
169 octave_quit (); | 169 octave_quit (); |
170 | 170 |
171 octave_value tmp = elt->evaluate (tw); | 171 octave_value tmp = elt->evaluate (tw); |
172 | 172 |
173 if (tmp.is_undefined ()) | 173 if (tmp.is_undefined ()) |
174 return; | 174 continue; |
175 | 175 |
176 if (tmp.is_cs_list ()) | 176 if (tmp.is_cs_list ()) |
177 { | 177 { |
178 octave_value_list tlst = tmp.list_value (); | 178 octave_value_list tlst = tmp.list_value (); |
179 | 179 |
316 | 316 |
317 first_elem = false; | 317 first_elem = false; |
318 } | 318 } |
319 | 319 |
320 if (row.empty ()) | 320 if (row.empty ()) |
321 break; | 321 continue; |
322 | 322 |
323 if (m_all_strings && ! row.all_strings_p ()) | 323 if (m_all_strings && ! row.all_strings_p ()) |
324 m_all_strings = false; | 324 m_all_strings = false; |
325 | 325 |
326 if (m_all_sq_strings && ! row.all_sq_strings_p ()) | 326 if (m_all_sq_strings && ! row.all_sq_strings_p ()) |
925 %!assert (isnull ([,])) | 925 %!assert (isnull ([,])) |
926 %!assert (isnull ([;])) | 926 %!assert (isnull ([;])) |
927 %!assert (isnull ([;;])) | 927 %!assert (isnull ([;;])) |
928 %!assert (isnull ([;,;])) | 928 %!assert (isnull ([;,;])) |
929 %!assert (isnull ([,;,;,])) | 929 %!assert (isnull ([,;,;,])) |
930 | |
931 ## Undefined elements. | |
932 %!function my_undef () | |
933 %!endfunction | |
934 %! | |
935 %!shared es | |
936 %! es = struct ("a", {}); | |
937 %! | |
938 %!assert <58695> ([1, es.a, 3], [1, 3]) | |
939 %!assert <58695> ([1, my_undef(), 3], [1, 3]) | |
940 %! | |
941 %!assert <58695> ([es.a, es.a, 3], 3) | |
942 %!assert <58695> ([my_undef(), my_undef(), 3], 3) | |
943 %! | |
944 %!assert <58695> ([1; es.a; 3], [1; 3]) | |
945 %!assert <58695> ([1; my_undef(), 3], [1; 3]) | |
946 %! | |
947 %!assert <58695> ([es.a; es.a; 3], 3) | |
948 %!assert <58695> ([my_undef(); my_undef(); 3], 3) | |
949 %! | |
950 %!assert <58695> ([es.a; es.a; 3], 3) | |
951 %!assert <58695> ([my_undef(); my_undef(); 3], 3) | |
930 */ | 952 */ |