Re: Two MethodVisitor with the same instances of Labels

Roberto Andrioli <[email protected]> Wed, 19 Mar 2014 13:04:12 -0300
Newsgroups gmane.comp.java.objectweb.asm
Message-ID <CAKJVBvCtQgVtCSF-aWTAdoCcS2sDh4q8AJHiZZVWMOSgtnVtBQ@mail.gmail.com>
In TreeAPI you can visit the instructions list only. Some thing like:
methodNode. instructions.accept(visitor).

The methodNode.accept(...) will reset the label if the methodNode was
already visited.

So, my approach is: first, visiting only the instructions list, collect the
information that you need. then use the secondVisitor exactly how you
doing. :)

Roberto
 On Mar 19, 2014 12:48 PM, <[email protected]> wrote:

>
> Hi !
>
> I need to visit method twice,
> during first time I gather information about labels (I add them to map with
> "state description")
> durign second time, when I encounter label I want to perform some actions
> depending  on "state" collected in previous visiting. Unfourtnatley it seem
> that "Label" object I get are different beetwen these two passes.
>
>
> I also try to use Tree Api, when in visitEnd Method I do
>
>
>     @Override
>     public void visitEnd()
>     {
>         this.accept(_firstVisitor);
>         _secodnVisitor.setData(_firstVisitor.getData());
>         this.accept(_secondVisitor);
>         super.visitEnd();
>     }
>
> but this also generates different Label objects.
>
>
> Is there any way to do it or I should try to Tree API editing of methods ??
>
>
> Thanks in advance,
>
> Grzesiek
>
>
> --
> You receive this message as a subscriber of the [email protected] mailing list.
> To unsubscribe: mailto:[email protected]
> For general help: mailto:[email protected]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>
>
message-footer.txt (text/plain, 238 B)
-- 
You receive this message as a subscriber of the [email protected] mailing list.
To unsubscribe: mailto:[email protected]
For general help: mailto:[email protected]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws