summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Hickey <richhickey@gmail.com>2009-01-20 14:57:59 +0000
committerRich Hickey <richhickey@gmail.com>2009-01-20 14:57:59 +0000
commit9c1ca8132937642298ad3c4b4cee6fa464a36633 (patch)
tree9525e2f1cfb5f5f1a5f9512aa1349b026f691984
parent50e4a0758da3a9a5a9d4f44358dab4e56d466de9 (diff)
don't clear local closed over in catch/finally
-rw-r--r--src/jvm/clojure/lang/Compiler.java17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/jvm/clojure/lang/Compiler.java b/src/jvm/clojure/lang/Compiler.java
index 5ef13a89..d9033ac9 100644
--- a/src/jvm/clojure/lang/Compiler.java
+++ b/src/jvm/clojure/lang/Compiler.java
@@ -4419,10 +4419,17 @@ static Namespace currentNS(){
}
static void closeOver(LocalBinding b, FnMethod method){
- if(b != null && method != null && RT.get(method.locals, b) == null)
+ if(b != null && method != null)
{
- method.fn.closes = (IPersistentMap) RT.assoc(method.fn.closes, b, b);
- closeOver(b, method.parent);
+ if(RT.get(method.locals, b) == null)
+ {
+ method.fn.closes = (IPersistentMap) RT.assoc(method.fn.closes, b, b);
+ closeOver(b, method.parent);
+ }
+ else if(IN_CATCH_FINALLY.get() != null)
+ {
+ method.localsUsedInCatchFinally = (PersistentHashSet) method.localsUsedInCatchFinally.cons(b.idx);
+ }
}
}
@@ -4435,10 +4442,6 @@ static LocalBinding referenceLocal(Symbol sym) throws Exception{
{
FnMethod method = (FnMethod) METHOD.get();
closeOver(b, method);
- if(RT.get(method.locals, b) != null && IN_CATCH_FINALLY.get() != null)
- {
- method.localsUsedInCatchFinally = (PersistentHashSet) method.localsUsedInCatchFinally.cons(b.idx);
- }
}
return b;
}