Mercurial > hg > octave-nkf
diff libinterp/octave-value/ov-classdef.cc @ 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 |
line wrap: on
line diff
--- 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<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; }