summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2019-02-28 19:52:30 -0800
committerKaz Kylheku <kaz@kylheku.com>2019-02-28 19:52:30 -0800
commit98559fa14d11f0f45a7f57a89149aef48747b00b (patch)
tree0114fe4ff1e4634f402e868949977364018363bf
parenta1bab9c5e9cfeb780f75fe5d363c22bdc193dcce (diff)
downloadtxr-98559fa14d11f0f45a7f57a89149aef48747b00b.tar.gz
txr-98559fa14d11f0f45a7f57a89149aef48747b00b.tar.bz2
txr-98559fa14d11f0f45a7f57a89149aef48747b00b.zip
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.
-rw-r--r--share/txr/stdlib/compiler.tl12
1 files 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