-
-
Notifications
You must be signed in to change notification settings - Fork 405
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
implement "this" #320
implement "this" #320
Conversation
Benchmark for cc1a196Click to view benchmark
|
Hmmm I will give this a look during the weekend and see if I find out how it can be done :) |
This should no longer be blocked on function objects. About the environment trait, for now, I think this is good, but we might want to have multiple traits, depending on what should each environment have. For example, a global environment shouldn't have a parent environment, so it doesn't need to implement that function (and we avoid the |
464e0b1
to
8b32522
Compare
* get_this_binding() was wrong, fixed * BindingStatus is now properly set * `this` now works on dynamic functions
This is ready for review, @Razican clippy is moaning about https://github.com/jasonwilliams/boa/pull/320/files#diff-d7bd296d9ca534161e198b8c141ca51fR611 im not sure what to do about it. |
Benchmark for 43a9df7Click to view benchmark
|
Let me check this tomorrow or on Friday :) |
boa/src/exec/mod.rs
Outdated
/// Utility to create a function Value for Function Declarations, Arrow Functions or Function Expressions | ||
pub(crate) fn create_function( | ||
&mut self, | ||
args: &Box<[FormalParameter]>, |
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.
So, we have two options here. Either we receive a Box<[FormalParameter]>
or a &[FormalParameter]
. If you take a Box
, you can directly pass it to FunctionObject::create_ordinary
and this would probably reflect better how the function works internally, but you would need to clone it on call.
If this is not possible, you can just receive a &[FormalParameter]
and then do a to_vec().into_boxed_slice()
, or something like that.
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.
Thanks, will try both options later
Benchmark for f9b7032Click to view benchmark
|
Fixes jasonwilliams#264
Fixes jasonwilliams#360