1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-20 02:30:23 +02:00

emacs-compatible lexical binding

* module/language/elisp/bindings.scm (global?): New function.
* module/language/elisp/compile-tree-il.scm (lexical-binding): New
  variable.
  (bind-lexically?): If lexical binding is enabled, bind lexically
  unless a special binding exists.
  (compile-%set-lexical-binding-mode): New function.
* module/language/elisp/lexer.scm (lexical-binding-regexp): New
  variable.
  (lex): Return a `set-lexical-binding-mode!' token if a comment is
  found while reading the first line.
* module/language/elisp/parser.scm (get-expression): Add support for
  `set-lexical-binding-mode!' tokens.
* module/language/elisp/runtime/function-slot.scm: Import and re-export
  the `%set-lexical-binding-mode' special form.
* test-suite/tests/elisp-compiler.test
  ("Let and Let*")["lambda args inside lexical-let"]: Update.
This commit is contained in:
BT Templeton 2011-07-09 18:49:02 -04:00
parent d4cb18ad9c
commit 03e00c5c9d
6 changed files with 47 additions and 10 deletions

View file

@ -295,7 +295,7 @@
(defun dyna () a)
(lexical-let ((a 2) (b 42))
(and (= a 2) (= (dyna) 1)
((lambda (a) (and (= a 3) (= b 42) (= (dyna) 3))) 3)
((lambda (a) (and (= a 3) (= b 42) (= (dyna) 1))) 3)
((lambda () (let ((a 3))
(and (= a 3) (= (dyna) 1)))))
(= a 2) (= (dyna) 1)))