From 98559fa14d11f0f45a7f57a89149aef48747b00b Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Thu, 28 Feb 2019 19:52:30 -0800 Subject: compiler: fix (fun (lambda ...)). * share/txr/stdlib/compiler.tl (compiler comp-fun): Recognize a lambda expression argument. The neglect to do this is causing a miscompilation of (fun (lambda ...)) to a single getf instruction that processes raw syntax at run time and yields an interpreted lambda. --- share/txr/stdlib/compiler.tl | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/share/txr/stdlib/compiler.tl b/share/txr/stdlib/compiler.tl index 6ae10495..ef79a418 100644 --- a/share/txr/stdlib/compiler.tl +++ b/share/txr/stdlib/compiler.tl @@ -898,10 +898,14 @@ bfrag.ffuns))))))))) (defmeth compiler comp-fun (me oreg env form) - (mac-param-bind form (op sym) form - (iflet ((fbin env.(lookup-fun sym t))) - (new (frag fbin.loc nil nil (list sym))) - (new (frag oreg ^((getf ,oreg ,me.(get-sidx sym))) nil (list sym)))))) + (mac-param-bind form (op arg) form + (let ((fbin env.(lookup-fun arg t))) + (cond + (fbin (new (frag fbin.loc nil nil (list arg)))) + ((and (consp arg) (eq (car arg) 'lambda)) + me.(compile oreg env arg)) + (t (new (frag oreg ^((getf ,oreg ,me.(get-sidx arg))) + nil (list arg)))))))) (defmeth compiler comp-progn (me oreg env args) (let* (ffuns fvars -- cgit v1.2.3