diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-07-04 18:09:33 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-07-04 18:09:33 -0400 |
| commit | 2c89f3385f0863c83267b50400832a81de07538c (patch) | |
| tree | 9a57ed96d7c19743f07a6874f196d46b4c76d50b /test/defer.tm | |
| parent | 6a105fbd801f10bd6c8cee32fd6d45a279f33e1b (diff) | |
Fixes for defer statements in lambdas
Diffstat (limited to 'test/defer.tm')
| -rw-r--r-- | test/defer.tm | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/defer.tm b/test/defer.tm index fcc14f16..121878b1 100644 --- a/test/defer.tm +++ b/test/defer.tm @@ -39,3 +39,32 @@ func main(): say("Made it through inner loop") say("Made it through the loop") + + >> thunk := func(return_early=no): + say("Entering thunk") + defer: + say("Deferred thunk cleanup") + + if return_early: + say("Returning early...") + return + + say("Finished thunk") + + >> thunk(no) + >> thunk(yes) + + >> defer_func(yes) + >> defer_func(no) + +func defer_func(return_early=no): + say("Entering defer_func") + defer: + say("Deferred defer_func cleanup") + + if return_early: + say("Returning early...") + return + + say("Finished defer_func") + |
