diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2011-02-21 18:40:54 -0500 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2011-02-21 18:40:54 -0500 |
commit | cb9336bd977d3345b86234c36d45228f7fb27eec (patch) | |
tree | b4b88a95c633e7d732b31f12a5cfc3f61d579e07 /lisp/emacs-lisp/bytecomp.el | |
parent | f619ad4ca2ce943d53589469c010e451afab97dd (diff) | |
download | emacs-cb9336bd977d3345b86234c36d45228f7fb27eec.tar.gz emacs-cb9336bd977d3345b86234c36d45228f7fb27eec.tar.bz2 emacs-cb9336bd977d3345b86234c36d45228f7fb27eec.zip |
* lisp/emacs-lisp/cconv.el (cconv-closure-convert-rec): Let the byte
compiler choose the representation of closures.
(cconv--env-var): Remove.
* lisp/emacs-lisp/bytecomp.el (byte-compile--env-var): New var.
(byte-compile-make-closure, byte-compile-get-closed-var):
New functions.
* lisp/cedet/semantic/wisent/comp.el (wisent-byte-compile-grammar):
Macroexpand before passing to byte-compile-form.
Diffstat (limited to 'lisp/emacs-lisp/bytecomp.el')
-rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 8892a27b29c..771306bb0e6 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -3339,6 +3339,24 @@ discarding." "Output byte codes to store the top-of-stack value at position STACK-POS in the stack." (byte-compile-out 'byte-stack-set (- byte-compile-depth (1+ stack-pos)))) +(byte-defop-compiler-1 internal-make-closure byte-compile-make-closure) +(byte-defop-compiler-1 internal-get-closed-var byte-compile-get-closed-var) + +(defconst byte-compile--env-var (make-symbol "env")) + +(defun byte-compile-make-closure (form) + ;; FIXME: don't use `curry'! + (byte-compile-form + (unless for-effect + `(curry (function (lambda (,byte-compile--env-var . ,(nth 1 form)) + . ,(nthcdr 3 form))) + (vector . ,(nth 2 form)))) + for-effect)) + +(defun byte-compile-get-closed-var (form) + (byte-compile-form (unless for-effect + `(aref ,byte-compile--env-var ,(nth 1 form))) + for-effect)) ;; Compile a function that accepts one or more args and is right-associative. ;; We do it by left-associativity so that the operations |