Permalink
Browse files

clj-734: fixed the local variables table to have the correct code ind…

…ex for let bindings; this allows jdi based debuggers to have access to the locals while still in the let bindings

Signed-off-by: Stuart Halloway <stu@thinkrelevance.com>
  • Loading branch information...
1 parent 83a5aaf commit 2bc1c1403ac8e4f2ab0db1ac9c3a5082c1ffc6fa George Jahad committed with stuarthalloway Feb 26, 2011
Showing with 4 additions and 2 deletions.
  1. +4 −2 src/jvm/clojure/lang/Compiler.java
@@ -5755,6 +5755,7 @@ public void emitUnboxed(C context, ObjExpr objx, GeneratorAdapter gen){
public void doEmit(C context, ObjExpr objx, GeneratorAdapter gen, boolean emitUnboxed){
+ HashMap<BindingInit, Label> bindingLabels = new HashMap();
for(int i = 0; i < bindingInits.count(); i++)
{
BindingInit bi = (BindingInit) bindingInits.nth(i);
@@ -5769,6 +5770,7 @@ public void doEmit(C context, ObjExpr objx, GeneratorAdapter gen, boolean emitUn
bi.init.emit(C.EXPRESSION, objx, gen);
gen.visitVarInsn(OBJECT_TYPE.getOpcode(Opcodes.ISTORE), bi.binding.idx);
}
+ bindingLabels.put(bi, gen.mark());
}
Label loopLabel = gen.mark();
if(isLoop)
@@ -5803,10 +5805,10 @@ public void doEmit(C context, ObjExpr objx, GeneratorAdapter gen, boolean emitUn
lname += RT.nextID();
Class primc = maybePrimitiveType(bi.init);
if(primc != null)
- gen.visitLocalVariable(lname, Type.getDescriptor(primc), null, loopLabel, end,
+ gen.visitLocalVariable(lname, Type.getDescriptor(primc), null, bindingLabels.get(bi), end,
bi.binding.idx);
else
- gen.visitLocalVariable(lname, "Ljava/lang/Object;", null, loopLabel, end, bi.binding.idx);
+ gen.visitLocalVariable(lname, "Ljava/lang/Object;", null, bindingLabels.get(bi), end, bi.binding.idx);
}
}

0 comments on commit 2bc1c14

Please sign in to comment.