diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2019-02-28 19:52:30 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2019-02-28 19:52:30 -0800 |
commit | 98559fa14d11f0f45a7f57a89149aef48747b00b (patch) | |
tree | 0114fe4ff1e4634f402e868949977364018363bf | |
parent | a1bab9c5e9cfeb780f75fe5d363c22bdc193dcce (diff) | |
download | txr-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.tl | 12 |
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 |