You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[test_sub_nesting(1)]: debuglevel 1
[test_sub_nesting(3)]: passing label level1
Entering level1.
[test_sub_nesting(5)]: gosub level2
[test_sub_nesting(9)]: passing label level2
Entering level2.
[test_sub_nesting(13)]: gosub level3
[test_sub_nesting(19)]: passing label level3
Entering level3.
[test_sub_nesting(23)]: gosub level4
[test_sub_nesting(32)]: passing label level4
Entering level4.
Exiting level4.
[test_sub_nesting(35)]: returning to line 23
[test_sub_nesting(26)]: gosub level4
[test_sub_nesting(32)]: passing label level4
Entering level4.
Exiting level4.
[test_sub_nesting(35)]: returning to line 26
Exiting level3.
[test_sub_nesting(28)]: returning to line 13
Exiting level2.
[test_sub_nesting(15)]: returning to line 13
ERROR: Overflow in level2.
[test_sub_nesting(17)]: exit
Note how it tried to return to line 13 twice in a row. The first time was correct, the second time was an error, and it should have been returning to the corresponding gosub on line 5.
This always seems to happen on the third context up from the deepest. In this example, the error happens in level 2 of 5. If I add another level, then the error happens on level 3 of 6.
I have isolated this to the case where there are two gosubs in a row, without being separated by a goto.
In other words, you can work around this problem (very painfully) with the following modifications to the script:
If you are processing a gosub and the most recent thing that set gosubContext was also a gosub, then this method will push two contexts onto the stack instead of one, which would produce the behavior where two sequential returns both try to go back to the same line number.
The text was updated successfully, but these errors were encountered:
To reproduce, run the following script:
The expected output should be:
The actual output (with debugging enabled) is:
Note how it tried to return to line 13 twice in a row. The first time was correct, the second time was an error, and it should have been returning to the corresponding
gosub
on line 5.This always seems to happen on the third context up from the deepest. In this example, the error happens in level 2 of 5. If I add another level, then the error happens on level 3 of 6.
I have isolated this to the case where there are two
gosub
s in a row, without being separated by agoto
.In other words, you can work around this problem (very painfully) with the following modifications to the script:
This produces the correct output.
This bug is almost certainly caused by https://github.com/outlander-app/outlander-osx/blob/master/src/Outlander/Scripting/ScriptContext.swift#L211-219
If you are processing a
gosub
and the most recent thing that setgosubContext
was also agosub
, then this method will push two contexts onto the stack instead of one, which would produce the behavior where two sequential returns both try to go back to the same line number.The text was updated successfully, but these errors were encountered: