comparison libinterp/octave-value/ov-class.cc @ 21118:3ac9f47fb04b

Invert pattern if/code/else/err_XXX to if !/err_XXX/code. * daspk.cc, dasrt.cc, dassl.cc, data.cc, debug.cc, load-save.cc, lsode.cc, quad.cc, xnorm.cc, xpow.cc, ov-base-diag.cc, ov-base-mat.cc, ov-base-scalar.cc, ov-base.cc, ov-bool-mat.cc, ov-bool-sparse.cc, ov-cell.cc, ov-ch-mat.cc, ov-class.cc, ov-cx-mat.cc, ov-cx-sparse.cc, ov-float.cc, ov-flt-cx-mat.cc, ov-flt-re-mat.cc, ov-intx.h, ov-perm.cc, ov-range.cc, ov-re-mat.cc, ov-re-sparse.cc, ov-scalar.cc, ov-struct.cc, ov.cc, pt-idx.cc, Array-util.cc, Array.cc, Sparse.cc, lo-specfun.cc, mx-inlines.cc, oct-binmap.h: Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
author Rik <rik@octave.org>
date Wed, 20 Jan 2016 16:08:30 -0800
parents dfcb9d74b253
children 8f76684324b5
comparison
equal deleted inserted replaced
21117:c1df36373272 21118:3ac9f47fb04b
479 octave_value 479 octave_value
480 octave_class::numeric_conv (const Cell& val, const std::string& type) 480 octave_class::numeric_conv (const Cell& val, const std::string& type)
481 { 481 {
482 octave_value retval; 482 octave_value retval;
483 483
484 if (val.numel () == 1) 484 if (val.numel () != 1)
485 {
486 retval = val(0);
487
488 if (type.length () > 0 && type[0] == '.' && ! retval.is_map ())
489 retval = octave_map ();
490 }
491 else
492 err_invalid_index_for_assignment (); 485 err_invalid_index_for_assignment ();
486
487 retval = val(0);
488
489 if (type.length () > 0 && type[0] == '.' && ! retval.is_map ())
490 retval = octave_map ();
493 491
494 return retval; 492 return retval;
495 } 493 }
496 494
497 octave_value 495 octave_value
681 map.contents (pkey).make_unique (); 679 map.contents (pkey).make_unique ();
682 tmpc = map.contents (pkey); 680 tmpc = map.contents (pkey);
683 } 681 }
684 682
685 // FIXME: better code reuse? 683 // FIXME: better code reuse?
686 if (tmpc.numel () == 1) 684 if (tmpc.numel () != 1)
685 err_indexed_cs_list ();
686
687 octave_value& tmp = tmpc(0);
688
689 if (! tmp.is_defined () || tmp.is_zero_by_zero ())
687 { 690 {
688 octave_value& tmp = tmpc(0); 691 tmp = octave_value::empty_conv (next_type, rhs);
689 692 tmp.make_unique (); // probably a no-op.
690 if (! tmp.is_defined () || tmp.is_zero_by_zero ())
691 {
692 tmp = octave_value::empty_conv (next_type, rhs);
693 tmp.make_unique (); // probably a no-op.
694 }
695 else
696 // optimization: ignore copy still stored inside our map.
697 tmp.make_unique (1);
698
699 t_rhs = tmp.subsasgn (next_type, next_idx, rhs);
700 } 693 }
701 else 694 else
702 err_indexed_cs_list (); 695 // optimization: ignore copy still stored inside our map.
696 tmp.make_unique (1);
697
698 t_rhs = tmp.subsasgn (next_type, next_idx, rhs);
703 } 699 }
704 break; 700 break;
705 701
706 case '{': 702 case '{':
707 err_invalid_index_type (type_name (), type[0]); 703 err_invalid_index_type (type_name (), type[0]);