-
Notifications
You must be signed in to change notification settings - Fork 8
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
How to alter a CallSite? #7
Comments
The work around currently used in |
Hmm. I have never done that before. Looking quickly at it, it seams like defining your own CallSite object from scratch is the only way. (the CallSite object is defined here https://github.com/v8/v8/blob/263340113713db788e56abda61062dd9513b9f79/src/js/messages.js#L593L749) I will have to investigate it more, but I don't think there is anything that can be done. |
Maybe stack-chain should provide an utility function to clone a CallSite with a custom It's far from perfect but at least it avoids the need to duplicate this code for each stack modifier :/ |
I think a mutate helper in general would be nice. But I wouldn't restrict it to just toString() |
I would welcome a CustomCallSite(callSite, {
fileName: 'script.coffee',
// other overwritten properties
}); It would the have the v8-defined Eventually I might do this myself, but I would suggests that you make a pull request. |
Ok, I don't have much time for it currently but maybe one day :) |
I am currently writing a modifier for stack-chain to enable source maps in Node and I need to alter some call sites to fix the filename, the line and the column.
Unfortunately, the
CallSite#toString()
is read-only, any ideas?Expected result:
Actual result:
I also tried to clone the
callSite
object, but this time, thetoString()
method throws anillegal access
error:The text was updated successfully, but these errors were encountered: