Commit 8f0f8c16 authored by Daniel Colascione's avatar Daniel Colascione
Browse files

Fix docstrings, declarations in iter-defun

* lisp/emacs-lisp/generator.el (iter-defun): Correctly propagate
docstrings and declarations to underlying function.
parent f6b5db6c
2015-03-03 Daniel Colascione <dancol@dancol.org>
* emacs-lisp/generator.el (iter-defun): Correctly propagate
docstrings and declarations to underlying function.
2015-03-02 Daniel Colascione <dancol@dancol.org>
 
* emacs-lisp/generator.el: New file.
......
......@@ -674,10 +674,16 @@ encapsulates the state of a computation that produces a sequence
of values. Callers can retrieve each value using `iter-next'."
(declare (indent defun))
(cl-assert lexical-binding)
`(defun ,name ,arglist
,(cps-generate-evaluator
`(cl-macrolet ((iter-yield (value) `(cps-internal-yield ,value)))
,@body))))
(let (preamble)
(when (stringp (car body))
(push (pop body) preamble))
(when (eq (car-safe (car body)) 'declare)
(push (pop body) preamble))
`(defun ,name ,arglist
,@(nreverse preamble)
,(cps-generate-evaluator
`(cl-macrolet ((iter-yield (value) `(cps-internal-yield ,value)))
,@body)))))
(defmacro iter-lambda (arglist &rest body)
"Return a lambda generator.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment