comparison libinterp/octave-value/ov-base.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 228b65504557
comparison
equal deleted inserted replaced
21117:c1df36373272 21118:3ac9f47fb04b
1361 if (t_result >= 0) 1361 if (t_result >= 0)
1362 { 1362 {
1363 octave_base_value::type_conv_fcn cf 1363 octave_base_value::type_conv_fcn cf
1364 = octave_value_typeinfo::lookup_widening_op (t_lhs, t_result); 1364 = octave_value_typeinfo::lookup_widening_op (t_lhs, t_result);
1365 1365
1366 if (cf) 1366 if (! cf)
1367 {
1368 octave_base_value *tmp = cf (*this);
1369
1370 if (tmp)
1371 {
1372 octave_value val (tmp);
1373
1374 retval = val.subsasgn (type, idx, rhs);
1375
1376 done = true;
1377 }
1378 else
1379 err_assign_conversion_failed (type_name (),
1380 rhs.type_name ());
1381 }
1382 else
1383 err_indexed_assignment (type_name (), rhs.type_name ()); 1367 err_indexed_assignment (type_name (), rhs.type_name ());
1368
1369 octave_base_value *tmp = cf (*this);
1370
1371 if (! tmp)
1372 err_assign_conversion_failed (type_name (), rhs.type_name ());
1373
1374 octave_value val (tmp);
1375
1376 retval = val.subsasgn (type, idx, rhs);
1377
1378 done = true;
1384 } 1379 }
1385 1380
1386 if (! done) 1381 if (! done)
1387 { 1382 {
1388 octave_value tmp_rhs; 1383 octave_value tmp_rhs;
1410 1405
1411 if (cf_rhs) 1406 if (cf_rhs)
1412 { 1407 {
1413 octave_base_value *tmp = cf_rhs (rhs.get_rep ()); 1408 octave_base_value *tmp = cf_rhs (rhs.get_rep ());
1414 1409
1415 if (tmp) 1410 if (! tmp)
1416 tmp_rhs = octave_value (tmp); 1411 err_assign_conversion_failed (type_name (), rhs.type_name ());
1417 else 1412
1418 err_assign_conversion_failed (type_name (), 1413 tmp_rhs = octave_value (tmp);
1419 rhs.type_name ());
1420 } 1414 }
1421 else 1415 else
1422 tmp_rhs = rhs; 1416 tmp_rhs = rhs;
1423 1417
1424 count++; 1418 count++;
1426 1420
1427 if (cf_this) 1421 if (cf_this)
1428 { 1422 {
1429 octave_base_value *tmp = cf_this (*this); 1423 octave_base_value *tmp = cf_this (*this);
1430 1424
1431 if (tmp) 1425 if (! tmp)
1432 tmp_lhs = octave_value (tmp); 1426 err_assign_conversion_failed (type_name (), rhs.type_name ());
1433 else 1427
1434 err_assign_conversion_failed (type_name (), 1428 tmp_lhs = octave_value (tmp);
1435 rhs.type_name ());
1436 } 1429 }
1437 1430
1438 if (cf_this || cf_rhs) 1431 if (! cf_this && ! cf_rhs)
1439 {
1440 retval = tmp_lhs.subsasgn (type, idx, tmp_rhs);
1441
1442 done = true;
1443 }
1444 else
1445 err_no_conversion (octave_value::assign_op_as_string 1432 err_no_conversion (octave_value::assign_op_as_string
1446 (octave_value::op_asn_eq), 1433 (octave_value::op_asn_eq),
1447 type_name (), rhs.type_name ()); 1434 type_name (), rhs.type_name ());
1435
1436 retval = tmp_lhs.subsasgn (type, idx, tmp_rhs);
1437
1438 done = true;
1448 } 1439 }
1449 } 1440 }
1450 1441
1451 // The assignment may have converted to a type that is wider than necessary. 1442 // The assignment may have converted to a type that is wider than necessary.
1452 1443