-
-
Notifications
You must be signed in to change notification settings - Fork 206
fix compile warning #248
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
fix compile warning #248
Conversation
lib/sentry/event.ex
Outdated
{pre_context, context, post_context} = | ||
Sentry.Sources.get_source_context(@source_files, file, line_number) | ||
@spec macro_put_source_context(map(), String.t(), integer()) :: map() | ||
def macro_put_source_context(frame, file, line_number) do |
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.
make this private and rename it to "do_put_source_context" instead of macro. Its pretty common.
lib/sentry/event.ex
Outdated
else | ||
frame | ||
end | ||
Map.put(frame, :context_line, context) |
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.
Start this with frame |>
@jeregrine updated 🙂 |
lib/sentry/event.ex
Outdated
do_put_source_context(unquote(frame), unquote(file), unquote(line_number)) | ||
end | ||
else | ||
frame |
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.
Do you need to quote this?
d34a664
to
5d9ba35
Compare
@jeregrine updated 🙂 |
Current implementation causes this warning because we're checking a compile-time module attribute at runtime, so the result is always the same. Looks like this:
Not super familiar with metaprogramming stuff, but this defines a macro that will either find and insert the source code context or return the frame as-is and remove the warning.