aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorDaniel Colascione2015-03-03 13:18:00 -0800
committerDaniel Colascione2015-03-03 13:19:25 -0800
commit8b38d30e1b02809c34cfba9c7f15ca46f9d45f80 (patch)
treea5a5a73f2af6ca28da220e31965e20b9f128ab82 /lisp
parent7133f262bbd818509825a3317c91e91e62bd56fb (diff)
downloademacs-8b38d30e1b02809c34cfba9c7f15ca46f9d45f80.tar.gz
emacs-8b38d30e1b02809c34cfba9c7f15ca46f9d45f80.zip
Use `macroexp-parse-body'
* lisp/emacs-lisp/generator.el: (iter-defun): Use `macroexp-parse-body'. * test/automated/generator-tests.el (cps-testcase): Use (cps-test-declarations-preserved): New test.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog15
-rw-r--r--lisp/emacs-lisp/generator.el12
2 files changed, 20 insertions, 7 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 0cfe8eed02a..3bc9b8c85ce 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,18 @@
12015-03-03 Daniel Colascione <dancol@dancol.org>
2
3 * emacs-lisp/generator.el: Make globals conform to elisp
4 style throughout. Use more efficient font-lock patterns.
5 (cps-inhibit-atomic-optimization): Rename from
6 `cps-disable-atomic-optimization'.
7 (cps--gensym): New macro; replaces `cl-gensym' throughout.
8 (cps-generate-evaluator): Move the `iter-yield' local macro
9 definition here
10 (iter-defun, iter-lambda): from here.
11
12 (iter-defun): Use `macroexp-parse-body'.
13
142015-03-03 Daniel Colascione <dancol@dancol.org>
15
12015-03-03 Stefan Monnier <monnier@iro.umontreal.ca> 162015-03-03 Stefan Monnier <monnier@iro.umontreal.ca>
2 17
3 * progmodes/gud.el: Use lexical-binding (bug#19966). 18 * progmodes/gud.el: Use lexical-binding (bug#19966).
diff --git a/lisp/emacs-lisp/generator.el b/lisp/emacs-lisp/generator.el
index 77b1fab9b09..284de410580 100644
--- a/lisp/emacs-lisp/generator.el
+++ b/lisp/emacs-lisp/generator.el
@@ -687,14 +687,12 @@ encapsulates the state of a computation that produces a sequence
687of values. Callers can retrieve each value using `iter-next'." 687of values. Callers can retrieve each value using `iter-next'."
688 (declare (indent defun)) 688 (declare (indent defun))
689 (cl-assert lexical-binding) 689 (cl-assert lexical-binding)
690 (let (preamble) 690 (let* ((parsed-body (macroexp-parse-body body))
691 (when (stringp (car body)) 691 (declarations (car parsed-body))
692 (push (pop body) preamble)) 692 (exps (cdr parsed-body)))
693 (when (eq (car-safe (car body)) 'declare)
694 (push (pop body) preamble))
695 `(defun ,name ,arglist 693 `(defun ,name ,arglist
696 ,@(nreverse preamble) 694 ,@declarations
697 ,(cps-generate-evaluator body)))) 695 ,(cps-generate-evaluator exps))))
698 696
699(defmacro iter-lambda (arglist &rest body) 697(defmacro iter-lambda (arglist &rest body)
700 "Return a lambda generator. 698 "Return a lambda generator.