Package org.objectweb.asm.tree

Examples of org.objectweb.asm.tree.LocalVariableNode


        return null;
    }

    private void updateLocals(final Index index, final Map locals) {
        for (int i = 0; i < localVariables.size(); ++i) {
            LocalVariableNode lvNode = (LocalVariableNode) localVariables.get(i);
            if (lvNode.start == index.labelNode) {
                locals.put(new Integer(lvNode.index), lvNode.name);
            } else if (lvNode.end == index.labelNode) {
                locals.remove(new Integer(lvNode.index));
            }
View Full Code Here


                for (int i = 0; i < f.getLocals(); ++i) {
                    String s = f.getLocal(i).toString();
                    appendTypeName(i, useQualifiedNames, localsBuf, s);

                    for (Iterator it = localVariables.iterator(); it.hasNext();) {
                        LocalVariableNode lvnode = (LocalVariableNode) it.next();
                        int n = lvnode.index;
                        if( n==i) {
                          localsBuf.append( " : ").append( lvnode.name);
                        }
                    }
View Full Code Here

            try {
                ArrayList locals = new ArrayList();
                for (int i = 0; i < f.getLocals(); ++i) {
                    String varName = "";
                    for (Iterator it = localVariables.iterator(); it.hasNext();) {
                        LocalVariableNode lvnode = (LocalVariableNode) it.next();
                        int n = lvnode.index;
                        if( n==i) {
                            varName = lvnode.name;
                            // TODO take into account variable scope!
                            break;
View Full Code Here

    }
 
    List<LocalVariableNode> buildLocalVariables(IList iList) {
      ArrayList<LocalVariableNode> al = new ArrayList<LocalVariableNode>();
      for (IValue v : iList) {
        al.add(new LocalVariableNode(((IString)((IConstructor)v).get(0)).getValue(),
                       ((IString)((IConstructor)v).get(1)).getValue(),
                       emptyIsNull(((IString)((IConstructor)v).get(2)).getValue()),
                       getLabel(((IInteger)((IConstructor)v).get(3)).intValue()),
                       getLabel(((IInteger)((IConstructor)v).get(4)).intValue()),
                       ((IInteger)((IConstructor)v).get(5)).intValue()));
View Full Code Here

        HashMap<Label, LinkedList<LocalVariableNode>> localStarts = new HashMap<Label, LinkedList<LocalVariableNode>>();
        HashMap<Label, LinkedList<LocalVariableNode>> localEnds = new HashMap<Label, LinkedList<LocalVariableNode>>();

        Iterator iterator = localvariables.iterator();
        while (iterator.hasNext()) {
            LocalVariableNode local = (LocalVariableNode)iterator.next();
            Label label = local.start.getLabel();
            LinkedList<LocalVariableNode> locals = localStarts.get(label);
            if (locals == null) {
                locals = new LinkedList<LocalVariableNode>();
                localStarts.put(label, locals);
View Full Code Here

    public String getName() {
        return m_name;
    }

    public void addLocalVariable(String name, String desc, String signature, int index) {
        m_locals.put(index, new LocalVariableNode(name, desc, signature, null, null, index));
        if (index >= m_argsVarLength) {
            // keep only argument-related local variables definitions (others relate to code which isn't in this method)
            return;
        }
        if (m_argLocalVariables == null) {
            m_argLocalVariables = new ArrayList<LocalVariableNode>();
        }
        m_argLocalVariables.add(new LocalVariableNode(name, desc, signature, null, null, index));
    }
View Full Code Here

            mn.instructions.add(mEnd);
        }

        List<LocalVariableNode> paramsAndThis = new ArrayList<LocalVariableNode>();       
        for (Object o : mn.localVariables) {
            LocalVariableNode lvn = (LocalVariableNode) o;
            if (lvn.start.getLabel().equals(mStartl)) {
                paramsAndThis.add(lvn);
            }
        }
        int purrSecretIndex = 0;
        for (LocalVariableNode lvn : paramsAndThis) {
            purrSecretIndex += Type.getType(lvn.desc).getSize();
        }
        Set<String> lvNames = new HashSet<String>();
        for (Object o : mn.localVariables) {
            LocalVariableNode lvn = (LocalVariableNode) o;
            if (lvn.index >= purrSecretIndex) {
                lvn.index = lvn.index + 1;
            }
            lvNames.add(lvn.name);
        }
        String purrSecretUniqueName = makeUnique("_purrSecret", lvNames);

        mn.localVariables.add(paramsAndThis.size(), new LocalVariableNode(
                purrSecretUniqueName, OBJECT_DESC, null, mStart, mEnd,
                purrSecretIndex));
        mn.maxLocals += 1;

        for (Iterator<?> i = mn.instructions.iterator(); i.hasNext();) {
View Full Code Here

    @Override
    public void visitLocalVariable(String name, String desc, String signature, Label start, Label end, int index) {
        // only remember the local variables of Type org.parboiled.support.Var that are not parameters
        if (index > parameterCount && Var.class.isAssignableFrom(getClassForType(Type.getType(desc)))) {
            if (localVarVariables == null) localVarVariables = new ArrayList<LocalVariableNode>();
            localVarVariables.add(new LocalVariableNode(name, desc, null, null, null, index));
        }
    }
View Full Code Here

    @Override
    public void visitLocalVariable(String name, String desc, String signature, Label start, Label end, int index) {
        // only remember the local variables of Type org.parboiled.support.Var that are not parameters
        if (index > parameterCount && Var.class.isAssignableFrom(getClassForType(Type.getType(desc)))) {
            if (localVarVariables == null) localVarVariables = new ArrayList<LocalVariableNode>();
            localVarVariables.add(new LocalVariableNode(name, desc, null, null, null, index));
        }
    }
View Full Code Here

                    handler,
                    trycatch.type));
        }

        for (Iterator<LocalVariableNode> it = localVariables.iterator(); it.hasNext();) {
            LocalVariableNode lvnode = it.next();
            if (LOGGING) {
                log("local var " + lvnode.name);
            }
            final LabelNode start = instant.rangeLabel(lvnode.start);
            final LabelNode end = instant.rangeLabel(lvnode.end);
            if (start == end) {
                if (LOGGING) {
                    log("  local variable empty in this sub");
                }
                continue;
            }
            newLocalVariables.add(new LocalVariableNode(lvnode.name,
                    lvnode.desc,
                    lvnode.signature,
                    start,
                    end,
                    lvnode.index));
View Full Code Here

TOP

Related Classes of org.objectweb.asm.tree.LocalVariableNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.