Skip to content
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

Calls from default argument values show inconsistent caller information #57

Open
dylanahsmith opened this issue Apr 23, 2018 · 1 comment

Comments

@dylanahsmith
Copy link
Contributor

For example, if we have a method defined with

def create_applied_discount_from(discount, code: discount.try(:code))

the discount.try(:code) call shows that line in the file path and line number for the call, but the entity and method name refer to the caller of create_applied_discount_from which is inconsistent with the file path. Ideally, for the discount.try(:code) call, the caller method would show up as create_applied_discount_from and the caller entity would be the class of the object that method was called on.

This is happening because rotoscope tries to keep information from the stack based by pushing a frame to this stack on call events and popping a stack from on a return event. However, in this case the call event hasn't happened yet.

@dylanahsmith
Copy link
Contributor Author

This wouldn't be a problem if we weren't trying to surface the caller entity. We could use rb_profile_frames to get efficiently get the caller method name, which we already do to accurately get the caller file path.

Previously we were deriving the caller component from the caller entity, but now we can do that from the caller file path. We won't always have a caller entity anyways for anonymous classes/modules or from calls in blocks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant