view test/bug-53579.tst @ 25203:72ea868ca63a stable

allow function parameters to be global (bug #53579) * symrec.h (symbol_record::unbind_global_rep): New function. * symscope.h (symbol_scope::refresh): Use it to also unbind global symbols. * test/bug-53579.tst: New file. * test/module.mk: Update.
author John W. Eaton <jwe@octave.org>
date Wed, 11 Apr 2018 00:07:06 -0400
parents
children 34617dd78f02
line wrap: on
line source

%!function [raa, rbb, igaa, igbb] = sub1 (aa, bb)
%!  global aa bb
%!  aa = 1;
%!  raa = aa;
%!  rbb = bb;
%!  igaa = isglobal ("aa");
%!  igbb = isglobal ("bb");
%!endfunction

%!test <*53579>
%! global aa bb
%! assert (isglobal ("aa"));
%! assert (isglobal ("bb"));
%! aa = 3;
%! xx = 5;
%! [raa, rbb, igaa, igbb] = sub1 (aa, xx);
%! assert (raa, 1);
%! assert (rbb, []);
%! assert (igaa);
%! assert (igbb);
%! assert (xx, 5);