From: David Vázquez Date: Wed, 24 Apr 2013 21:43:21 +0000 (+0100) Subject: Define js:FOO as a macrosymbol to (%js-vref "") X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=aee5f423b56f70347ca984b515728b0b7c6fdebb;p=jscl.git Define js:FOO as a macrosymbol to (%js-vref "") --- 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)))))))