Re: Re: Two MethodVisitor with the same instances of Labels
Eugene Kuleshov <[email protected]> Wed, 19 Mar 2014 12:06:56 -0400
| Newsgroups | gmane.comp.java.objectweb.asm |
|---|---|
| Message-ID | <CADFjdoUanF1dYfO4exyzbAkXhkKUU39M+jFLW=+Co=UYhxSWzw@mail.gmail.com> |
You can just extend MethodNode class, overwrite corresponding methods (just make sure to call super) to collect your information on the first pass and then you can call accept() on it only once. regards, Eugene On Wed, Mar 19, 2014 at 12:04 PM, Roberto Andrioli <[email protected]> wrote: > 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 >> > > > -- > 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