mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-30 04:39:06 +00:00
LibJS: Set the bound |this| value to the |this| value of the current
scope for arrow functions
This commit is contained in:
parent
c12125fa81
commit
45ccd9f8d9
Notes:
sideshowbarker
2024-07-19 05:58:26 +09:00
Author: https://github.com/jack-karamanian
Commit: 45ccd9f8d9
Pull-request: https://github.com/SerenityOS/serenity/pull/2454
3 changed files with 16 additions and 4 deletions
|
@ -64,6 +64,19 @@ try {
|
|||
assert(foo === undefined);
|
||||
assert(bar === undefined);
|
||||
|
||||
function FooBar() {
|
||||
this.x = {
|
||||
y: () => this,
|
||||
z: function () {
|
||||
return (() => this)();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
var foobar = new FooBar();
|
||||
assert(foobar.x.y() === foobar);
|
||||
assert(foobar.x.z() === foobar.x);
|
||||
|
||||
(() => {
|
||||
"use strict";
|
||||
assert(isStrictMode());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue