From 568a44ef191e1f4072d379700e3b6f599150a92b Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 7 Jan 2018 18:45:27 -0800 Subject: Reworking some stuff so that functions only allow expressions to be return values with either an explicit "return" statement or if they're the only line in the function, and the line is an expression. --- lib/control_flow.nom | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/control_flow.nom') diff --git a/lib/control_flow.nom b/lib/control_flow.nom index 72a2ad1..33f72ab 100644 --- a/lib/control_flow.nom +++ b/lib/control_flow.nom @@ -210,7 +210,7 @@ compile [when %body] to code: if (%result != ""): %result join= "\nend" - %result + return %result # Switch statement compile [when %branch_value == ? %body] to code: @@ -259,7 +259,7 @@ compile [when %branch_value == ? %body] to code: ..\%result end end --when == ? - %result + return %result # Try/except compile [..] -- cgit v1.2.3