",")
")")))
+(define-compilation macrolet (definitions &rest body)
+ (let ((*environment* (copy-lexenv *environment*)))
+ (dolist (def definitions)
+ (destructuring-bind (name lambda-list &body body) def
+ (let ((binding (make-binding :name name :type 'macro :value
+ (let ((g!form (gensym)))
+ `(lambda (,g!form)
+ (destructuring-bind ,lambda-list ,g!form
+ ,@body))))))
+ (push-to-lexenv binding *environment* 'function))))
+ (ls-compile `(progn ,@body) *multiple-value-p*)))
+
+
(defun special-variable-p (x)
(and (claimp x 'variable 'special) t))
(js!selfcall
"var tmp = (" (ls-compile object) ")[xstring(" (ls-compile key) ")];" *newline*
(mapconcat (lambda (key)
- (code "if (tmp === undefined) return " (ls-compile nil) ";" *newline*)
- (code "tmp = tmp[xstring(" (ls-compile key) ")];" *newline*))
+ (code "if (tmp === undefined) return " (ls-compile nil) ";" *newline*
+ "tmp = tmp[xstring(" (ls-compile key) ")];" *newline*))
keys)
"return tmp === undefined? " (ls-compile nil) " : tmp;" *newline*))
(js!selfcall
"var obj = " (ls-compile object) ";" *newline*
(mapconcat (lambda (key)
- "obj = obj[xstring(" (ls-compile key) ")];"
- "if (obj === undefined) throw 'Impossible to set Javascript property.';" *newline*)
+ (code "obj = obj[xstring(" (ls-compile key) ")];"
+ "if (obj === undefined) throw 'Impossible to set Javascript property.';" *newline*))
(butlast keys))
"var tmp = obj[xstring(" (ls-compile (car (last keys))) ")] = " (ls-compile value) ";" *newline*
"return tmp === undefined? " (ls-compile nil) " : tmp;" *newline*)))