Search in sources :

Example 1 with LocalVariableTable_attribute

use of com.sun.tools.classfile.LocalVariableTable_attribute in project jdk8u_jdk by JetBrains.

the class AnnotationsElementVisitor method visitLocalVariableTable.

@Override
public Element visitLocalVariableTable(LocalVariableTable_attribute lvt, Element p) {
    String name = x.getCpString(lvt.attribute_name_index);
    for (LocalVariableTable_attribute.Entry e : lvt.local_variable_table) {
        Element l = new Element(name);
        l.setAttr("bci", "" + e.start_pc);
        l.setAttr("span", "" + e.length);
        l.setAttr("name", x.getCpString(e.name_index));
        l.setAttr("type", x.getCpString(e.descriptor_index));
        l.setAttr("slot", "" + e.index);
        l.trimToSize();
        p.add(l);
    }
    // already added to parent
    return null;
}
Also used : Element(xmlkit.XMLKit.Element) LocalVariableTable_attribute(com.sun.tools.classfile.LocalVariableTable_attribute)

Example 2 with LocalVariableTable_attribute

use of com.sun.tools.classfile.LocalVariableTable_attribute in project ceylon-compiler by ceylon.

the class AttributeWriter method visitLocalVariableTable.

public Void visitLocalVariableTable(LocalVariableTable_attribute attr, Void ignore) {
    println("LocalVariableTable:");
    indent(+1);
    println("Start  Length  Slot  Name   Signature");
    for (LocalVariableTable_attribute.Entry entry : attr.local_variable_table) {
        Formatter formatter = new Formatter();
        println(formatter.format("%8d %7d %5d %5s   %s", entry.start_pc, entry.length, entry.index, constantWriter.stringValue(entry.name_index), constantWriter.stringValue(entry.descriptor_index)));
    }
    indent(-1);
    return null;
}
Also used : Formatter(java.util.Formatter) LocalVariableTable_attribute(com.sun.tools.classfile.LocalVariableTable_attribute)

Example 3 with LocalVariableTable_attribute

use of com.sun.tools.classfile.LocalVariableTable_attribute in project ceylon-compiler by ceylon.

the class LocalVariableTableWriter method reset.

public void reset(Code_attribute attr) {
    codeAttr = attr;
    pcMap = new HashMap<Integer, List<LocalVariableTable_attribute.Entry>>();
    LocalVariableTable_attribute lvt = (LocalVariableTable_attribute) (attr.attributes.get(Attribute.LocalVariableTable));
    if (lvt == null)
        return;
    for (int i = 0; i < lvt.local_variable_table.length; i++) {
        LocalVariableTable_attribute.Entry entry = lvt.local_variable_table[i];
        put(entry.start_pc, entry);
        put(entry.start_pc + entry.length, entry);
    }
}
Also used : ArrayList(java.util.ArrayList) List(java.util.List) LocalVariableTable_attribute(com.sun.tools.classfile.LocalVariableTable_attribute)

Aggregations

LocalVariableTable_attribute (com.sun.tools.classfile.LocalVariableTable_attribute)3 ArrayList (java.util.ArrayList)1 Formatter (java.util.Formatter)1 List (java.util.List)1 Element (xmlkit.XMLKit.Element)1