diff options
Diffstat (limited to 'lib/control_flow.nom')
| -rw-r--r-- | lib/control_flow.nom | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/control_flow.nom b/lib/control_flow.nom index 6287bfb..f0c0714 100644 --- a/lib/control_flow.nom +++ b/lib/control_flow.nom @@ -178,3 +178,12 @@ compile [when %branch-value == ? %body] to code: %result join= "\n::finished_when::;\nend;" %result + +# With statement +compile [with %thing = %value %action] to code: ".." + |do; + | local old_value = \(%thing as lua); + | \(%thing as lua) = \(%value as lua); + | \(%action as lua statements); + | \(%thing as lua) = old_value; + |end; |
