diff options
author | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2013-07-18 13:41:27 +0200 |
---|---|---|
committer | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2013-07-18 14:05:26 +0200 |
commit | 98ad36db6286960152b38d4d47a710b220cf808e (patch) | |
tree | 8aa5c3dc6d3aa9a8ef81d1b97fdafd45a0f50bee | |
parent | 3ffe7d3b9ebb2a31b5d29af76ffb10f234e4be0d (diff) |
Implement MACROLET.
-rw-r--r-- | sb-eval2.lisp | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/sb-eval2.lisp b/sb-eval2.lisp index db8b301..816e462 100644 --- a/sb-eval2.lisp +++ b/sb-eval2.lisp @@ -347,6 +347,22 @@ (symbol (keywordify entry))))) (declaim (ftype (function * eval-closure) prepare-lambda)) +(defun prepare-macro-lambda (name lambda-form context) + (destructuring-bind (lambda-list &rest body) + lambda-form + (let* ((whole (gensym "WHOLE")) + (env (gensym "ENV")) + (body-form (sb-kernel:parse-defmacro lambda-list + whole + body + name + 'macrolet + :environment env))) + (prepare-form `(lambda (,whole ,env) + ,body-form) + context)))) + +(declaim (ftype (function * eval-closure) prepare-lambda)) (defun prepare-lambda (lambda-form context) (destructuring-bind (lambda-list &rest body) lambda-form ;; FIXME: SPECIAL declarations! @@ -840,7 +856,9 @@ (let ((bindings (mapcar (lambda (form) (cons (first form) (funcall - (prepare-lambda (rest form) context) + (prepare-macro-lambda (first form) + (rest form) + context) (make-null-environment)))) bindings))) (prepare-progn body (context-add-macros context bindings))))) @@ -883,7 +901,7 @@ (global-macro? (macro-function f))) (cond (local-macro? - (let ((macro-function (cdr local-macro?))) + (let ((macro-function local-macro?)) (prepare-form (funcall (the function macro-function) form (context->native-environment context)) |