mirror of
https://github.com/morluto/rea.git
synced 2026-11-06 14:56:32 +00:00
fix(javascript): preserve semantic uncertainty and lexical ownership
This commit is contained in:
1 parent
9fe54c4073
commit
896696b2e7
16 files changed
+525
-20
No files matched your search
@@ -164,6 +164,32 @@ describe("JavaScript semantic values after explicit property mutations", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("invalidates a shared value reached through an object-literal prototype getter", () => {
|
||||
const value = resultValue(`
|
||||
const shared = { x: 1 };
|
||||
const proto = { get v() { return shared; } };
|
||||
const box = { __proto__: proto };
|
||||
box.v.x = 2;
|
||||
return shared.x;
|
||||
`);
|
||||
expect(
|
||||
value?.status === "unknown" ||
|
||||
(value?.status === "literal" && value.value === 2),
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it("does not follow an object-literal prototype getter past an own property", () => {
|
||||
expect(
|
||||
resultValue(`
|
||||
const shared = { x: 1 };
|
||||
const proto = { get v() { return shared; } };
|
||||
const box = { __proto__: proto, v: { x: 3 } };
|
||||
box.v.x = 2;
|
||||
return shared.x;
|
||||
`),
|
||||
).toEqual({ status: "literal", value: 1 });
|
||||
});
|
||||
|
||||
describe("JavaScript semantic mutations through getter results (#1494)", () => {
|
||||
it.each([
|
||||
[
|
||||
|
||||
Reference in new issue
Block a user