-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
methods(foo) line numbers are off by 1 #4971
Comments
This is a bit subjective. I did it this way since for debugging you want the numbers of the lines corresponding to executing code. To fix this, every function would need two starting line numbers; one for the signature and one for the first executing line. This isn't needed to disambiguate which function is referred to, so I picked the economical option. |
also dup of #1419. |
I dunno, this seems pretty annoying to me. Linking to the first line of a method definition instead of its signature seems pretty broken, and so does making people actually parse the file that's being linked to to figure out where the function actually begins. Especially if we're going to be doing the linking from a web browser, where that's just basically not going to happen. It would be even nicer if methods gave the full range of lines on which the method is defined. That way we could use GitHub's ability to link to a range of lines in a file to link to exactly the right thing. |
My 2¢: I've wanted to open an issue about this behaviour since quite some time, and now stumbled upon this. I've always thought it was a bug. |
The line numbers in
m.func.code.line
form::Method
, which are e.g. the line numbers printed bymethods(foo)
, seem to be off by 1 for functions defined withfunction foo(...) ... end
. (The line number is the number of the first line in the body, rather than thefunction
line.)I noticed this in implementing #4952.
The text was updated successfully, but these errors were encountered: