Thanks for the detailed reply Thomas. So it seems at this point in time, I cannot do a static code analysis of available public methods, by parsing the script.
On Fri, Oct 17, 2008 at 8:05 AM, Thomas E Enebo <[EMAIL PROTECTED]> wrote: > Hmm, this is tough to explain properly and it also makes me think we > can/should get rid of the visibility field in DefnNode. > > For starters we unconditionally set this field to private in the > parser since we cannot know until execution time what the visibility > can be. So next question is why don't we update this field once we > know its current value (which obviously can change at any time)? Well > the AST is largely a intermediate lexical representation of the source > code. We actually store visibility of methods in a Method > (DefaultMethod) object. This method object represents the runtime > state of the method (as opposed to its lexical structure). > > So the rewriter will not be able to capture anything that will change > the meaning of the code at runtime. It is just a tool for IDE > consumers to modify lexical representation. > > Your question has pointed out how useless it is for us to have > visibility on this node. > > -Tom > > > > On Thu, Oct 16, 2008 at 9:01 PM, पंकज एम तोलानी <[EMAIL PROTECTED]> > wrote: > > Mirko, > > > > Thanks for the quick response. I was out of action on this. > > > > The ReWriter uses the NodeVisitor for parsing the ruby script. Now when I > > get the event for DefnNode, the visibility for the node should be as per > > whats specified in the ruby script. It always returns private. > > thanks, > > pankaj > > On Fri, Oct 3, 2008 at 1:48 AM, Mirko Stocker <[EMAIL PROTECTED]> wrote: > >> > >> Hi > >> > >> On Friday 03 October 2008 10:25:43 पंक्ज एम. तोलानी wrote: > >> > I am re-using ./src/org/jruby/ast/visitor/rewriter/ReWriteVisitor.java > >> > for my ruby script parsing needs. I had query regarding the DefnNode > >> > received in visitDefnNode(). the DefnNode does not seem to have the > >> > right visibility value. It is always PRIVATE irrespective of whether > my > >> > method is private, protected or public. Am I missing something? > >> > >> I'm not sure I understand you correctly: you are writing source code and > >> you'd > >> expect the ReWriter to print out a private or protected section, is that > >> correct? If so (and if I remember correctly), the ReWriter doesn't do > that > >> for you; the source code wouldn't look very nice if every method had its > >> own > >> private, etc. section. > >> > >> I hope this helps, > >> > >> Regards > >> > >> Mirko > > > > > > > > -- > > पंकज एम तोलानी > > > > > > -- > Blog: http://www.bloglines.com/blog/ThomasEEnebo > Email: [EMAIL PROTECTED] , [EMAIL PROTECTED] > -- पंकज एम तोलानी
