1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-15 10:10:21 +02:00

restore special operator handling

(Best-ability ChangeLog annotation added by Christine Lemmer-Webber.)

* module/language/elisp/boot.el
  (progn, eval-when-compile, if, defconst, defvar, setq, let, flet)
  (labels, let*, function, defmacro, quote): Removed.

* module/language/elisp/compile-tree-il.scm (special-operators): Removed.
  (compound-pair): Use find-operator to check if a 'special-operator
  rather than checking the now removed special-operators table.

* module/language/elisp/runtime.scm (defspecial): Update to use
  set-symbol-function!
This commit is contained in:
Robin Templeton 2014-07-18 17:42:59 -04:00 committed by Christine Lemmer-Webber
parent 08380a632b
commit 8a4905f2cb
No known key found for this signature in database
GPG key ID: 4BC025925FF8F4D3
3 changed files with 7 additions and 44 deletions

View file

@ -785,43 +785,18 @@
(make-void loc))
(else (report-error loc "bad %set-lexical-binding-mode" args))))
(define special-operators (make-hash-table))
(for-each
(lambda (pair) (hashq-set! special-operators (car pair) (cddr pair)))
`((progn . ,compile-progn)
(eval-when-compile . ,compile-eval-when-compile)
(if . ,compile-if)
(defconst . ,compile-defconst)
(defvar . ,compile-defvar)
(setq . ,compile-setq)
(let . ,compile-let)
(flet . ,compile-flet)
(labels . ,compile-labels)
(let* . ,compile-let*)
(guile-ref . ,compile-guile-ref)
(guile-private-ref . ,compile-guile-private-ref)
(guile-primitive . ,compile-guile-primitive)
(%function . ,compile-%function)
(function . ,compile-function)
(defmacro . ,compile-defmacro)
(#{`}# . ,#{compile-`}#)
(quote . ,compile-quote)
(%funcall . ,compile-%funcall)
(%set-lexical-binding-mode . ,compile-%set-lexical-binding-mode)))
;;; Compile a compound expression to Tree-IL.
(define (compile-pair loc expr)
(let ((operator (car expr))
(arguments (cdr expr)))
(cond
((find-operator operator 'special-operator)
=> (lambda (special-operator-function)
(special-operator-function loc arguments)))
((find-operator operator 'macro)
=> (lambda (macro-function)
(compile-expr (apply macro-function arguments))))
((hashq-ref special-operators operator)
=> (lambda (special-operator-function)
(special-operator-function loc arguments)))
(else
(compile-expr `(%funcall (%function ,operator) ,@arguments))))))