-
-
Notifications
You must be signed in to change notification settings - Fork 406
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
Feature Function.prototype.call
#805
Conversation
ae9be6d
to
149c1ee
Compare
Codecov Report
@@ Coverage Diff @@
## master #805 +/- ##
==========================================
+ Coverage 59.62% 59.67% +0.04%
==========================================
Files 155 155
Lines 9964 9973 +9
==========================================
+ Hits 5941 5951 +10
+ Misses 4023 4022 -1
Continue to review full report at Codecov.
|
Forgot to end the error message and write a test for it, I'm doing it right now. |
Function.prototype.call
Maybe we should test it with more that one argumet |
Reasonable, any idea for a function to test? |
We can test any function that takes 1 or more arumunts ( not including |
I came up with: function f(a, b){
this.a = a;
this.b = b;
}
let o = {a: 0, b: 0}
f.call(o, 1, 2) Then we check |
Yes. This looks good :) |
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 perfect to me!
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 too :D
Somehow it seems we didn't see that this was failing the test262 suite. I think we should revert it until we find the issue. What do you think @HalidOdat @RageKnify ? |
return context.throw_type_error(format!("{} is not a function", this.display())); | ||
} | ||
let this_arg: Value = args.get(0).cloned().unwrap_or_default(); | ||
// TODO?: 3. Perform PrepareForTailCall |
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 think it maybe the missing // TODO?: 3. Perform PrepareForTailCall
.
Yes. I think so too. EDIT: Or we can comment it out. with a todo, and ignore the tests |
I'd like to identify which test of test262 is causing the failure. But I'm assuming its a long recursion that requires TailCall optimization, not sure how |
Something that can be done to see the last test to be executed is to uncomment this line locally and run it like this. The error message was this:
In any case, if it can't be fixed easily, we should revert this until we get a proper fix, we can't have the CI and the test262 results failing on every commit. |
I've identified the test, // Copyright (c) 2012 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-array.prototype.map
description: Array.prototype.map - value of 'length' is boundary value (2^32)
---*/
function callbackfn(val, idx, obj) {
return val > 10;
}
var obj = {
0: 12,
length: 4294967296
};
assert.throws(RangeError, function() {
var newArr = Array.prototype.map.call(obj, callbackfn);
}); I don't think the problem is recursion, it is boa/boa/src/builtins/array/mod.rs Lines 598 to 607 in eb1fd28
~~The fix doesn't seem too complicated. PS: I'm busy right now but I hope to get it fixed in the next 6 hours.~~ PPS: Testing the same code on Chrome the problem in the JS code seems to be that So following the spec the calls should be |
This Pull Request fixes/closes #797.
It changes the following:
-Implement Function.prototype.call
-Add a test to ensure it works