Mercurial > octave
comparison libinterp/parse-tree/pt-eval.cc @ 23450:855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
* Canvas.cc, color-picker.cc, dialog.cc, marker.cc, main-window.cc, Cell.cc,
__magick_read__.cc, __pchip_deriv__.cc, __qp__.cc, bsxfun.cc, call-stack.cc,
cellfun.cc, data.cc, defaults.cc, det.cc, eig.cc, error.cc, file-io.cc,
filter.cc, find.cc, gammainc.cc, gcd.cc, gl-render.cc, graphics.cc,
graphics.in.h, help.cc, hex2num.cc, inv.cc, load-save.cc, lookup.cc,
ls-mat4.cc, ls-mat5.cc, ls-oct-binary.cc, ls-oct-text.cc, lu.cc, max.cc,
mex.cc, oct-hist.cc, oct-map.cc, oct-procbuf.cc, oct-stream.cc, pr-output.cc,
rand.cc, regexp.cc, schur.cc, str2double.cc, strfns.cc, symtab.cc, sysdep.cc,
tril.cc, variables.cc, xdiv.cc, audiodevinfo.cc, audioread.cc, colamd.cc,
gzip.cc, ov-base-diag.cc, ov-base-mat.h, ov-base-scalar.h, ov-class.cc,
ov-classdef.cc, ov-fcn-handle.cc, ov-range.cc, ov-range.h, ov-struct.cc,
ov-usr-fcn.cc, ov.cc, octave.cc, op-class.cc, pt-eval.cc, pt-funcall.cc,
pt-idx.cc, pt-jit.cc, pt-stmt.cc, version.cc, Array-util.cc, Array.cc,
CDiagMatrix.cc, CMatrix.cc, CNDArray.cc, CSparse.cc, Range.cc, Sparse.cc,
chNDArray.cc, dDiagMatrix.cc, dMatrix.cc, dNDArray.cc, dSparse.cc,
dim-vector.cc, fCDiagMatrix.cc, fCMatrix.cc, fCNDArray.cc, fDiagMatrix.cc,
fMatrix.cc, fNDArray.cc, idx-vector.cc, idx-vector.h, Faddeeva.cc, DASPK.cc,
DASRT.cc, DASSL.cc, EIG.cc, fEIG.cc, gsvd.cc, lo-specfun.cc, oct-rand.cc,
qr.cc, qrp.cc, randgamma.cc, schur.cc, svd.cc, Sparse-diag-op-defs.h,
mx-inlines.cc, oct-env.cc, cmd-edit.cc, kpse.cc, oct-inttypes.h, oct-sort.cc:
Wrap tertiary operator in parentheses "(COND ? x : y)".
author | Rik <rik@octave.org> |
---|---|
date | Thu, 27 Apr 2017 17:33:10 -0700 |
parents | c763214a8260 |
children | 21baad6b35c4 |
comparison
equal
deleted
inserted
replaced
23449:c763214a8260 | 23450:855122b993da |
---|---|
426 bool warned = false; | 426 bool warned = false; |
427 | 427 |
428 int count = 0; | 428 int count = 0; |
429 | 429 |
430 octave_value tmp = symbol_table::varval (".ignored."); | 430 octave_value tmp = symbol_table::varval (".ignored."); |
431 const Matrix ignored = tmp.is_defined () ? tmp.matrix_value () : Matrix (); | 431 const Matrix ignored = (tmp.is_defined () ? tmp.matrix_value () : Matrix ()); |
432 | 432 |
433 octave_idx_type k = 0; | 433 octave_idx_type k = 0; |
434 | 434 |
435 for (tree_decl_elt *elt : *param_list) | 435 for (tree_decl_elt *elt : *param_list) |
436 { | 436 { |
1149 | 1149 |
1150 if (! (id->is_variable () || args.empty ())) | 1150 if (! (id->is_variable () || args.empty ())) |
1151 { | 1151 { |
1152 tree_argument_list *al = *(args.begin ()); | 1152 tree_argument_list *al = *(args.begin ()); |
1153 | 1153 |
1154 size_t n = al ? al->length () : 0; | 1154 size_t n = (al ? al->length () : 0); |
1155 | 1155 |
1156 if (n > 0) | 1156 if (n > 0) |
1157 { | 1157 { |
1158 string_vector anm = *(arg_nm.begin ()); | 1158 string_vector anm = *(arg_nm.begin ()); |
1159 have_args = true; | 1159 have_args = true; |
1220 try | 1220 try |
1221 { | 1221 { |
1222 octave_value_list tmp_list | 1222 octave_value_list tmp_list |
1223 =tmp.subsref (type.substr (tmpi, i-tmpi), idx, nargout); | 1223 =tmp.subsref (type.substr (tmpi, i-tmpi), idx, nargout); |
1224 | 1224 |
1225 tmp = tmp_list.length () ? tmp_list(0) : octave_value (); | 1225 tmp = (tmp_list.length () ? tmp_list(0) : octave_value ()); |
1226 tmpi = i; | 1226 tmpi = i; |
1227 idx.clear (); | 1227 idx.clear (); |
1228 | 1228 |
1229 if (tmp.is_cs_list ()) | 1229 if (tmp.is_cs_list ()) |
1230 err_indexed_cs_list (); | 1230 err_indexed_cs_list (); |
1293 catch (octave::index_exception& e) // range problems, bad index type, etc. | 1293 catch (octave::index_exception& e) // range problems, bad index type, etc. |
1294 { | 1294 { |
1295 final_index_error (e, expr); | 1295 final_index_error (e, expr); |
1296 } | 1296 } |
1297 | 1297 |
1298 octave_value val = retval.length () ? retval(0) : octave_value (); | 1298 octave_value val = (retval.length () ? retval(0) : octave_value ()); |
1299 | 1299 |
1300 if (val.is_function ()) | 1300 if (val.is_function ()) |
1301 { | 1301 { |
1302 octave_function *fcn = val.function_value (true); | 1302 octave_function *fcn = val.function_value (true); |
1303 | 1303 |
1375 else | 1375 else |
1376 retval = do_single_type_concat<FloatComplexNDArray> (dv, tmp); | 1376 retval = do_single_type_concat<FloatComplexNDArray> (dv, tmp); |
1377 } | 1377 } |
1378 else if (result_type == "char") | 1378 else if (result_type == "char") |
1379 { | 1379 { |
1380 char type = all_dq_strings_p ? '"' : '\''; | 1380 char type = (all_dq_strings_p ? '"' : '\''); |
1381 | 1381 |
1382 if (! all_strings_p) | 1382 if (! all_strings_p) |
1383 warn_implicit_conversion ("Octave:num-to-str", | 1383 warn_implicit_conversion ("Octave:num-to-str", |
1384 "numeric", result_type); | 1384 "numeric", result_type); |
1385 else | 1385 else |
1477 | 1477 |
1478 // Now, extract the values from the individual elements and | 1478 // Now, extract the values from the individual elements and |
1479 // insert them in the result matrix. | 1479 // insert them in the result matrix. |
1480 | 1480 |
1481 int dv_len = dv.ndims (); | 1481 int dv_len = dv.ndims (); |
1482 octave_idx_type ntmp = dv_len > 1 ? dv_len : 2; | 1482 octave_idx_type ntmp = (dv_len > 1 ? dv_len : 2); |
1483 Array<octave_idx_type> ra_idx (dim_vector (ntmp, 1), 0); | 1483 Array<octave_idx_type> ra_idx (dim_vector (ntmp, 1), 0); |
1484 | 1484 |
1485 for (tm_row_const& row : tmp) | 1485 for (tm_row_const& row : tmp) |
1486 { | 1486 { |
1487 octave_quit (); | 1487 octave_quit (); |