while loop is introduced
Sun Apr 12 16:42:56 PDT 2009 tamas.paka@gmail.com
* while loop is introduced
Warning: CRC errors found. These are probably harmless but should be repaired.
See 'darcs gzcrcs --help' for more information.
diff -rN -u old-cl-quasi-quote/src/js/syntax.lisp new-cl-quasi-quote/src/js/syntax.lisp
--- old-cl-quasi-quote/src/js/syntax.lisp 2014-07-29 05:47:20.000000000 -0700
+++ new-cl-quasi-quote/src/js/syntax.lisp 2014-07-29 05:47:20.000000000 -0700
@@ -326,6 +326,18 @@
(walk-form condition node env)))
(setf (cl-walker:body-of node) (mapcar [walk-form !1 node env] body)))))
+(def class* while-form (walked-form implicit-progn-mixin)
+ ((condition)))
+
+(def (js-walker-handler e) |while| (form parent env)
+ (when (< (length (rest form)) 2)
+ (js-compile-error nil "Invalid 'while' form, needs at least two elements: ~S" form))
+ (bind (((nil condition &body body) form))
+ (with-form-object (node 'while-form parent
+ :source form)
+ (setf (condition-of node) (walk-form condition node env))
+ (setf (cl-walker:body-of node) (mapcar [walk-form !1 node env] body)))))
+
(def (js-walker-handler e) |macrolet| (form parent env)
;; this is a KLUDGE: the walker only understands &BODY but the js reader is case sensitive
(funcall (find-walker-handler `(macrolet))
diff -rN -u old-cl-quasi-quote/src/js/transform.lisp new-cl-quasi-quote/src/js/transform.lisp
--- old-cl-quasi-quote/src/js/transform.lisp 2014-07-29 05:47:20.000000000 -0700
+++ new-cl-quasi-quote/src/js/transform.lisp 2014-07-29 05:47:20.000000000 -0700
@@ -595,6 +595,11 @@
,@(recurse-as-comma-separated (steps-of -node-))
")"
,@(transform-statements (body-of -node-) :wrap? #t)))
+ (while-form
+ `("while ("
+ ,(recurse (condition-of -node-))
+ ")"
+ ,@(transform-statements (cl-walker:body-of -node-) :wrap? #t)))
(slot-value-form
(bind ((object (object-of -node-))
(slot-name (slot-name-of -node-)))