diff options
| author | Bruce Hill <bitbucket@bruce-hill.com> | 2018-06-04 17:23:02 -0700 |
|---|---|---|
| committer | Bruce Hill <bitbucket@bruce-hill.com> | 2018-06-04 17:23:13 -0700 |
| commit | e7bdc35aa82339f0734ec7014d2da0459ff0462d (patch) | |
| tree | fbd04f75c4a75210e80b86c480e5dc15508968e9 /core/control_flow.nom | |
| parent | 7cd4f276b7b80e269569d775238606004edf1330 (diff) | |
Cleanups to try/catch logic and object logic.
Diffstat (limited to 'core/control_flow.nom')
| -rw-r--r-- | core/control_flow.nom | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/core/control_flow.nom b/core/control_flow.nom index 9120356..77e55c6 100644 --- a/core/control_flow.nom +++ b/core/control_flow.nom @@ -373,11 +373,11 @@ immediately end) if ok then \(%success as lua statements) - end - if not ok then + if not fell_through then + return ret + end + else \(%fallback as lua statements) - elseif not fell_through then - return ret end end parse [try %action] as @@ -401,19 +401,14 @@ immediately Lua ".." do local fell_through = false - local ok, ret1 = pcall(function() + local ok, ret = pcall(function() \(%action as lua statements) fell_through = true end) - local ok2, ret2 = pcall(function() - \(%final_action as lua statements) - end) - if not ok then error(ret1) end - if not ok2 then error(ret2) end - if not fell_through then - return ret1 - end - end --do-then-always + \(%final_action as lua statements) + if not ok then error(ret) end + if not fell_through then return ret end + end # Inline thunk: immediately |
