From fd37fa9b002aa38da92bdc5aa109f5c6ef62dcf1 Mon Sep 17 00:00:00 2001 From: Nathan Braswell Date: Sat, 12 Feb 2022 12:10:08 -0500 Subject: [PATCH] Had missed handling the empty call case () as an error in compile, which will happen when specutively compiling as code a nil that should be passed unevaluated, etc --- partial_eval.csc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/partial_eval.csc b/partial_eval.csc index 6f55759..7e02ced 100644 --- a/partial_eval.csc +++ b/partial_eval.csc @@ -3234,7 +3234,8 @@ (memo (put memo (.hash c) result)) ) (array result nil nil (array datasi funcs memo env pectx)))))))) - (if need_value (array nil nil (str "errr, needed value and was call " (str_strip c)) ctx) + (if need_value (array nil nil (str "errr, needed value and was call " (str_strip c)) ctx) + (if (= 0 (len (.marked_array_values c))) (array nil nil (str "errr, empty call array" (str_strip c)) ctx) (dlet ( ; This can weirdly cause infinate recursion on the compile side, if partial_eval @@ -3369,7 +3370,7 @@ (i32.wrap_i64 (i64.shr_u (local.get '$tmp) (i64.const 35))) ))) ) (array nil result_code func_err ctx))) - ))))) + )))))) ((marked_env? c) (or (get_passthrough (.hash c) ctx) (dlet ((e (.env_marked c)) @@ -4170,8 +4171,8 @@ (write_file "./csc_out.wasm" (compile (partial_eval (read-string (slurp "to_compile.kp"))))) )) -) (test-most)) -;) (run-compiler)) +;) (test-most)) +) (run-compiler)) ;) (single-test)) )