diff options
author | Chouser <chouser@n01se.net> | 2008-09-24 06:07:46 +0000 |
---|---|---|
committer | Chouser <chouser@n01se.net> | 2008-09-24 06:07:46 +0000 |
commit | 5e4dcfa5a53e4f8a8050ea5224c6853695e6d7be (patch) | |
tree | c6f7c64b98c2c5ea8a0df5acf884bee2c487510f /clojurescript/tojs.clj | |
parent | 2d10026e88a8e1a70189889beb0cf3c0a372f637 (diff) |
ClojureScript: was leaking recur temp vars and some clojure_* temp objects into global namespace. plugged.
Diffstat (limited to 'clojurescript/tojs.clj')
-rw-r--r-- | clojurescript/tojs.clj | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/clojurescript/tojs.clj b/clojurescript/tojs.clj index 7c7f6fea..ff605ecb 100644 --- a/clojurescript/tojs.clj +++ b/clojurescript/tojs.clj @@ -29,7 +29,8 @@ *has-recur*]) mparm (into {} (for [p (.reqParms maxm)] [(.idx p) p])) inits (concat - (when has-recur ["_cnt" "_rtn"]) + (when has-recur + ["_cnt" "_rtn"]) (vals (reduce dissoc lm (cons thisfn (.reqParms fm)))) (when (:fnname ctx) [(str (lm thisfn) "=arguments.callee")]) (when (not= fm maxm) @@ -200,9 +201,10 @@ (defmethod tojs clojure.lang.Compiler$RecurExpr [e ctx] (set! *has-recur* true) - (vstr ["(_cnt=1" - (vec (map #(str ",_t" %2 "=" (tojs %1 ctx)) (.args e) (iterate inc 0))) - (vec (map #(str "," ((:localmap ctx) %1) "=_t" %2) + (vstr ["(_cnt=1,_rtn=[" + (vec (interpose "," (map #(tojs % ctx) (.args e)))) + "]" + (vec (map #(str "," ((:localmap ctx) %1) "=_rtn[" %2 "]") (.loopLocals e) (iterate inc 0))) ")"])) |