Mercurial > hg > octave-lyh
comparison src/ov-class.cc @ 9331:a76f391a3d02
set up proper nargout for call to subsref method
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Thu, 11 Jun 2009 12:25:36 +0200 |
parents | 67fc970dad7d |
children | 3930f8ce6430 |
comparison
equal
deleted
inserted
replaced
9330:e903c92d2f02 | 9331:a76f391a3d02 |
---|---|
444 return octave_value_list (); | 444 return octave_value_list (); |
445 | 445 |
446 count++; | 446 count++; |
447 args(0) = octave_value (this); | 447 args(0) = octave_value (this); |
448 | 448 |
449 return feval (meth.function_value (), args, nargout); | 449 bool maybe_cs_list_query = (type[0] == '.' || type[0] == '{' |
450 || (type.length () > 1 && type[0] == '(' | |
451 && type[1] == '.')); | |
452 | |
453 if (nargout == 1 && maybe_cs_list_query) | |
454 { | |
455 // Set up a proper nargout for the subsref call by calling numel. | |
456 octave_value_list tmp; | |
457 if (type[0] != '.') tmp = idx.front (); | |
458 octave_idx_type true_nargout = numel (tmp); | |
459 if (! error_state) | |
460 { | |
461 tmp = feval (meth.function_value (), args, true_nargout); | |
462 if (true_nargout != 1) | |
463 retval(0) = octave_value (tmp, true); | |
464 else | |
465 retval = tmp; | |
466 } | |
467 } | |
468 else | |
469 retval = feval (meth.function_value (), args, nargout); | |
450 } | 470 } |
451 else | 471 else |
452 { | 472 { |
453 if (type.length () == 1 && type[0] == '(') | 473 if (type.length () == 1 && type[0] == '(') |
454 retval(0) = octave_value (map.index (idx.front ()), class_name ()); | 474 retval(0) = octave_value (map.index (idx.front ()), class_name ()); |