01: /**************************************************************************************
02: * Copyright (c) Jonas Bonér, Alexandre Vasseur. All rights reserved. *
03: * http://aspectwerkz.codehaus.org *
04: * ---------------------------------------------------------------------------------- *
05: * The software in this package is published under the terms of the LGPL license *
06: * a copy of which has been included with this distribution in the license.txt file. *
07: **************************************************************************************/package org.codehaus.aspectwerkz.transform.inlining.weaver;
08:
09: import org.objectweb.asm.ClassAdapter;
10: import org.objectweb.asm.ClassVisitor;
11: import org.objectweb.asm.CodeVisitor;
12: import org.objectweb.asm.Attribute;
13: import org.objectweb.asm.CodeAdapter;
14: import org.objectweb.asm.Label;
15: import org.codehaus.aspectwerkz.transform.inlining.ContextImpl;
16: import org.codehaus.aspectwerkz.transform.Context;
17:
18: /**
19: * @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a>
20: */
21: public class LabelToLineNumberVisitor extends ClassAdapter {
22:
23: private ContextImpl m_ctx;
24:
25: public LabelToLineNumberVisitor(ClassVisitor cv, Context ctx) {
26: super (cv);
27: m_ctx = (ContextImpl) ctx;
28: }
29:
30: public CodeVisitor visitMethod(int i, String s, String s1,
31: String[] strings, Attribute attribute) {
32: return new CodeAdapter(super .visitMethod(i, s, s1, strings,
33: attribute)) {
34: public void visitLineNumber(int i, Label label) {
35: super.visitLineNumber(i, label);
36: m_ctx.addLineNumberInfo(label, i);
37: }
38: };
39: }
40: }
|