From 6ad1aa9978b219f34799ae9db41e20452d06145f Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sat, 26 May 2018 21:00:38 -0700 Subject: compiler: fix broken block*. Compiling a block* fails with an exception: nil is accessed as a structure. * share/txr/stdlib/compiler.tl (comp-block): when compiling block*, nenv is nil; we must use env when compiling the name subexpression. Also, we can't use nenv when compiling the body. We must use nenv when it is available (block case) or else fall back on env (block* case). --- share/txr/stdlib/compiler.tl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/txr/stdlib/compiler.tl b/share/txr/stdlib/compiler.tl index 98b3fc4a..d1f5c016 100644 --- a/share/txr/stdlib/compiler.tl +++ b/share/txr/stdlib/compiler.tl @@ -602,9 +602,9 @@ (binfo (unless star (cdar nenv.(extend-block name)))) (treg (if star me.(maybe-alloc-treg oreg))) - (nfrag (if star me.(compile treg nenv name))) + (nfrag (if star me.(compile treg env name))) (nreg (if star nfrag.oreg me.(get-dreg name))) - (bfrag me.(comp-progn oreg nenv body)) + (bfrag me.(comp-progn oreg (or nenv env) body)) (lskip (gensym "l"))) (when treg me.(maybe-free-treg treg oreg)) -- cgit v1.2.3