Skip to content

Commit 7faeb3a

Browse files
committed
track use of this fn by nested closures - CLJ-1825
1 parent 9448d62 commit 7faeb3a

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/jvm/clojure/lang/Compiler.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7251,15 +7251,20 @@ static Namespace currentNS(){
72517251
static void closeOver(LocalBinding b, ObjMethod method){
72527252
if(b != null && method != null)
72537253
{
7254-
if(RT.get(method.locals, b) == null)
7254+
LocalBinding lb = (LocalBinding) RT.get(method.locals, b);
7255+
if(lb == null)
72557256
{
72567257
method.objx.closes = (IPersistentMap) RT.assoc(method.objx.closes, b, b);
72577258
closeOver(b, method.parent);
72587259
}
7259-
else if(IN_CATCH_FINALLY.deref() != null)
7260-
{
7261-
method.localsUsedInCatchFinally = (PersistentHashSet) method.localsUsedInCatchFinally.cons(b.idx);
7262-
}
7260+
else {
7261+
if(lb.idx == 0)
7262+
method.usesThis = true;
7263+
if(IN_CATCH_FINALLY.deref() != null)
7264+
{
7265+
method.localsUsedInCatchFinally = (PersistentHashSet) method.localsUsedInCatchFinally.cons(b.idx);
7266+
}
7267+
}
72637268
}
72647269
}
72657270

0 commit comments

Comments
 (0)