mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-28 16:00:22 +02:00
elisp `labels'
* module/language/elisp/compile-tree-il.scm (compile-labels): New special operator. * module/language/elisp/runtime/function-slot.scm: Update module definition.
This commit is contained in:
parent
0e5b7e74e4
commit
1c2f9636dc
2 changed files with 23 additions and 0 deletions
|
@ -39,6 +39,7 @@
|
||||||
compile-let
|
compile-let
|
||||||
compile-lexical-let
|
compile-lexical-let
|
||||||
compile-flet
|
compile-flet
|
||||||
|
compile-labels
|
||||||
compile-let*
|
compile-let*
|
||||||
compile-lexical-let*
|
compile-lexical-let*
|
||||||
compile-guile-ref
|
compile-guile-ref
|
||||||
|
@ -637,6 +638,26 @@
|
||||||
(map (cut parse-flet-binding loc <>) bindings)
|
(map (cut parse-flet-binding loc <>) bindings)
|
||||||
body))))
|
body))))
|
||||||
|
|
||||||
|
(defspecial labels (loc args)
|
||||||
|
(pmatch args
|
||||||
|
((,bindings . ,body)
|
||||||
|
(let ((names+vals (map (cut parse-flet-binding loc <>) bindings)))
|
||||||
|
(receive (decls forms) (parse-body body)
|
||||||
|
(let ((names (map car names+vals))
|
||||||
|
(vals (map cdr names+vals))
|
||||||
|
(gensyms (map (lambda (x) (gensym)) names+vals)))
|
||||||
|
(with-lexical-bindings
|
||||||
|
(fluid-ref bindings-data)
|
||||||
|
names
|
||||||
|
gensyms
|
||||||
|
(lambda ()
|
||||||
|
(make-letrec #f
|
||||||
|
loc
|
||||||
|
names
|
||||||
|
gensyms
|
||||||
|
(map compile-expr vals)
|
||||||
|
(compile-expr `(progn ,@forms)))))))))))
|
||||||
|
|
||||||
(defspecial let* (loc args)
|
(defspecial let* (loc args)
|
||||||
(pmatch args
|
(pmatch args
|
||||||
((,bindings . ,body)
|
((,bindings . ,body)
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
(compile-let . let)
|
(compile-let . let)
|
||||||
(compile-lexical-let . lexical-let)
|
(compile-lexical-let . lexical-let)
|
||||||
(compile-flet . flet)
|
(compile-flet . flet)
|
||||||
|
(compile-labels . labels)
|
||||||
(compile-let* . let*)
|
(compile-let* . let*)
|
||||||
(compile-lexical-let* . lexical-let*)
|
(compile-lexical-let* . lexical-let*)
|
||||||
(compile-guile-ref . guile-ref)
|
(compile-guile-ref . guile-ref)
|
||||||
|
@ -52,6 +53,7 @@
|
||||||
let
|
let
|
||||||
lexical-let
|
lexical-let
|
||||||
flet
|
flet
|
||||||
|
labels
|
||||||
let*
|
let*
|
||||||
lexical-let*
|
lexical-let*
|
||||||
guile-ref
|
guile-ref
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue