From c55bcd53c80b901559820b4c9fa23d8896ae3f5f Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20V=C3=A1zquez?= Date: Thu, 6 Jun 2013 13:25:18 +0100 Subject: [PATCH] (SETF OGET) AND (SETF OGET*) --- src/ffi.lisp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/ffi.lisp b/src/ffi.lisp index 32b9f21..da1ce27 100644 --- a/src/ffi.lisp +++ b/src/ffi.lisp @@ -34,3 +34,34 @@ (setq *intern-hook* #'ffi-intern-hook) (defvar *root* (%js-vref "window")) + +(define-setf-expander oget (object key &rest keys) + (let* ((keys (cons key keys)) + (g!object (gensym)) + (g!keys (mapcar (lambda (s) + (declare (ignore s)) + (gensym)) + keys)) + (g!value (gensym))) + (values `(,g!object ,@g!keys) + `(,object ,@keys) + `(,g!value) + `(oset ,g!value ,g!object ,@g!keys) + `(oget ,g!object ,@g!keys)))) + +(define-setf-expander oget* (object key &rest keys) + (let* ((keys (cons key keys)) + (g!object (gensym)) + (g!keys (mapcar (lambda (s) + (declare (ignore s)) + (gensym)) + keys)) + (g!value (gensym))) + (values `(,g!object ,@g!keys) + `(,object ,@keys) + `(,g!value) + `(oset* ,g!value ,g!object ,@g!keys) + `(oget* ,g!object ,@g!keys)))) + + + -- 1.7.10.4