-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kernel: evaluate function call arguments before options
Previously, this was what the immediate interpreter did, but *not* what the executor did; the latter always evaluated options first.
- Loading branch information
Showing
3 changed files
with
101 additions
and
61 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#@local myfunc, func_call, proc_call | ||
# Fix GitHub issue #4631: The evaluation order of arguments versus | ||
# options in function and procedure calls differed between the immediate | ||
# interpreter, and the executor for coded statements. | ||
gap> myfunc := function( ) | ||
> Display( ValueOption( "myopt" ) ); | ||
> return 1; | ||
> end;; | ||
gap> func_call := function( ) | ||
> # a function call follows; one of the arguments uses myopt as a side effect | ||
> return IdFunc( myfunc( ) : myopt := "myopt_value" ); | ||
> end;; | ||
gap> proc_call := function( ) | ||
> # a procedure call follows; one of the arguments uses myopt as a side effect | ||
> Ignore( myfunc( ) : myopt := "myopt_value" ); | ||
> end;; | ||
|
||
# call as function, delayed | ||
gap> func_call( );; | ||
fail | ||
|
||
# call as function, immediately | ||
gap> IdFunc( myfunc( ) : myopt := "myopt_value" );; | ||
fail | ||
|
||
# call as procedure, delayed | ||
gap> proc_call( ); | ||
fail | ||
|
||
# call as procedure, immediately | ||
gap> Ignore( myfunc( ) : myopt := "myopt_value" ); | ||
fail |
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 |
---|---|---|
@@ -1,3 +1,12 @@ | ||
# | ||
# Tests for functions defined in src/funcs.c | ||
# | ||
gap> START_TEST("kernel/funcs.tst"); | ||
|
||
# | ||
gap> SetRecursionTrapInterval(fail); | ||
Error, SetRecursionTrapInterval: <interval> must be a small integer greater th\ | ||
an 5 (not the value 'fail') | ||
|
||
# | ||
gap> STOP_TEST("kernel/funcs.tst", 1); |