1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-10 22:10:21 +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:
BT Templeton 2011-07-14 18:11:17 -04:00
parent ed5276f827
commit 48489836e2
2 changed files with 2 additions and 6 deletions

View file

@ -841,11 +841,7 @@
(compile-expr (apply macro-function arguments))))
(else
(make-application loc
(if (symbol? operator)
(reference-variable loc
operator
function-slot)
(compile-expr operator))
(compile-expr `(function ,operator))
(map compile-expr arguments))))))
;;; Compile a symbol expression. This is a variable reference or maybe

View file

@ -379,7 +379,7 @@
((lambda (a b c) c) 1 2 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
((lambda (&optional a) a)))