emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Emacs-diffs] emacs-25 504696d: Etags: yet another improvement in Ru


From: Eli Zaretskii
Subject: Re: [Emacs-diffs] emacs-25 504696d: Etags: yet another improvement in Ruby tags
Date: Thu, 04 Feb 2016 05:48:07 +0200

> From: Dmitry Gutov <address@hidden>
> Date: Thu, 4 Feb 2016 02:46:45 +0300
> 
> Just noticed this. attr_X calls will not, as a rule, be inside a method 
> definition (which is what 'def X' is).
> 
> If an attr_X call is inside a method definition, we're unlikely to be 
> able to make much sense of it. Most likely, the arguments will be local 
> variables, not Symbol literals. It's also likely that the target of this 
> call in that kind of situation won't be the current class.
> 
> Anyway, the example shouldn't put attr_X calls inside a method 
> definition, or it gives an impression that we handle this situation 
> intentionally, or somehow differently from the usual case. Whereas we 
> could as well skip those tags altogether (but we don't really have to, 
> as long as we only generate non-qualified tags, and check that every 
> argument is a Symbol literal, i.e. it starts with a colon).

Please modify the test files as you see fit, and tell me what the tags
should be.

> > +      alias_method :qux, :tee, attr_accessor :bogus
> 
> This one is a bit weird as well:
> 
> - An alias_method call with three arguments will raise an ArgumentError.

It's there to test the algorithm, which should not tag the bogus
accessor.

> - If it didn't, the 'attr_accessor :bogus' calls would raise a 
> SyntaxError, due to evaluation rules. However, an attr_X call can be 
> inside an expression, such as:
> 
> class C
>    puts(attr_accessor :bogus)
> end
> 
> This is not a typical case, we don't need to handle it, but it's odd to 
> see a test case that implies that this example is invalid, and we 
> somehow prohibit it. Hopefully, this observation will allow you to 
> simplify some code.

I'm not sure how this simplifies things.  The point was that a comma
doesn't reset the mini-state machine to the state where it is once
again ready to see attr_accessor.  If you are saying there are other
situations like that, please describe them.

IOW, does etags handle the above intentionally invalid code correctly?
It should.

Thanks.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]