mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 03:40:34 +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
|
@ -201,6 +201,8 @@
|
|||
(setter expr)
|
||||
(force-promises! expr)
|
||||
expr))
|
||||
((set-lexical-binding-mode!)
|
||||
(return `(%set-lexical-binding-mode ,(cdr token))))
|
||||
(else
|
||||
(parse-error token "expected expression, got" token)))))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue