mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-04 10:18:51 +00:00
LibJS: Implement basic support for the "new" keyword
NewExpression mostly piggybacks on the existing CallExpression. The big difference is that "new" creates a new Object and passes it as |this| to the callee.
This commit is contained in:
parent
fecbef4ffe
commit
0593ce406b
Notes:
sideshowbarker
2024-07-19 08:05:47 +09:00
Author: https://github.com/awesomekling
Commit: 0593ce406b
5 changed files with 67 additions and 9 deletions
7
Libraries/LibJS/Tests/constructor-basic.js
Normal file
7
Libraries/LibJS/Tests/constructor-basic.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
function Foo() {
|
||||
this.x = 123;
|
||||
}
|
||||
|
||||
var foo = new Foo();
|
||||
if (foo.x === 123)
|
||||
console.log("PASS");
|
Loading…
Add table
Add a link
Reference in a new issue