aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authors-ol <s-ol@users.noreply.github.com>2020-07-15 10:14:51 +0000
committers-ol <s-ol@users.noreply.github.com>2020-07-15 10:21:21 +0000
commit29a466daff791426a7f073fa178006bf209ff584 (patch)
tree9db105db798c202ab7a52805a7c56ad40be0bad4
parentadd vis/bar (diff)
downloadalive-29a466daff791426a7f073fa178006bf209ff584.tar.gz
alive-29a466daff791426a7f073fa178006bf209ff584.zip
fix crash when last expression in (do …) returns Constant
-rw-r--r--alv/builtins.moon7
-rw-r--r--alv/rtnode.moon2
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!