mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-15 08:10:17 +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:
parent
d4cb18ad9c
commit
03e00c5c9d
6 changed files with 47 additions and 10 deletions
|
@ -41,7 +41,9 @@
|
|||
(compile-defun . defun)
|
||||
(compile-defmacro . defmacro)
|
||||
(#{compile-`}# . #{`}#)
|
||||
(compile-quote . quote)))
|
||||
(compile-quote . quote)
|
||||
(compile-%set-lexical-binding-mode
|
||||
. %set-lexical-binding-mode)))
|
||||
#:duplicates (last)
|
||||
;; special operators
|
||||
#:re-export (progn
|
||||
|
@ -64,6 +66,7 @@
|
|||
defun
|
||||
defmacro
|
||||
#{`}#
|
||||
quote)
|
||||
quote
|
||||
%set-lexical-binding-mode)
|
||||
;; functions
|
||||
#:re-export (apply))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue