mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-07-02 07:40:30 +02:00
use guile eval for elisp tree-il
(Best-ability ChangeLog annotation added by Christopher Allan Webber.) * module/language/elisp/boot.el (eval): Update with simplified definition. * module/language/elisp/compile-tree-il.scm: Import "(language tree-il eval)". (eval-when-compile): Use eval-elisp. (defmacro): Use eval-tree-il. * module/language/elisp/runtime.scm: Import "(language tree-il eval)". (eval-elisp): Use "eval" to evaluate compiled form within current-module.
This commit is contained in:
parent
7bfd2ba132
commit
02bb985c98
3 changed files with 6 additions and 9 deletions
|
@ -209,12 +209,7 @@
|
||||||
f)))
|
f)))
|
||||||
|
|
||||||
(defun eval (form)
|
(defun eval (form)
|
||||||
(%funcall (@ (system base compile) compile)
|
(%funcall (@ (language elisp runtime) eval-elisp) form))
|
||||||
form
|
|
||||||
(%funcall (@ (guile) symbol->keyword) 'from)
|
|
||||||
'elisp
|
|
||||||
(%funcall (@ (guile) symbol->keyword) 'to)
|
|
||||||
'value))
|
|
||||||
|
|
||||||
(defun %indirect-function (object)
|
(defun %indirect-function (object)
|
||||||
(cond
|
(cond
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#:use-module (srfi srfi-11)
|
#:use-module (srfi srfi-11)
|
||||||
#:use-module (srfi srfi-26)
|
#:use-module (srfi srfi-26)
|
||||||
#:use-module (ice-9 format)
|
#:use-module (ice-9 format)
|
||||||
|
#:use-module (language tree-il eval)
|
||||||
#:export (compile-tree-il
|
#:export (compile-tree-il
|
||||||
compile-progn
|
compile-progn
|
||||||
compile-eval-when-compile
|
compile-eval-when-compile
|
||||||
|
@ -462,7 +463,7 @@
|
||||||
(map compile-expr-1 args))))
|
(map compile-expr-1 args))))
|
||||||
|
|
||||||
(defspecial eval-when-compile (loc args)
|
(defspecial eval-when-compile (loc args)
|
||||||
(make-const loc (compile `(progn ,@args) #:from 'elisp #:to 'value)))
|
(make-const loc (eval-elisp `(progn ,@args))))
|
||||||
|
|
||||||
(define toplevel? (make-fluid))
|
(define toplevel? (make-fluid))
|
||||||
|
|
||||||
|
@ -786,7 +787,7 @@
|
||||||
body))))
|
body))))
|
||||||
(make-const loc name))))
|
(make-const loc name))))
|
||||||
(when (fluid-ref toplevel?)
|
(when (fluid-ref toplevel?)
|
||||||
(compile tree-il #:from 'tree-il #:to 'value))
|
(eval-tree-il tree-il))
|
||||||
tree-il)))
|
tree-il)))
|
||||||
(else (report-error loc "bad defmacro" args))))
|
(else (report-error loc "bad defmacro" args))))
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#:use-module (ice-9 format)
|
#:use-module (ice-9 format)
|
||||||
#:use-module ((system base compile)
|
#:use-module ((system base compile)
|
||||||
#:select (compile))
|
#:select (compile))
|
||||||
|
#:use-module (language tree-il eval)
|
||||||
#:export (nil-value
|
#:export (nil-value
|
||||||
t-value
|
t-value
|
||||||
value-slot-module
|
value-slot-module
|
||||||
|
@ -247,7 +248,7 @@
|
||||||
(set! set-lexical-binding-mode (lambda (x) (set-symbol-value! 'lexical-binding x))))
|
(set! set-lexical-binding-mode (lambda (x) (set-symbol-value! 'lexical-binding x))))
|
||||||
|
|
||||||
(define (eval-elisp form)
|
(define (eval-elisp form)
|
||||||
(compile form #:from 'elisp #:to 'value))
|
(eval (compile form #:from 'elisp #:to 'tree-il) (current-module)))
|
||||||
|
|
||||||
(define (compile-elisp form)
|
(define (compile-elisp form)
|
||||||
(compile (compile form #:from 'elisp #:to 'bytecode)
|
(compile (compile form #:from 'elisp #:to 'bytecode)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue