comparison src/ov-fcn-handle.cc @ 10961:2cc9b08bfd39

fixes in binders code
author Jaroslav Hajek <highegg@gmail.com>
date Sun, 12 Sep 2010 21:10:35 +0200
parents 409ceee18acc
children 4ab04ea74b08
comparison
equal deleted inserted replaced
10960:409ceee18acc 10961:2cc9b08bfd39
1898 } 1898 }
1899 } 1899 }
1900 1900
1901 if (! bad) 1901 if (! bad)
1902 { 1902 {
1903 // Stash proper name tags.
1904 std::list<string_vector> arg_names = idx_expr->arg_names ();
1905 assert (arg_names.size () == 1);
1906 arg_template.stash_name_tags (arg_names.front ());
1907
1903 retval = new octave_fcn_binder (f, root_val, arg_template, 1908 retval = new octave_fcn_binder (f, root_val, arg_template,
1904 arg_mask, npar); 1909 arg_mask, npar);
1905 } 1910 }
1906 } 1911 }
1907 } 1912 }
1931 { 1936 {
1932 for (int i = 0; i < arg_template.length (); i++) 1937 for (int i = 0; i < arg_template.length (); i++)
1933 { 1938 {
1934 int j = arg_mask[i]; 1939 int j = arg_mask[i];
1935 if (j >= 0) 1940 if (j >= 0)
1936 arg_template.xelem(i) = args(j); 1941 arg_template(i) = args(j); // May force a copy...
1937 } 1942 }
1938 1943
1939 retval = root_handle.do_multi_index_op (nargout, arg_template, lvalue_list); 1944 // Make a shallow copy of arg_template, to ensure consistency throughout the following
1945 // call even if we happen to get back here.
1946 octave_value_list tmp (arg_template);
1947 retval = root_handle.do_multi_index_op (nargout, tmp, lvalue_list);
1940 } 1948 }
1941 else 1949 else
1942 retval = octave_fcn_handle::do_multi_index_op (nargout, args, lvalue_list); 1950 retval = octave_fcn_handle::do_multi_index_op (nargout, args, lvalue_list);
1943 1951
1944 return retval; 1952 return retval;