From 42e45b9988bfa17584f259d422b39c64cebabcce Mon Sep 17 00:00:00 2001 From: Rich Hickey Date: Fri, 11 Dec 2009 07:02:23 -0500 Subject: prevent local clearing of letfns --- src/jvm/clojure/lang/Compiler.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/jvm/clojure/lang/Compiler.java b/src/jvm/clojure/lang/Compiler.java index 22da75cb..46d167d8 100644 --- a/src/jvm/clojure/lang/Compiler.java +++ b/src/jvm/clojure/lang/Compiler.java @@ -3955,7 +3955,7 @@ static public class ObjExpr implements Expr{ HostExpr.emitBoxReturn(this, gen, primc); else { - if(clear) + if(clear && lb.canBeCleared) { // System.out.println("clear: " + rep); gen.visitInsn(Opcodes.ACONST_NULL); @@ -3977,7 +3977,7 @@ static public class ObjExpr implements Expr{ else { gen.visitVarInsn(OBJECT_TYPE.getOpcode(Opcodes.ILOAD), lb.idx); - if(clear) + if(clear && lb.canBeCleared) { // System.out.println("clear: " + rep); gen.visitInsn(Opcodes.ACONST_NULL); @@ -4375,6 +4375,7 @@ public static class LocalBinding{ public final String name; public final boolean isArg; public final PathNode clearPathRoot; + public boolean canBeCleared = true; public LocalBinding(int num, Symbol sym, Symbol tag, Expr init, boolean isArg,PathNode clearPathRoot) throws Exception{ @@ -4636,6 +4637,7 @@ public static class LetFnExpr implements Expr{ if(sym.getNamespace() != null) throw new Exception("Can't let qualified name: " + sym); LocalBinding lb = registerLocal(sym, tagOf(sym), null,false); + lb.canBeCleared = false; lbs = lbs.cons(lb); } PersistentVector bindingInits = PersistentVector.EMPTY; -- cgit v1.2.3-70-g09d2