changeset 23352:778fdffc09df

deprecate "octave_value (octave_value_list, bool)" constructor * ov.h, ov.cc (octave_value::octave_value (octave_value_list, bool)): Deprecate. Change all uses.
author John W. Eaton <jwe@octave.org>
date Wed, 05 Apr 2017 15:07:27 -0400
parents 5ea6c6d0c2db
children 95744d6d7d3b
files libinterp/octave-value/ov-cell.cc libinterp/octave-value/ov-class.cc libinterp/octave-value/ov.cc libinterp/octave-value/ov.h libinterp/parse-tree/pt-assign.cc
diffstat 5 files changed, 27 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/octave-value/ov-cell.cc	Wed Apr 05 14:11:18 2017 -0700
+++ b/libinterp/octave-value/ov-cell.cc	Wed Apr 05 15:07:27 2017 -0400
@@ -150,7 +150,10 @@
         if (tcell.numel () == 1)
           retval(0) = tcell(0,0);
         else
-          retval = octave_value (octave_value_list (tcell), true);
+          {
+            // Return a comma-separated list.
+            retval = octave_value (octave_value_list (tcell));
+          }
       }
       break;
 
@@ -199,7 +202,10 @@
         if (tcell.numel () == 1)
           retval = tcell(0,0);
         else
-          retval = octave_value (octave_value_list (tcell), true);
+          {
+            // Return a comma-separated list.
+            retval = octave_value (octave_value_list (tcell));
+          }
       }
       break;
 
--- a/libinterp/octave-value/ov-class.cc	Wed Apr 05 14:11:18 2017 -0700
+++ b/libinterp/octave-value/ov-class.cc	Wed Apr 05 15:07:27 2017 -0400
@@ -454,11 +454,11 @@
 
           retval = octave::feval (meth.function_value (), args, true_nargout);
 
-          // Since we're handling subsref, return the list in the first value
-          // if it has more than one element, to be able to pass through
-          // rvalue1 calls.
+          // Since we're handling subsref, if the list has more than one
+          // element, return it as a comma-separated list so that we can
+          // pass it to rvalue1.
           if (retval.length () > 1)
-            retval = octave_value (retval, true);
+            retval = octave_value (retval);
         }
       else
         {
--- a/libinterp/octave-value/ov.cc	Wed Apr 05 14:11:18 2017 -0700
+++ b/libinterp/octave-value/ov.cc	Wed Apr 05 15:07:27 2017 -0400
@@ -1128,6 +1128,10 @@
   : rep (new octave_cs_list (l))
 { }
 
+octave_value::octave_value (const octave_value_list& l)
+  : rep (new octave_cs_list (l))
+{ }
+
 octave_value::octave_value (octave_value::magic_colon)
   : rep (new octave_magic_colon ())
 { }
--- a/libinterp/octave-value/ov.h	Wed Apr 05 14:11:18 2017 -0700
+++ b/libinterp/octave-value/ov.h	Wed Apr 05 15:07:27 2017 -0400
@@ -292,7 +292,12 @@
                 const std::list<std::string>& plist);
   octave_value (const octave_scalar_map& m, const std::string& id,
                 const std::list<std::string>& plist);
-  octave_value (const octave_value_list& m, bool = false);
+
+  OCTAVE_DEPRECATED ("note: second argument is always ignored; use octave_value (const octave_value_list&) instead")
+  octave_value (const octave_value_list& m, bool);
+
+  octave_value (const octave_value_list& m);
+
   octave_value (octave_value::magic_colon);
 
   octave_value (octave_base_value *new_rep, bool borrow = false);
--- a/libinterp/parse-tree/pt-assign.cc	Wed Apr 05 14:11:18 2017 -0700
+++ b/libinterp/parse-tree/pt-assign.cc	Wed Apr 05 15:07:27 2017 -0400
@@ -263,11 +263,13 @@
                 if (k + nel > n)
                   error ("some elements undefined in return list");
 
-                // This won't do a copy.
+                // This element of the return list expects a
+                // comma-separated list of values.  Slicing avoids
+                // copying.
+
                 octave_value_list ovl = rhs_val.slice (k, nel);
 
-                ult.assign (octave_value::op_asn_eq,
-                            octave_value (ovl, true));
+                ult.assign (octave_value::op_asn_eq, octave_value (ovl));
 
                 retval_list.push_back (ovl);