compiler: clean up stack on branch statements
When `return` or `break` statement is encountered inside a for/range/switch statement, top stack items can be auxilliary. They need to be cleaned up before returning from the function.
This commit is contained in:
parent
3f1e8f66b6
commit
2a1402f25d
3 changed files with 63 additions and 2 deletions
|
@ -35,7 +35,10 @@ func TestNotAssignedFunctionCall(t *testing.T) {
|
|||
return 0
|
||||
}
|
||||
`
|
||||
eval(t, src, []byte{})
|
||||
// disable stack checks because it is hard right now
|
||||
// to distinguish between simple function call traversal
|
||||
// and the same traversal inside an assignment.
|
||||
evalWithoutStackChecks(t, src, []byte{})
|
||||
}
|
||||
|
||||
func TestMultipleFunctionCalls(t *testing.T) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue