# HG changeset patch # User Michael Goffioul # Date 1369252111 14400 # Node ID 50b37deadb663a4ae70f1bc6bc5fb86e6e7ab29a # Parent b9833510355d080cff8f3cfc7e16e2757f0736db 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. diff --git a/libinterp/octave-value/ov-classdef.cc b/libinterp/octave-value/ov-classdef.cc --- a/libinterp/octave-value/ov-classdef.cc +++ b/libinterp/octave-value/ov-classdef.cc @@ -1174,8 +1174,27 @@ } break; + case '(': + { + refcount++; + + cdef_object this_obj (this); + + Array 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; }