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:
Andreas Kling 2020-03-28 16:33:52 +01:00
parent fecbef4ffe
commit 0593ce406b
Notes: sideshowbarker 2024-07-19 08:05:47 +09:00
5 changed files with 67 additions and 9 deletions

View file

@ -0,0 +1,7 @@
function Foo() {
this.x = 123;
}
var foo = new Foo();
if (foo.x === 123)
console.log("PASS");