diff options
| author | s-ol <s-ol@users.noreply.github.com> | 2020-07-15 10:14:51 +0000 |
|---|---|---|
| committer | s-ol <s+removethis@s-ol.nu> | 2025-03-02 14:24:49 +0000 |
| commit | a0d8f61d5239a3b1b827cec5a8eeb7a315d03259 (patch) | |
| tree | 92e1792ecca34efd19ff8996a6fb99ee6523be90 | |
| parent | add vis/bar (diff) | |
| download | alive-a0d8f61d5239a3b1b827cec5a8eeb7a315d03259.tar.gz alive-a0d8f61d5239a3b1b827cec5a8eeb7a315d03259.zip | |
fix crash when last expression in (do …) returns Constant
| -rw-r--r-- | alv/builtins.moon | 7 | ||||
| -rw-r--r-- | alv/rtnode.moon | 2 |
2 files changed, 6 insertions, 3 deletions
diff --git a/alv/builtins.moon b/alv/builtins.moon index d5d729c..11c073d 100644 --- a/alv/builtins.moon +++ b/alv/builtins.moon @@ -251,8 +251,11 @@ Evaluate `expr1`, `expr2`, … and return the value of the last expression." eval: (scope, tail) => scope = Scope scope children = [expr\eval scope for expr in *tail] - last = children[#children] - super RTNode :children, result: last and last.result + result = if last = children[#children] then last.result + if result and result.metatype == '=' + result = result.type\mk_sig result\unwrap! + + super RTNode :children, result if_ = Constant.meta meta: diff --git a/alv/rtnode.moon b/alv/rtnode.moon index 0639e3e..98c230e 100644 --- a/alv/rtnode.moon +++ b/alv/rtnode.moon @@ -129,7 +129,7 @@ class RTNode if @result if next @side_inputs - assert @result.metatype != '=', "Const result has side_inputs" + assert @result.metatype != '=', "Const result #{@result} has side_inputs" elseif @result.metatype == '~' @result = @result.type\mk_const @result\unwrap! |
