From aee5f423b56f70347ca984b515728b0b7c6fdebb Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20V=C3=A1zquez?= Date: Wed, 24 Apr 2013 22:43:21 +0100 Subject: [PATCH] Define js:FOO as a macrosymbol to (%js-vref "") --- ecmalisp.lisp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ecmalisp.lisp b/ecmalisp.lisp index a0fbca1..45214ee 100644 --- a/ecmalisp.lisp +++ b/ecmalisp.lisp @@ -830,7 +830,7 @@ (when (eq package *keyword-package*) (oset symbol "value" symbol) (export (list symbol) package)) - (when (eq package (find-package "JS")) + (when (eq package *js-package*) (let ((sym-name (symbol-name symbol)) (args (gensym))) ;; Generate a trampoline to call the JS function @@ -842,7 +842,10 @@ (fset symbol (eval `(lambda (&rest ,args) (let ((,args (list-to-vector ,args))) - (%js-call (%js-vref ,sym-name) ,args))))))) + (%js-call (%js-vref ,sym-name) ,args))))) + ;; Define it as a symbol macro to access to the + ;; Javascript variable literally. + (%define-symbol-macro symbol `(%js-vref ,(string symbol))))) (oset symbols name symbol) (values symbol nil))))))) -- 1.7.10.4