01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tc.aspectwerkz.transform.inlining.weaver;
05:
06: import com.tc.asm.ClassAdapter;
07: import com.tc.asm.ClassVisitor;
08: import com.tc.asm.MethodVisitor;
09: import com.tc.asm.MethodAdapter;
10: import com.tc.asm.Label;
11:
12: import com.tc.aspectwerkz.transform.InstrumentationContext;
13:
14: /**
15: * @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a>
16: */
17: public class LabelToLineNumberVisitor extends ClassAdapter {
18:
19: private InstrumentationContext m_ctx;
20:
21: public LabelToLineNumberVisitor(ClassVisitor cv,
22: InstrumentationContext ctx) {
23: super (cv);
24: m_ctx = ctx;
25: }
26:
27: public MethodVisitor visitMethod(int access, String name,
28: String desc, String signature, String[] exceptions) {
29: return new MethodAdapter(super .visitMethod(access, name, desc,
30: signature, exceptions)) {
31: public void visitLineNumber(int i, Label label) {
32: super.visitLineNumber(i, label);
33: m_ctx.addLineNumberInfo(label, i);
34: }
35: };
36: }
37: }
|