-
Notifications
You must be signed in to change notification settings - Fork 62
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
Change LineNumber nodes to point at definition site #311
Conversation
Yesss, thanks, i have been meeting to do this for ages. It would be good to add this to the Julia docs? |
@@ -1,4 +1,13 @@ | |||
# These are some macros (and supporting functions) to make it easier to define rules. | |||
using Base.Meta | |||
|
|||
macro strip_linenos(expr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this a macro?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It operates on the quote itself, rather than the interpolated expression.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, can we add a comment to this effect? or a docstring?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, feel free to add whatever you think would be helpful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the following correct?
macro strip_linenos(expr) | |
"This should be put before a `quote`, to stop the quote from having line numbers recorded" | |
macro strip_linenos(expr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, that is how to use it, but it's a bit of an odd description of the macro. It just deleted linenumber nodes in whatever block you put it in front of. E.g. if you did:
@strip_linenos function foo(x)
<blah>
end
then that function wouldn't have line numbers either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs rebasing and bumping the verison number then we can merge.
BlockDiagonals failure is unrelated. |
ChainRules.jl failures are unrelated |
Before:
After:
N.B.:, currently includes the commit from #308, because it touches the same code, but should be automatically rebased once that is in.