changeset 16694:50b37deadb66 classdef

Promote scalar object to array for '(' idnex assignment. * libinterp/octave-value/ov-classdef.cc (cdef_object_scalar::subsasgn): Promote scalar object to array for '(' index assignment. Also don't exit octave for unsupported index assignment.
author Michael Goffioul <michael.goffioul@gmail.com>
date Wed, 22 May 2013 15:48:31 -0400
parents b9833510355d
children 2823f8e3da77
files libinterp/octave-value/ov-classdef.cc
diffstat 1 files changed, 20 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/octave-value/ov-classdef.cc	Mon May 20 22:59:10 2013 -0400
+++ b/libinterp/octave-value/ov-classdef.cc	Wed May 22 15:48:31 2013 -0400
@@ -1174,8 +1174,27 @@
         }
       break;
 
+    case '(':
+        {
+          refcount++;
+
+          cdef_object this_obj (this);
+
+          Array<cdef_object> arr (dim_vector (1, 1), this_obj);
+
+          cdef_object new_obj = cdef_object (new cdef_object_array (arr));
+
+          new_obj.set_class (get_class ());
+
+          octave_value tmp = new_obj.subsasgn (type, idx, rhs);
+
+          if (! error_state)
+            retval = tmp;
+        }
+      break;
+
     default:
-      panic_impossible ();
+      error ("subsasgn: object cannot be index with `%c'", type[0]);
       break;
     }