diff libinterp/corefcn/oct-lvalue.cc @ 20248:011a364b4d78

improve compatibility of indexed assignment (bug #43813) * oct-lvalue.h, oct-lvalue.cc (octave_lvalue::index_type, octave_lvalue::index_is_empty): New functions. * pt-assign.cc (tree_multi_assignment::rvalue): For expressions like [lhs{:}] = fcn (args) with LHS undefined, and in which FCN produces an output given nargout equal to zero, convert LHS to a one-element cell array indexed by 1.
author John W. Eaton <jwe@octave.org>
date Fri, 05 Jun 2015 15:51:04 -0400
parents 4197fc428c7d
children 48b2ad5ee801
line wrap: on
line diff
--- a/libinterp/corefcn/oct-lvalue.cc	Wed Jun 03 14:16:43 2015 -0700
+++ b/libinterp/corefcn/oct-lvalue.cc	Fri Jun 05 15:51:04 2015 -0400
@@ -54,6 +54,21 @@
     error ("invalid index expression in assignment");
 }
 
+bool
+octave_lvalue::index_is_empty (void) const
+{
+  bool retval = false;
+
+  if (idx.size () == 1)
+    {
+      octave_value_list tmp = idx.front ();
+
+      retval = (tmp.length () == 1 && tmp(0).is_empty ());
+    }
+
+  return retval;
+}
+
 void
 octave_lvalue::do_unary_op (octave_value::unary_op op)
 {