mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-12 06:41:13 +02:00
evaluate the function position correctly
* module/language/elisp/compile-tree-il (compile-pair): Use `function' to perform functional evaluation. Previously, if the operator of a compound form was not a symbol, the operator would be evaluated as a normal expression. This happened to work only because there is a `lambda' macro. The compiler will now signal an error if the operator is neither a function name nor a lambda expression. * test-suite/tests/elisp-compiler.test ("Lambda Expressions")["optional argument"]: Remove an erroneous use of `function' in the function position.
This commit is contained in:
parent
ed5276f827
commit
48489836e2
2 changed files with 2 additions and 6 deletions
|
@ -841,11 +841,7 @@
|
||||||
(compile-expr (apply macro-function arguments))))
|
(compile-expr (apply macro-function arguments))))
|
||||||
(else
|
(else
|
||||||
(make-application loc
|
(make-application loc
|
||||||
(if (symbol? operator)
|
(compile-expr `(function ,operator))
|
||||||
(reference-variable loc
|
|
||||||
operator
|
|
||||||
function-slot)
|
|
||||||
(compile-expr operator))
|
|
||||||
(map compile-expr arguments))))))
|
(map compile-expr arguments))))))
|
||||||
|
|
||||||
;;; Compile a symbol expression. This is a variable reference or maybe
|
;;; Compile a symbol expression. This is a variable reference or maybe
|
||||||
|
|
|
@ -379,7 +379,7 @@
|
||||||
((lambda (a b c) c) 1 2 3))
|
((lambda (a b c) c) 1 2 3))
|
||||||
|
|
||||||
(pass-if-equal "optional argument" 3
|
(pass-if-equal "optional argument" 3
|
||||||
((function (lambda (a &optional b c) c)) 1 2 3))
|
((lambda (a &optional b c) c) 1 2 3))
|
||||||
(pass-if-equal "optional missing" nil-value
|
(pass-if-equal "optional missing" nil-value
|
||||||
((lambda (&optional a) a)))
|
((lambda (&optional a) a)))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue