1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 19:44:58 +00:00

LibJS/Bytecode: Don't clobber dst when assigning from object expression

When compiling code like this:

    x = { foo: x }

We don't want to put a new JS::Object in `x` until *after* we've
evaluated `x` for the `foo` field.

This fixes an issue when loading https://puter.com/ :^)
This commit is contained in:
Andreas Kling 2024-02-23 12:30:39 +01:00
parent b073fdd570
commit 6402ad29a6
3 changed files with 18 additions and 2 deletions

View file

@ -55,3 +55,11 @@ test("basic functionality", () => {
expect(a.toString()).toBe("1,20,2,,,3");
expect(a.getterSetterValue).toBe(20);
});
test("assigning array expression with destination referenced in array expression", () => {
function go(i) {
var i = [i];
return i;
}
expect(go("foo")).toEqual(["foo"]);
});