mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-26 05:00:28 +02:00
elisp binding declarations
* module/language/elisp/compile-tree-il.scm (bind-lexically?): Accept a new `decls' argument and check it for `lexical' declarations. Establish the same kind of binding whether or not a lexical binding for `sym' exists, whereas previously the presence of a lexical binding would cause newly-established bindings to be lexical bindings as well. (split-let-bindings): Remove. All callers changed. (generate-let, generate-let*, compile-lambda): Pass the declarations list to `bind-lexically?'. * test-suite/tests/elisp-compiler.test: Explicitly disable the lexical-binding mode. Add `lexical' declarations where necessary.
This commit is contained in:
parent
805b821189
commit
f6e0a4a60c
2 changed files with 62 additions and 69 deletions
|
@ -47,6 +47,8 @@
|
|||
; Test control structures.
|
||||
; ========================
|
||||
|
||||
(compile '(%set-lexical-binding-mode #nil) #:from 'elisp #:to 'value)
|
||||
|
||||
(with-test-prefix/compile "Sequencing"
|
||||
|
||||
(pass-if-equal "progn" 1
|
||||
|
@ -282,9 +284,11 @@
|
|||
(lexical-let ((a 2))
|
||||
(and (= a 2) (equal (dynvals) '(1 . 1))
|
||||
(let ((a 3) (b a))
|
||||
(declare (lexical a))
|
||||
(and (= a 3) (= b 2)
|
||||
(equal (dynvals) '(1 . 2))))
|
||||
(let* ((a 4) (b a))
|
||||
(declare (lexical a))
|
||||
(and (= a 4) (= b 4)
|
||||
(equal (dynvals) '(1 . 4))))
|
||||
(= a 2)))
|
||||
|
@ -295,8 +299,11 @@
|
|||
(defun dyna () a)
|
||||
(lexical-let ((a 2) (b 42))
|
||||
(and (= a 2) (= (dyna) 1)
|
||||
((lambda (a) (and (= a 3) (= b 42) (= (dyna) 1))) 3)
|
||||
((lambda (a)
|
||||
(declare (lexical a))
|
||||
(and (= a 3) (= b 42) (= (dyna) 1))) 3)
|
||||
((lambda () (let ((a 3))
|
||||
(declare (lexical a))
|
||||
(and (= a 3) (= (dyna) 1)))))
|
||||
(= a 2) (= (dyna) 1)))
|
||||
(= a 1)))
|
||||
|
@ -321,6 +328,7 @@
|
|||
(defun dynb () b)
|
||||
(lexical-let (a c)
|
||||
((lambda (a b &optional c)
|
||||
(declare (lexical a c))
|
||||
(and (= a 3) (= (dyna) 1)
|
||||
(= b 2) (= (dynb) 2)
|
||||
(= c 1)))
|
||||
|
@ -333,6 +341,7 @@
|
|||
(lexical-let (i)
|
||||
(setq to 1000000)
|
||||
(defun iteration-1 (i)
|
||||
(declare (lexical i))
|
||||
(if (< i to)
|
||||
(iteration-1 (1+ i))))
|
||||
(iteration-1 0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue