From: David Vázquez Date: Wed, 24 Apr 2013 18:40:15 +0000 (+0100) Subject: translate-variable checks if the symbol is unbound X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=291433e057263e10ad988ad062b8530e1be30bcc;p=jscl.git translate-variable checks if the symbol is unbound --- diff --git a/ecmalisp.lisp b/ecmalisp.lisp index 9fd5cba..a7f9f5c 100644 --- a/ecmalisp.lisp +++ b/ecmalisp.lisp @@ -931,6 +931,10 @@ (aset v i x) (incf i)))) +(defmacro awhen (condition &body body) + `(let ((it ,condition)) + (when it ,@body))) + #+ecmalisp (progn (defun values-list (list) @@ -1358,6 +1362,9 @@ (incf index))))) ',name))) + +;;; Environment + (def!struct binding name type @@ -1399,7 +1406,8 @@ (code "v" (incf *variable-counter*))) (defun translate-variable (symbol) - (binding-value (lookup-in-lexenv symbol *environment* 'variable))) + (awhen (lookup-in-lexenv symbol *environment* 'variable) + (binding-value it))) (defun extend-local-env (args) (let ((new (copy-lexenv *environment*)))