-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix nargin for scripts in bytecode interpreter (bug #65140)
Make nargin calls in scripts properly match argv or number of function arguments, instead of always zero. * stack-frame.cc: Set nargin * test/compile/bytecode.tst: Do new test * test/compile/bytecode_script_nargin.m: New test file * test/compile/module.mk: Add new file
- Loading branch information
Showing
4 changed files
with
47 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
|
||
s_whos = whos; | ||
|
||
if length (s_whos) | ||
s_whos = s_whos(end); | ||
|
||
% Only in the top scope nargin is equal to the size of argv | ||
if strcmp (s_whos.nesting.function, "top scope") | ||
assert (length (argv ()) == nargin ()) | ||
end | ||
end | ||
|
||
assert (bytecode_script_nargin_expected_value == nargin) | ||
|
||
if exist ("bytecode_script_nargin_call_recursive") && bytecode_script_nargin_call_recursive | ||
bytecode_script_nargin_call_recursive = false; | ||
bytecode_script_nargin; | ||
bytecode_script_nargin_call_recursive = true; | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters