-
-
Notifications
You must be signed in to change notification settings - Fork 402
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 panic when calling function that mutates itself #667
Conversation
Codecov Report
@@ Coverage Diff @@
## master #667 +/- ##
==========================================
+ Coverage 73.14% 73.17% +0.03%
==========================================
Files 192 193 +1
Lines 14005 14029 +24
==========================================
+ Hits 10244 10266 +22
- Misses 3761 3763 +2
Continue to review full report at Codecov.
|
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.
Also some tests showing that it does not panic any more and give the expected behaviour
I added the test case from the issue |
Oh wait it should not return the edited value from the call statement. I have no idea why that happens. When we call a self mutating function somehow that mutated value leaks and gets returned from the function. It should not happen this way. |
That is strange. does it happen on master too. if so then report an issue. this bug does not seem related to this PR |
>> function x() {}
undefined
>> function y() { x.y = 3 }
undefined
>> x.y
undefined
>> y()
3 happens on master too. so i will apply your suggestions and then this should be ready to merge since this issue is irrelevant to my pr |
Opened issue #672 |
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.
Looks good to me :) Thanks for the fix!
Fixes #663
This commit fixes the panic when a function mutates itself. The issue happens since we borrow the object and when we call the statementList of the object we borrow_mut the object again to mutate it.
It changes the following:
Thank you @HalidOdat for their help 😃